The delegate that is expected to throw the exception.
The message that is expected to be in the exception. Will not be tested, if it is null.
The file name that the assert failed in. Should be left as default.
The file line that the assert failed in. Should be left as default.
If delegate does NOT throw, will throw an AssertError.
// Makes sure it throws with the message "boom!" shouldThrow("boom!", delegate() { throw new Exception("boom!"); }); // Will throw an exception like "AssertError@test/example.d(7): Exception was not thrown. Expected: boom!" shouldThrow("boom!", delegate() { });
Used for asserting that a delegate will throw an exception.