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).

svoid addTestToScorerWithPrintLog(Scorer<S> scorer, Runnable test) {
  if (test == null) ret;
  new Flag error;
  S output = hijackPrint_tee(r {
    try {
      test.run();
    } catch print e {
      error.raise();
    }
  });
  scorer.add(!error!, output);
}

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: 228 / 331
Version history: 4 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)