Compare this test:
def testFactorial():
assertEquals(120, fac(5))
With this other:
>>> fac(5)
120
[If you don't understand the later, you should learn a language that provides a REPL. Really.]
So, someone working in Ruby saw the light and implemented it. Nice.
Doctest simplicity is a really poweful concept. The more impressive example is minimock, a mock library built on top of it. Aside from keeping the tests very understandable, the implementation is just 25 lines of python code. How about porting that to Ruby too?


0 comments:
Post a Comment