SUnit bug ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

SUnit bug ?

Mariano Martinez Peck
Hi folks!

Today, at work, a friend ask me about a method in TestResource because he thought it was a bug. We look at it, and for us, it could be a bug. So, I ask to you.

See TestResource class side isAvailable

------------------------
isAvailable
    ^self current notNil and: [self current isAvailable]
------------------------

the first part (self current notNil) ALWAYS return true because of the implementation  of self current:

------------------------
current

    current isNil
        ifTrue: [current := self new].

    ^current
-------------------------


The second part too. Because the implementation of self available (object side method):

-------------------------
isAvailable
    "override to provide information on the
    readiness of the resource"
   
    ^true
-------------------------

Ok, you can override and change this method in subclasses, however, the first part is ALWAYS true.

Is this correct ? or isAvailable should be:

isAvailable
    ^ self current isAvailable


Thanks!

Mariano
           

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project