On Thursday, 2 July 2015 at 12:22:31 UTC, Atila Neves wrote:
On Wednesday, 1 July 2015 at 19:38:20 UTC, Jacob Carlborg wrote:
On 01/07/15 10:40, Atila Neves wrote:
[...]
You could write "shouldBe.gt(value)".
[...]
In every project I have used RSpec I have added custom
matchers/assertions. Just a couple of days ago I added a
custom matcher to one of my projects:
[...]
Ah, makes sense. I think I'm convinced now. The UFCS as an
extension mechanism could indeed be handy.
Atila
So... unconvinced again. I tried implementing it and it started
getting to be a right royal pain, and then I realised that
there's nothing to prevent a user from writing their own matchers
right now. From your example:
void shouldBeParsedAs(Code code, ASTNode node) { //I don't
really know what the types should be
if(...) {
throw new UnitTestException(...);
}
}
And... done. No need for a `Should` struct, no need for the
complications I faced trying to use one. I think the design is as
good as it can be.
Atila