std.experimental.testing PR review

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Wed Jun 3 23:33:49 PDT 2015


On 2015-06-03 12:50, Atila Neves wrote:

> Easily. I toyed with this syntax
>
> foo().should == 3;
>
> And that works. Unfortunately it doesn't work for `!=` or `>=`. I could
> do the other operators as compile-time strings, but then `==` would be
> the weird one out. In the end I didn't think there was much value of
> typing `should.equal` over `shouldEqual` and left it as it is.

The reason would/might be custom "should functions"/matchers.

> I'd have to think about that. First we'd have to agree on how things
> should look, though.

Yeah, but I would think that if the "should" function was separate from 
the operator used it would be easier, but I don't know.


> No, but it'd be easy to write. Is that actually needed though? It
> doesn't seem something that would come up often, and one could always
> write `&foo.shouldEqual(&bar)`.

I don't know. RSpec has it.

> I might take a look, but really all I've ever seen is expecting to throw
> a particular exception anyway.

This was for when you're expecting a function to _not_ throw an exception.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list