Why can't I run a Test::Unit::TestCase from IRB and have it run before I
quit?
I have found this problem mentioned by others. For an example, see this
tutorial about testing:
http://www.nullislove.com/2007/11/14...sting-in-ruby/
>irb --simple-prompt
>> require 'test/unit'
=> true
>> class FirstTests < Test::Unit::TestCase
>> def test_addition
>> assert(1 + 1 == 2)
>> end
>>
>> def test_subtraction
>> assert(1 - 1 == 2)
>> end
>> end
=> nil
>> quit
Loaded suite irb
Started
F
Finished in 0.00119 seconds.
The author mentions that a quirk of irb makes this happen but doesn't
say what the quirk is:
"When we finished the definition, nothing happened. When we exited IRB,
then our tests ran. That’s a characteristic of using IRB for our tests
and won’t be significant as we move on."
Thanks for any insight you have.
--
Posted via
http://www.ruby-forum.com/.