[Pharo-project] About testing that ensure works

Henrik Sperre Johansen henrik.s.johansen at veloxit.no
Tue Apr 26 15:04:26 CEST 2011

On 24.04.2011 14:13, Stéphane Ducasse wrote:
> Ok I got it I ws confused by SUnit interference
> testDo
> 	"self run: #testDo"
> 	self do: [ Error signal].
> 	self assert: x = 3
> self run: #testDo ->  red tests
> self debug: #testDo + proceed ->  green tests

The ensure runs, but at that point the test already failed, see it says 
"1 errors", not "1 failures" :)

To see it manually, you could put
Transcript show: 'Foo' or some such in the ensure block instead, and 
notice how the Transcript is written :)


It's easier to just write
aBlock ensure: [blabla]
instead of
[aBlock value] ensure: [blabla]

... if aBlock REALLY is a block, and not aValuable, of course :=

More information about the Pharo-project mailing list