shouldNotBeNull

Verify that the value is not null.

void
shouldNotBeNull
(
T
)
(
in auto ref T value
,
in string file = __FILE__
,
in size_t line = __LINE__
)

Throws

UnitTestException on failure

Examples

1 class Foo
2 {
3     this(int i) { this.i = i; }
4     override string toString() const
5     {
6         import std.conv: to;
7         return i.to!string;
8     }
9     int i;
10 }
11 
12 shouldNotBeNull(new Foo(4));
13 assertFail(shouldNotBeNull(null));
14 shouldEqual(new Foo(5), new Foo(5));
15 assertFail(shouldEqual(new Foo(5), new Foo(4)));
16 shouldNotEqual(new Foo(5), new Foo(4)) ;
17 assertFail(shouldNotEqual(new Foo(5), new Foo(5)));

Meta