[Pharo-project] About testing that ensure works

Stéphane Ducasse stephane.ducasse at inria.fr
Sun Apr 24 12:21:38 CEST 2011


> 
> testWithDoIsCorrectlyReinstallingDefaultEvenIfHalt
>        "self debug: #testWithDoIsCorrectlyReinstallingDefaultEvenIfHalt"
> 
>        | current empty |
>        current := RPackageOrganizer default.
>        empty := RPackageOrganizer basicNew initialize.
> 
> [
>        RPackage withOrganizer: empty
>                 do: [ self error ].
> ] on: Error do: [:ex |  ].
> 
>        self assert: (SystemAnnouncer announcer hasSubscriber: current).
>        self deny: (SystemAnnouncer announcer hasSubscriber: empty)

Igor but how can I specify that I want an error to occur in the do: and that I do not want to trap it but that the ensure 
should trap it. Is the ensure execute if I trap the error like that?

Stef


More information about the Pharo-project mailing list