1 module tests.fail.normal; 2 3 import unit_threaded; 4 5 6 class WrongTest: TestCase { 7 override void test() { 8 shouldBeTrue(5 == 3); 9 shouldBeFalse(5 == 5); 10 5.shouldEqual(5); 11 5.shouldNotEqual(3); 12 5.shouldEqual(3); 13 } 14 } 15 16 class OtherWrongTest: TestCase { 17 override void test() { 18 shouldBeTrue(false); 19 } 20 } 21 22 class RightTest: TestCase { 23 override void test() { 24 shouldBeTrue(true); 25 } 26 } 27 28 void testTrue() { 29 shouldBeTrue(true); 30 } 31 32 void testEqualVars() { 33 immutable foo = 4; 34 immutable bar = 6; 35 foo.shouldEqual(bar); 36 } 37 38 void someFun() { 39 //not going to be executed as part of the testsuite, 40 //doesn't obey the naming convention 41 assert(0, "Never going to happen"); 42 } 43 44 void testStringEqual() { 45 "foo".shouldEqual("bar"); 46 } 47 48 void testStringEqualFails() { 49 "foo".shouldEqual("bar"); 50 } 51 52 void testStringNotEqual() { 53 "foo".shouldNotEqual("foo"); 54 } 55 56 unittest { 57 const str = "unittest block that always fails"; 58 writelnUt(str); 59 assert(3 == 4, str); 60 } 61 62 void testIntArray() { 63 [1, 2, 4].shouldEqual([1, 2, 3]); 64 } 65 66 void testStringArray() { 67 ["foo", "baz", "badoooooooooooo!"].shouldEqual(["foo", "bar", "baz"]); 68 }