Are exceptions caught in unittests?
Ferhat Kurtulmuş
aferust at gmail.com
Fri Feb 16 08:57:54 UTC 2024
On Friday, 16 February 2024 at 08:48:08 UTC, Jonathan M Davis
wrote:
> On Friday, February 16, 2024 1:06:26 AM MST Ferhat Kurtulmuş
> via Digitalmars- d-learn wrote:
>> [...]
>
> 1. assertThrown does not test whether something somewhere in
> what you called threw an exception. It asserts that it catches
> an exception. Your example here is catching the exception and
> returning so the exception never escapes the division function,
> and there's nothing for assertThrown to catch.
>
> [...]
Hi Jonathan, thank you for clearly explaining in detail how it
works. I added trailing parenthesis to the lambda inside
assertThrown, which worked as expected.
Ferhat
More information about the Digitalmars-d-learn
mailing list