assertEndsWith

Assert that a string ends with a particular string.

void
assertEndsWith
(
string value
,
string suffix
,
string message = "Failed asserting ends with"
,
string file = __FILE__
,
size_t line = __LINE__
)

Parameters

value
Type: string

The value used during the assertion.

suffix
Type: string

The suffix to match.

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 "foo bar".assertEndsWith("bar");
2 "baz qux".assertEndsWith("qux");
3 
4 // Assert a DUnitAssertError is thrown if assertEndsWith fails.
5 "foo".assertEndsWith("bar").assertThrow!(DUnitAssertError)("Failed asserting ends with");

Meta