2017-11-30 22:02 GMT+01:00 Tobias Pape <Das.Linux@gmx.de>:
Hey,


> On 30.11.2017, at 21:25, commits@source.squeak.org wrote:
>
> Nicolas Cellier uploaded a new version of CollectionsTests to project The Trunk:
> http://source.squeak.org/trunk/CollectionsTests-nice.285.mcz
>
> ==================== Summary ====================
>
> Name: CollectionsTests-nice.285
> Author: nice
> Time: 30 November 2017, 9:25:14.59936 pm
> UUID: e50f181d-41a8-428f-ba63-b370998aac7d
> Ancestors: CollectionsTests-nice.284
>
> Tests for (Wide)CharacterSet(Complement)
>
> - add tests for intersection: and union:
> - don't (ab)use should: when assert: could do it

Can you explain that for me?

Best regards
        -Tobias

Hi Tobias,
certainly: a block shall be used to differ evaluation for various purposes like:
- evaluate an expression conditionnally
- evaluate an expression iteratively
- evaluate preconditions/postconditions like in showWhile: , ensure: , exception protection (ifError: , on:do:), interruption protection (critical:) etc...

If we do not need to differ evaluation, then we should not use a Block.
In SUnit TestCase, a Block is usefull for catching exception (should:raise: shouldnt:raise:).

But (aTestCase should: [self doSomething]) is an un-necessary usage of Block, because there's absolutely no interest in differing evaluation.
It does not bring anything compared to (aTestCase assert: self doSomething).

I think that I used should: because I did like the name better than assert:

Also since you ask, I see that I left a (self shouldnt: [self doSomething] raise: Error) which can also be considered a Bad Style (TM), because catching too wide!
This is already covered by (self assert: self doSomething).