assertFalsey

Assert that a value evaluates as false.

void
assertFalsey
(
T
)
(,
string message = "Failed asserting falsey"
,
string file = __FILE__
,
size_t line = __LINE__
)

Parameters

value T

The value used during the assertion.

message string

The error message to display.

file string

The file name where the error occurred. The value is added automatically at the call site.

line size_t

The line where the error occurred. The value is added automatically at the call site.

Throws

DUnitAssertError if the assertation fails.

Examples

false.assertFalsey();
[].assertFalsey();
null.assertFalsey();
0.assertFalsey();

// Assert a DUnitAssertError is thrown if assertFalsey fails.
true.assertFalsey().assertThrow!(DUnitAssertError)("Failed asserting falsey");

Meta