1 void funcThrows(string msg) { throw new Exception(msg); } 2 funcThrows("foo bar").shouldThrowWithMessage!Exception("foo bar"); 3 funcThrows("foo bar").shouldThrowWithMessage("foo bar"); 4 assertFail(funcThrows("boo boo").shouldThrowWithMessage("foo bar")); 5 void func() {} 6 assertFail(func.shouldThrowWithMessage("oops"));
Verify that an exception is thrown with the right message