Monday, July 23, 2007

FsUnit

I've really been getting into F# as of late. I love not having to declare types everywhere. The syntax is almost as beautiful as Ruby. I've had no problems interoperating with any other .NET library. This latter point was a particular breath of fresh air; I don't, for example, like how IronPython handles interfaces.

It's a struggle to learn functional programming concepts at the same as you learn a new language but that's why I chose F# in the first place. :) It's not that bad actually since with F# you can code in the same manner as you would in Visual Basic or C#. It really lets you ease into the whole functional thing...you never feel forced into something you're not ready for which is a danger when learning a purely functional language like Haskell (which I also like very much).

So the first thing I learn in a new language is a good testing framework. I love me some NUnit just as much as the next guy, but I prefer the syntax of RSpec. I'm working on a happy medium in a project that I'm calling FsUnit. You can get it here.

With FsUnit, you still write TestFixtures and Tests but you can write assertions like the following:
1 |> should equal 1

or
true |> should be True


Please try it out, send me ideas or corrections, and otherwise, enjoy yourself testing in F#! :)

No comments: