1 /**
2  A module with tests to test the compile-time reflection
3  */
4 
5 module unit_threaded.ut.modules.module_with_tests;
6 
7 import unit_threaded.runner.attrs;
8 import unit_threaded.runner.reflection: Test;
9 
10 import std.meta;
11 import unit_threaded.should;
12 
13 //test functions
14 void testFoo() {}
15 void testBar() {}
16 private void testPrivate() { } //should not show up
17 @UnitTest void funcThatShouldShowUpCosOfAttr() { }
18 
19 //non-test functions
20 private void someFun() {}
21 private void testosterone() {}
22 private void tes() {}
23 
24 //non-test non-functions
25 int testInt;
26 
27 //test classes
28 class FooTest { void test() { } }
29 class BarTest { void test() { } }
30 @UnitTest class Blergh { }
31 
32 //non-test classes
33 class NotATest { void tes() { } }
34 class AlsoNotATest { void testosterone() { } }
35 
36 @HiddenTest void withHidden() {}
37 void withoutHidden() { }
38 
39 //other non-test members
40 alias seq = AliasSeq!(int, float, string);
41 
42 
43 unittest {
44     //1st block
45     assert(true);
46 }
47 
48 unittest {
49     //2nd block
50     assert(true);
51 }
52 
53 @Name("myUnitTest")
54 unittest {
55     assert(true);
56 }
57 
58 struct StructWithUnitTests{
59     alias SelfSoDontRecurseForever = StructWithUnitTests;
60 
61     @Name("InStruct")
62     unittest{
63         assert(false);
64     }
65     unittest{
66         // 2nd inner block.
67         assert(true);
68     }
69 }
70 
71 // github issue #26 - template instance GetTypes!uint does not match template declaration
72 alias RGB = uint;
73 
74 
75 import unit_threaded: TestCase;
76 
77 class Issue83: TestCase {
78     this() {}
79     override void test() {}
80 }
81 
82 
83 mixin Test!(
84     "this is my successful test name",
85     {
86 
87     }
88 );
89 
90 mixin Test!(
91     "this is my unsuccessful test name",
92     {
93         assert(false);
94     }
95 );