The range to interogate.
The error message to display.
The file name where the error occurred. The value is added automatically at the call site.
The line where the error occurred. The value is added automatically at the call site.
DUnitAssertError if the assertation fails.
1 class A 2 { 3 void popFront() {}; 4 @property bool empty() { return true; }; 5 @property int front() { return 0; }; 6 } 7 8 struct B 9 { 10 void popFront() {}; 11 enum bool empty = false; 12 @property int front() { return 1; }; 13 } 14 15 static assert(isInputRange!(A)); 16 static assert(isInputRange!(B)); 17 18 auto emptyRange = new A(); 19 emptyRange.assertEmpty(); 20 21 B infiniteRange = B.init; 22 infiniteRange.takeNone.assertEmpty(); 23 24 // Assert a DUnitAssertError is thrown if assertEmpty fails. 25 infiniteRange.assertEmpty().assertThrow!(DUnitAssertError)("Failed asserting empty range"); 26 infiniteRange.take(10).assertEmpty().assertThrow!(DUnitAssertError)("Failed asserting empty range");
Assert that a range is empty.