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
  • Are exceptions c... Ferhat Kurtulmuş via Digitalmars-d-learn
    • Re: Are exc... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
      • Re: Are... Ferhat Kurtulmuş via Digitalmars-d-learn
    • Re: Are exc... Ferhat Kurtulmuş via Digitalmars-d-learn
      • Re: Are... Jonathan M Davis via Digitalmars-d-learn
      • Re: Are... Ferhat Kurtulmuş via Digitalmars-d-learn

Reply via email to