std.experimental.testing PR review

Atila Neves via Digitalmars-d digitalmars-d at puremagic.com
Fri Jun 26 14:43:31 PDT 2015


On Friday, 26 June 2015 at 15:20:43 UTC, David Gileadi wrote:
> On 6/26/15 7:30 AM, Atila Neves wrote:
>> On Friday, 26 June 2015 at 13:32:39 UTC, Dicebot wrote:
>>> Just in case it wasn't clear : I will vote "no" on this 
>>> proposal as
>>> long as it features longish "readable" names like 
>>> "shouldEquals".
>>
>> You'd rather `should!"=="`? I'm not sure which I'd prefer; the 
>> thing is
>> that so far you're the only one strongly against it. The only 
>> other
>> thing I heard was a question at DConf on why it wasn't 
>> `assertEquals`
>> instead.
>>
>> Atila
>
> Let's paint this bikeshed!
>
> I tend to like "must" instead of "should"; it's a bit shorter 
> and stronger.
>
> I tend to like dot-separated English for testing, e.g.
>
> throwRangeError.must.throw!RangeError;
>
> One advantage is that the dot after "must" (or "should") can 
> trigger code completion on IDEs.
>
> Finally, I wonder if it's possible to hijack operator 
> overloading to support this:
>
> 2.timesTwo.must == 4;

Yes, this works for `==`. Unfortunately it doesn't work for 
anything else, including but not limited to `!=`. Oh, I tried. 
Even though `==` is clearly going to be the most used one, I 
don't like the idea of having to use a compile-time string for 
the other ones.

Atila





More information about the Digitalmars-d mailing list