assertTrue

Asserts that a condition is true.

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

Throws

AssertException otherwise

Examples

1 assertTrue(true);
2 assertTrue("foo" in ["foo": "bar"]);
3 
4 auto exception = expectThrows!AssertException(assertTrue(false));
5 
6 assertEquals("Assertion failure", exception.msg);

Meta