Bug in Test Unit?

In unit.rb with “ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]”

at_exit do
unless $! || Test::Unit.run?
exit Test::Unit::AutoRunner.run
end
end

if Test::Unit.run is set as false the autorunner will run, if it is set
as
true the autorunner will not run.
I don’t think this was the intention.

It should read as
unless $! && ! Test::Unit.run?

or (more readable).
if Test::Unit.run? && $!.nil?

Unless I am missing somethig…

Thanks
Nasir

On Mar 12, 2008, at 14:03 , Nasir K. wrote:

In unit.rb with “ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]”

at_exit do
unless $! || Test::Unit.run?
exit Test::Unit::AutoRunner.run
end
end

not a bug… just bad English. It should be #ran?, not #run?.

Well, if you see a few lines above that in unit.rb

module Unit
# If set to false Test::Unit will not automatically run at exit.
def self.run=(flag)
@run = flag
end

Now to me this reads as if you set the flag to true the tests will run
on
exit and if set to false the tests will not run on exit.

This is obviously not what will happen when
at_exit do
unless $! || Test::Unit.run?
exit Test::Unit::AutoRunner.run
end
end

is executed, but the exact opposite.

Nasir

On Wed, Mar 12, 2008 at 9:06 PM, Ryan D. [email protected]

On Thu, Mar 13, 2008 at 4:33 AM, Nasir K. [email protected]
wrote:

Nasir
This was reported by Slavomir Hudak as rubyforge bug #18041 – Unit
tests auto-run bug
My solution was to change the comment from “set to false” to “set to
true” :wink:

http://rubyforge.org/tracker/index.php?func=detail&aid=18041&group_id=426&atid=1698

J.

Agree. This is how I am using it now.

Thanks
Nasir