PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.ruby > bug in Test Unit?
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
bug in Test Unit?

Réponse
 
LinkBack Outils de la discussion
Vieux 12/03/2008, 22h03   #1
Nasir Khan
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut bug in Test Unit?

[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

  Réponse avec citation
Vieux 13/03/2008, 02h06   #2
Ryan Davis
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: bug in Test Unit?


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?.


  Réponse avec citation
Vieux 13/03/2008, 04h33   #3
Nasir Khan
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: bug in Test Unit?

[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?.
>
>
>


  Réponse avec citation
Vieux 13/03/2008, 04h45   #4
Phlip
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: bug in Test Unit?

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/
  Réponse avec citation
Vieux 13/03/2008, 07h54   #5
Jano Svitok
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: bug in Test Unit?

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.

  Réponse avec citation
Vieux 13/03/2008, 18h56   #6
Nasir Khan
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: bug in Test Unit?

[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.
>
>


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 03h36.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,12954 seconds with 14 queries