This latest release actually removed the need for a pair of parens in many cases. So instead of:
1 |> should (equal 1)
you can now write:
1 |> should equal 1
Getting rid of parens at this level is pretty important to me so it's pleasure to bid them adieu!
One of the other major changes was perhaps more for my sake than for the user's but then maybe not. Prior releases incorporated negation into the assertion bit itself. So if you wanted to say "1 should not equal 2" you had to write:
1 |> should (notEqual 2)
The
not'
keyword makes it possible to negate any assertion in FsUnit:1 |> should not' (equal 2)This removed a lot of duplicate code and it also just about cut the number of specs for FsUnit itself in half.
Finally, the last major change is the
spec
keyword. This keyword is a shortcut for labeling and executing your specs. It also stores the result in a ResultStore object. With the spec
keyword, specs look like this:spec "A number should equal itself."
(1 |> should equal 1)
I like the way that this looks very much and I'm going to try to keep this syntax stable between releases.
Let me know what you think of the new release!
2 comments:
Nice work!
I never cease to be amazed at how F# syntax can eventually lead to great code clarity (though getting there from initial constructs can be a challenge)
aaron,
Thanks for the encouraging words! I agree with what you're saying. Us F#'ers are lucky, though. Other language users get to spend the same amount of time only to end up with what? Method chains and fluent interfaces? Blech!*
(* Disclaimer: the author loves a good fluent interface when it's called for.)
Post a Comment