Monday, July 23, 2007

IronRuby Tests

I'm sure there's a lot to be learned from the IronRuby code base but one thing in particular stuck out in my mind: the test code is actually good Ruby code.

This was in stark contrast to the Ruby.NET test code which looks more like LISP to me than Ruby. Don't get me wrong, there's a lot to impress the Ruby enthusiast in the Ruby.NET project especially since it has been moved to an open source contribution model.

My point is simply that I have confidence that IronRuby will be true to the Ruby spirit. For one, they allow for Ruby-casing when calling .NET classes, e.g., Environment.user_name instead of Environment.UserName. For another, they've obviously been studying RSpec (this is a good thing!). This is the kind of code that I like to see behind anything that I use:
describe "range creation" do

it "creates an inclusive range object from integer literals" do
a = 0..1
a.class.name.should == "Range"
a.begin.should == 0
a.end.should == 1
a.exclude_end?.should == false
end

end


The IronRuby test suite would be a great model for the various Ruby specification projects that are out there. It's a from-the-ground-up, behavioral specification for any Ruby language implementation.

It's an exciting time for Ruby programmers who have (or want) to use .NET!

No comments: