TestResource bug?

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

TestResource bug?

Guillermo Polito
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
Reply | Threaded
Open this post in threaded view
|

Re: TestResource bug?

Marcus Denker-4

On Apr 9, 2011, at 5:40 PM, Guillermo Polito wrote:

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

TestResource>>makeAvailable
 
...

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


Yes, I think you are right... can you add a bugreport?


--
Marcus Denker  -- http://www.marcusdenker.de
INRIA Lille -- Nord Europe. Team RMoD.

Reply | Threaded
Open this post in threaded view
|

Re: TestResource bug?

Guillermo Polito
Yep, thanks for the response!

Issue 3980: TestResource fails to makeAvailable an never recovers

On Sun, Apr 10, 2011 at 6:42 PM, Marcus Denker <[hidden email]> wrote:

On Apr 9, 2011, at 5:40 PM, Guillermo Polito wrote:

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

TestResource>>makeAvailable
 
...

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


Yes, I think you are right... can you add a bugreport?


--
Marcus Denker  -- http://www.marcusdenker.de
INRIA Lille -- Nord Europe. Team RMoD.