Transpiled version (1811L) is out of date.
1 | sclass ErrorCounter { |
2 | new LPair<O, Throwable> errors; |
3 | int total; |
4 | |
5 | void run(O info, Runnable r) { |
6 | try { |
7 | r.run(); |
8 | } catch print e { |
9 | errors.add(pair(info, e)); |
10 | } |
11 | ++total; |
12 | } |
13 | |
14 | void print() { |
15 | _print(toString_short() + |
16 | (nempty(errors) ? "" : ". Fails: " + pairsA(errors))); |
17 | } |
18 | |
19 | S toString_short() { |
20 | ret empty(errors) |
21 | ? "No errors (tests: " + total + ")" |
22 | : n2(errors, "error") + " in " + n2(total, "test") + ". Fails: " + pairsA(errors); |
23 | } |
24 | |
25 | void add(ErrorCounter ec) { |
26 | if (ec == null) ret; |
27 | total += ec.total; |
28 | addAll(errors, ec.errors); |
29 | } |
30 | |
31 | bool allCorrect() { ret empty(errors); } |
32 | } |
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1021802 |
Snippet name: | ErrorCounter |
Eternal ID of this version: | #1021802/9 |
Text MD5: | 525533adda36cc11a3830223512ab323 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-03-29 18:03:44 |
Source code size: | 699 bytes / 32 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 366 / 857 |
Version history: | 8 change(s) |
Referenced in: | [show references] |