[Pharo-project] TestResource bug?
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
"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 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
Is this a bug or i'm doing a mistake? Shouldn't *current := false be
changed *be changed by *current := nil. *??*
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Pharo-project