it differ from assert because it contains the expression, file and line information. See this https://stackoverflow.com/questions/14420857/check-expect-example-in-racket
what's the closest thing we have in D? can we make it without compiler builtin?
Thread overview | |||||
---|---|---|---|---|---|
|
December 22, 2021 what the closest thing we have to racket's check_expect()? | ||||
---|---|---|---|---|
| ||||
December 22, 2021 Re: what the closest thing we have to racket's check_expect()? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dr Machine Code | On Wednesday, 22 December 2021 at 20:14:01 UTC, Dr Machine Code wrote: >it differ from assert because it contains the expression, file and line information. See this https://stackoverflow.com/questions/14420857/check-expect-example-in-racket Every error or exception in D has line and file information, stack trace and more, therefore you can catch AssertError and print the details if the default message printed on console is not enough. For unit testing you have https://code.dlang.org/packages/dunit |
December 23, 2021 Re: what the closest thing we have to racket's check_expect()? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dr Machine Code | On Wednesday, 22 December 2021 at 20:14:01 UTC, Dr Machine Code wrote: >it differ from assert because it contains the expression, file and line information. See this https://stackoverflow.com/questions/14420857/check-expect-example-in-racket if you just want to use an assert, the compiler flag Example how to use in DUB (from serve-d): https://github.com/Pure-D/serve-d/blob/84094fade433f3d52e43c5296d20af53b102ffdd/dub.json
|