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

The value used during the assertion.

prefix
Type: string

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

Meta