1 
2 module isodi.headless.tests;
3 
4 import core.runtime;
5 
6 import isodi.tests;
7 import isodi.headless.display;
8 
9 
10 @safe:
11 
12 
13 version (unittest):
14 
15 shared static this() {
16 
17     // Redirect to our main
18     Runtime.extendedModuleUnitTester = {
19 
20         UnitTestResult result = {
21             runMain: true
22         };
23 
24         return result;
25 
26     };
27 
28 }
29 
30 void main() {
31 
32     // Restore original test runner
33     Runtime.extendedModuleUnitTester = null;
34 
35     // Create a test runner
36     TestRunner runner;
37     runner.runTests();
38 
39     // Run the tests
40     loop: while (true) {
41 
42         with (TestRunner.Status)
43         final switch (runner.status) {
44 
45             // Idle
46             case idle:
47             case paused:
48 
49                 // Order next task
50                 runner.nextTest();
51                 break;
52 
53             // Finished
54             case finished:
55 
56                 // Stop the program
57                 break loop;
58 
59             // Working, let it do its job
60             case working: break;
61 
62         }
63 
64     }
65 
66 }