Thread overview |
---|
February 11, 2020 Printing LHS and RHS of assert expressions on failure | ||||
---|---|---|---|---|
| ||||
Hi, is there any trick to print the RHS and the LHS of the assert expressions when it fails? like `assert(2 == 5)` should fail and print something like: ... assert failed [__LINE__/__MODULE__]: Left hand side: 2 is 2, Right hand side: 5 is 5 Of course, I can design a function to do so myself, but I just want to know is there any de-facto way of achieving this? Is there any unit-testing library that does this for me? |
February 11, 2020 Re: Printing LHS and RHS of assert expressions on failure | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adnan | On Tuesday, 11 February 2020 at 13:38:32 UTC, Adnan wrote:
> I just want to know is there any de-facto way of achieving this?
See the `-checkaction=context` switch.
|
February 11, 2020 Re: Printing LHS and RHS of assert expressions on failure | ||||
---|---|---|---|---|
| ||||
Posted in reply to kinke | On Tuesday, 11 February 2020 at 13:45:24 UTC, kinke wrote:
> On Tuesday, 11 February 2020 at 13:38:32 UTC, Adnan wrote:
>> I just want to know is there any de-facto way of achieving this?
>
> See the `-checkaction=context` switch.
Exactly what I was after. Thanks.
|
Copyright © 1999-2021 by the D Language Foundation