linkrope / dunit

xUnit Testing Framework for D
Boost Software License 1.0
37 stars 9 forks source link

added assertThrows() #5

Closed berdroid closed 8 years ago

berdroid commented 9 years ago

This new assert method tests for an expression to throw a defined exception. If it does, the test passes. Otherwise an AssertException is thrown. The expected exception type is given as a template parameter.

linkrope commented 8 years ago

There is no real advantage over assertThrown from std.exception.

JUnit 5, however, introduced expectThrows, which returns the expected exception, so that it can be further verified. With the switch to JUnit 5, expectThrows is now available in dunit.assertion.