what the closest thing we have to racket's check_expect()?

Rumbu rumbu at rumbu.ro
Wed Dec 22 21:16:40 UTC 2021


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
> what's the closest thing we have in D? can we make it without 
> compiler  builtin?

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


More information about the Digitalmars-d-learn mailing list