Uses 911K of libraries. Click here for Pure Java version (22018L/131K).
1 | !7 |
2 | |
3 | !include once #1021761 // Gazelle Fakery |
4 | |
5 | set flag DynModule. |
6 | |
7 | concept Test { |
8 | S name, contents; |
9 | long lastRun, runtime; |
10 | bool success, anySuccess; |
11 | } |
12 | |
13 | cmodule GazelleTests > DynCRUD<Test> { |
14 | transient bool running; |
15 | |
16 | transient O[] flags = litparams( |
17 | debugSorting := true, |
18 | useRepeat_v2 := true); |
19 | |
20 | start { |
21 | dm_useLocalMechListCopies(); |
22 | crud.multiLineFields = litset('contents); |
23 | } |
24 | |
25 | visualize { |
26 | JComponent c = super.visualize(); |
27 | addSelectionDependentButton("Run", r { doIt(selected().name) }); |
28 | ret jvsplit(c, |
29 | centerAndSouthWithMargin(dm_printLogComponent(), |
30 | withMargin(jbutton("Run Tests", r runAll)))); |
31 | } |
32 | |
33 | void runAll() { |
34 | doIt(""); |
35 | } |
36 | |
37 | void doIt(S testName) q { |
38 | _doIt(testName); |
39 | } |
40 | |
41 | void _doIt(S testName) { |
42 | temp dm_tempSetField(running := true); |
43 | |
44 | clearPrintLog(); |
45 | gazelle_performMultipleTests(mL_raw("Gazelle Tests"), |
46 | paramsPlus(flags, |
47 | performOnly := testName, |
48 | testStarting := voidfunc(S name, S contents) { |
49 | cset(uniq_sync Test(+name), lastRun := now(), +contents) |
50 | }, |
51 | testDone := voidfunc(S name, ErrorCounter scorer) { |
52 | Test test = conceptWhere Test(+name); |
53 | cset(test, runtime := now()-test.lastRun); |
54 | cset(test, success := scorer.allCorrect()); |
55 | if (test.success) cset(test, anySuccess := true); |
56 | } |
57 | )); |
58 | } |
59 | |
60 | // API |
61 | |
62 | void runTestAndWait(S testName) { |
63 | dm_runInQAndWait(r { _doIt(testName) }); |
64 | } |
65 | |
66 | Pair<Int> countAndSuccesses() { |
67 | ret pair(countConcepts(Test), countConceptsWhere(Test, success := true)); |
68 | } |
69 | } |
Began life as a copy of #1022442
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: | #1022661 |
Snippet name: | Gazelle Tests v2 [Dyn Module, with CRUD] |
Eternal ID of this version: | #1022661/7 |
Text MD5: | 24827cf86464af98fc2c4e2f2f8174df |
Transpilation MD5: | 56f9d1f760d96fbab5df082a2b00e79e |
Author: | stefan |
Category: | javax / gazelle |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-03-29 18:30:08 |
Source code size: | 1678 bytes / 69 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 298 / 2450 |
Version history: | 6 change(s) |
Referenced in: | [show references] |