std.experimental.testing PR review

David Gileadi via Digitalmars-d digitalmars-d at puremagic.com
Fri Jun 26 08:20:43 PDT 2015


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;


More information about the Digitalmars-d mailing list