[squeak-dev] Phexample on Squeak

Frank Shearar frank.shearar at gmail.com
Tue Mar 12 16:16:34 UTC 2013


On 9 March 2013 00:11, Stefan Marr <smalltalk at stefan-marr.de> wrote:
> Hi Frank:
>
> On 09 Mar 2013, at 00:45, Frank Shearar wrote:
>
>> I have only one blip: ForExampleStack >> #shouldFailWhenPopEmpty fails
>> because instead of 'this collection is empty' the example fails with
>> 'this stack is empty'.
>
> For Pharo I fixed it: http://smalltalkhub.com/#!/~Phexample/Phexample/diff/Phexample-StefanMarr.67
>
>  shouldFailWhenPopEmpty
>         | stack |
>         stack := self given: #shouldBeEmpty.
>
> +       [ stack pop ] should signal: Error withMessageText: 'a Stack() is empty'.!
> -       [ stack pop ] should signal: Error withMessageText: 'this collection is empty'.!
>
> If you have a good idea how to handle platform-specific little things like that, I would add it.

I don't for the general case. In _this_ case maybe we can find our way
out of the mess by enhancing Phexample:

shouldFailWhenPopEmpty
       | stack |
       stack := self given: #shouldBeEmpty.
       [ stack pop ] should signal: Error withMessageTextMatching: 'a
* is empty'.

where signal:withMessageTextMatching: takes a regex, or even just a
matcher like String >> #match: uses.

My apologies for not replying with such an extension written!

frank


More information about the Squeak-dev mailing list