shouldThrowWithMessage

Verify that an exception is thrown with the right message

void
shouldThrowWithMessage
(
T : Throwable = Exception
E
)
(
lazy E expr
,
string msg
,
string file = __FILE__
,
size_t line = __LINE__
)

Examples

void funcThrows(string msg) { throw new Exception(msg); }
funcThrows("foo bar").shouldThrowWithMessage!Exception("foo bar");
funcThrows("foo bar").shouldThrowWithMessage("foo bar");

Meta