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

Atila Neves via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 1 05:44:00 PDT 2015


On Wednesday, 1 July 2015 at 09:08:22 UTC, Mike wrote:
> On Wednesday, 1 July 2015 at 08:40:24 UTC, Atila Neves wrote:
>>
>> I hate its verbosity and all I really want to write is 
>> `assert(a > b)` and get a decent error message.
>>
>
> I haven't been following this too closely as there is only so 
> much I can pay attention to at any time, so I apologize in 
> advance if the following comments are uninformed.  If so, just 
> ignore them.
>
> I suspect from your comments that you want to use `assert`, but 
> it's currently reserved by the language and 
> https://github.com/D-Programming-Language/dmd/pull/1426 was not 
> followed through on, and is currently owned by a ghost 
> (literally).
>
> I therefore suggest using `assertThat(whatever)`.  If/when 
> `assert` is improved upon to allow integration into this 
> library, `assertThat` can be deprecated.

The problem there is `assertThat` gives no more information than 
`assert` currently does. This thread is all about how do we want 
to deal with custom assertions that give you useful information. 
My conclusion so far has been that what's there is probably the 
best we're going to get.

I could always change the shouldXXX functions to be called 
assertXXX instead, but it doesn't look as good with UFCS. That 
might get me Dicebot's vote though :)

Atila

Atila

>
> Sorry if I'm making noise,
> Mike




More information about the Digitalmars-d mailing list