assertNotNull

Asserts that the value is not null.

void
assertNotNull
(
T
)
(
,
lazy string msg = null
,
string file = __FILE__
,
size_t line = __LINE__
)

Throws

AssertException otherwise

Examples

1 Object foo = new Object();
2 
3 assertNotNull(foo);
4 
5 auto exception = expectThrows!AssertException(assertNotNull(null));
6 
7 assertEquals("Assertion failure", exception.msg);

Meta