Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

12
LINES

< > BotCompany Repo | #1025940 // addTestToScorerWithPrintLog - run Runnable, add OK to scorer if no exception

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2608L/17K).

1  
svoid addTestToScorerWithPrintLog(Scorer<S> scorer, Runnable test) {
2  
  if (test == null) ret;
3  
  new Flag error;
4  
  S output = hijackPrint_tee(r {
5  
    try {
6  
      test.run();
7  
    } catch print e {
8  
      error.raise();
9  
    }
10  
  });
11  
  scorer.add(!error!, output);
12  
}

Author comment

Began life as a copy of #1025755

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1025940
Snippet name: addTestToScorerWithPrintLog - run Runnable, add OK to scorer if no exception
Eternal ID of this version: #1025940/5
Text MD5: a764f8b116d996cc50427836c5076663
Transpilation MD5: a6f7fd81f0b84f7410d5a33376abb2aa
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-11-01 12:27:32
Source code size: 271 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 227 / 330
Version history: 4 change(s)
Referenced in: [show references]