|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
[Note: parts of this message were removed to make it a legal post.]
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 |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Mar 12, 2008, at 14:03 , Nasir Khan 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?. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
[Note: parts of this message were removed to make it a legal post.]
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 Davis <ryand-ruby@zenspider.com> wrote: > > On Mar 12, 2008, at 14:03 , Nasir Khan 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?. > > > |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
Nasir Khan wrote:
> def self.run=(flag) > This is obviously not what will happen when at_exit do > unless $! || Test::Unit.run? >> not a bug... just bad English. It should be #ran?, not #run?. See the ? mark? 'run?' ain't the same as 'run=' or 'run()'. Hence, your line gets pronounced "unless you have an error, or you already ran, you will now run". (And, yes, you Inflector detractors, good grammar matters in programming! ![]() -- Phlip http://assertxpath.rubyforge.org/ |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
On Thu, Mar 13, 2008 at 4:33 AM, Nasir Khan <rubylearner@gmail.com> wrote:
> 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 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" ;-) http://rubyforge.org/tracker/index.p...=426&atid=1698 J. |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
[Note: parts of this message were removed to make it a legal post.]
Agree. This is how I am using it now. Thanks Nasir On Thu, Mar 13, 2008 at 2:54 AM, Jano Svitok <jan.svitok@gmail.com> wrote: > On Thu, Mar 13, 2008 at 4:33 AM, Nasir Khan <rubylearner@gmail.com> wrote: > > 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 > > 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" > ;-) > > > http://rubyforge.org/tracker/index.p...=426&atid=1698 > > J. > > |
|
![]() |
| Outils de la discussion | |
|
|