1 module tests.pass.attributes; 2 3 import unit_threaded; 4 5 enum myEnumNum = "foo.bar"; //there was a bug that made this not compile 6 enum myOtherEnumNum; 7 8 @Tags("tagged") 9 unittest { 10 //tests that using the @UnitTest UDA adds this function 11 //to the list of tests despite its name 12 1.shouldEqual(1); 13 } 14 15 16 @HiddenTest("Bug id #54321") 17 unittest { 18 null.shouldNotBeNull; //hidden by default, fails if explicitly run 19 } 20 21 @HiddenTest 22 unittest { 23 null.shouldNotBeNull; //hidden by default, fails if explicitly run 24 } 25 26 27 @ShouldFail("Bug id 12345") 28 unittest { 29 3.shouldEqual(4); 30 } 31 32 33 @ShouldFail("Bug id 12345") 34 unittest { 35 throw new Exception("This should not be seen"); 36 } 37 38 @Tags("tagged") 39 @Name("first_unit_test") 40 unittest { 41 writelnUt("First unit test block\n"); 42 assert(true); //unit test block that always passes 43 } 44 45 46 @Name("second_unit_test") 47 unittest { 48 writelnUt("Second unit test block\n"); 49 assert(true); //unit test block that always passes 50 } 51 52 @Tags(["untagged", "unhinged"]) 53 @("third_unit_test") 54 unittest { 55 3.shouldEqual(3); 56 } 57 58 @ShouldFail 59 unittest { 60 3.shouldEqual(5); 61 } 62 63 64 @ShouldFail 65 unittest { 66 assert(false); 67 } 68 69 70 @Flaky 71 unittest { 72 static int i = 0; 73 if(i++ % 2 == 0) throw new Exception("oops"); 74 }