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
Type: T

The value used during the assertion.

message
Type: string

The error message to display.

file
Type: string

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

line
Type: size_t

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

Throws

DUnitAssertError if the assertation fails.

Examples

1 false.assertFalsey();
2 [].assertFalsey();
3 null.assertFalsey();
4 0.assertFalsey();
5 
6 // Assert a DUnitAssertError is thrown if assertFalsey fails.
7 true.assertFalsey().assertThrow!(DUnitAssertError)("Failed asserting falsey");

Meta