Let's bikeshed std.experimental.testing assertions/checks/whatchamacallits

Atila Neves via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 1 01:21:27 PDT 2015


On Tuesday, 30 June 2015 at 19:48:46 UTC, Jacob Carlborg wrote:
> On 30/06/15 10:06, Atila Neves wrote:
>
>> Well, the dream would be that `assert(foo ==
>> bar)` did what part of this PR does, but that's another story 
>> and
>> something that can't be done by a library unless we had AST 
>> macros,
>> which we won't. Or Lisp's reader macros, but we won't get 
>> those either.
>
> I was thinking the same. Both the test!"==" and shouldEqual are 
> workarounds to get a nice message on an assertion failure. I'm 
> wondering how hard it would be to have the compiler generate a 
> string representing the failing expression.

Well, there's a PR for improving assertions here: 
https://github.com/D-Programming-Language/dmd/pull/1426

Since I have 0 experience in compilers in general and dmd in 
particular, I thought that'd be an easy way for me to get an in 
on the assert situation. It seems... more complicated than I can 
handle at the moment.

The 100% ideal situation is for assert to do what I'm doing with 
the functions in the `should` module. That module really 
shouldn't even exist.

Atila


More information about the Digitalmars-d mailing list