1 /** 2 A module with tests to test the compile-time reflection 3 */ 4 5 module unit_threaded.tests.module_with_tests; 6 7 import unit_threaded.attrs; 8 9 version(unittest) { 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 44 unittest { 45 //1st block 46 assert(true); 47 } 48 49 unittest { 50 //2nd block 51 assert(true); 52 } 53 54 @Name("myUnitTest") 55 unittest { 56 assert(true); 57 } 58 59 struct StructWithUnitTests{ 60 alias SelfSoDontRecurseForever = StructWithUnitTests; 61 62 @Name("InStruct") 63 unittest{ 64 assert(false); 65 } 66 unittest{ 67 // 2nd inner block. 68 assert(true); 69 } 70 } 71 72 // github issue #26 - template instance GetTypes!uint does not match template declaration 73 alias RGB = uint; 74 75 76 import unit_threaded: TestCase; 77 78 class Issue83: TestCase { 79 this() {} 80 override void test() {} 81 }