From: Brian Candler Date: 2009-03-30T19:55:48+09:00 Subject: Re: testy.rb - ruby testing that's mad at the world Bil Kleb wrote: > Sounds like you're pining for Python's doctest? > > http://docs.python.org/library/doctest.html Ah, now that's a really interesting way of thinking about examples/testing: in the form of an irb session. You can write your tests just by mucking about in irb, and when it makes sense, just paste the output somewhere. irb> foo = generate_foo => # irb> foo.attr1 => "hello" irb> foo.attr2 => "world" Presumably you could avoid the fragile comparison on Object#inspect output by deleting it from the transcript. irb> foo = generate_foo ... irb> foo.attr1 => "hello" irb> foo.attr2 => "world" Writing something which parses that an (re)runs it to verify the output should be pretty straightforward. It can also handle the 'assert_raises' case nicely. irb> f.attr3 NoMethodError: undefined method `attr3' for ... Ara, how about it? :-) -- Posted via http://www.ruby-forum.com/.