1 module dunittest;
2 
3 import std.exception;
4 
5 import dunit;
6 import pijamas : should;
7 import pijamas.exception : PiException = AssertException;
8 
9 int main (string[] args)
10 {
11   return dunit_main(args);
12 }
13 class Test
14 {
15     mixin UnitTest;
16 
17     @Test
18     public void shouldAssertionTrue() @trusted
19     {
20       // it("returns and asserts for true",
21       {
22         true.should.be.True;
23         (1 == 1).should.be.True;
24       }
25 
26       // it("throws for false",
27       {
28         (1 != 1).should.not.be.True;
29         assertThrown!PiException(false.should.be.True);
30       }
31     }
32 }
33 
34 version(Debug_Failing_Tests) {
35   class FailingTest
36   {
37       mixin UnitTest;
38 
39       @Test
40       public void failingTest()
41       {
42         10.assertEquals(0);
43         //10.should.be.equal(0);
44       }
45 
46       @Test
47       public void failingTestNativeAssert()
48       {
49         assert(10 == 0);
50       }
51 
52       @Test
53       public void errorTest()
54       {
55         throw new Exception("Some exception");
56       }
57   }
58 }