[Pharo-project] TestResource bug?

Guillermo Polito guillermopolito at gmail.com
Sat Apr 9 17:40:37 CEST 2011


Hi!  I'm using pharo 1.2 and I've found a little problem in here

TestResource>>makeAvailable
    "This method must be the _only_ way to set a notNil value for the unique
instance (current).  First, obtain a candidate instance and set current to a
notNil placeholder (any notNil object not an instance of me would do;  this
version uses false).  Next, check any subordinate resources needed by this
resource.  Lastly, setUp the candidate and put it in current if it is
available, ensuring that it is torn down otherwise."

    | candidate |
*    current := false.*
    candidate := self new.
    self resources do: [:each | each availableFor: candidate].
    [candidate setUp.
    candidate isAvailable ifTrue: [current := candidate]]
        ensure: [current == candidate ifFalse: [candidate tearDown]]

And everywhere in the class, the check over the current class instance var
is done like

current isNil ifTrue: ....

So once that var is initialized, but the makeAvailable fails, it always
fails...

Is this a bug or i'm doing a mistake?  Shouldn't *current := false be
changed *be changed by *current := nil.  *??*

*Thanks!
Guille
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gforge.inria.fr/pipermail/pharo-project/attachments/20110409/ed7517ef/attachment.htm>


More information about the Pharo-project mailing list