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

Atila Neves via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 30 04:14:53 PDT 2015


On Tuesday, 30 June 2015 at 08:38:44 UTC, Adrian Matoga wrote:
> On Tuesday, 30 June 2015 at 08:06:37 UTC, Atila Neves wrote:
>
>> I'm not convinced composability brings anything to the table 
>> except for editor dot-completion. I don't like the verbosity 
>> of what's there now, but my prefererred syntax doesn't work 
>> except for the ubiquitous  check for equality (`should ==`).
>
> Could you give some examples of your preferred syntax and why 
> it doesn't work?

`foo.should == "bar";` works. Nothing else does (and in fact in 
retrospect it's surprising that == does) because they do nothing 
by themselves. `foo.should != bar` is the same as `!(foo == 
bar)`, which on a statement by itself is nonsensical and rejected 
by the compiler with "has no effect in expression" error. You 
could write something like `if(foo.should != "bar") {}` and that 
compiles fine but it's super hacky and ugly.

Atila


More information about the Digitalmars-d mailing list