assertStartsWith

Assert that a string starts with a particular string.

void
assertStartsWith
(
string value
,
string prefix
,
string message = "Failed asserting starts with"
,
string file = __FILE__
,
size_t line = __LINE__
)

Parameters

value string

The value used during the assertion.

prefix string

The prefix to match.

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

"foo bar".assertStartsWith("foo");
"baz qux".assertStartsWith("baz");

// Assert a DUnitAssertError is thrown if assertStartsWith fails.
"foo bar".assertStartsWith("baz").assertThrow!(DUnitAssertError)("Failed asserting starts with");

Meta