[squeak-dev] The Trunk: CollectionsTests-nice.285.mcz

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Thu Nov 30 21:21:01 UTC 2017


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

> Hey,
>
>
> > On 30.11.2017, at 21:25, commits at 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).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20171130/d3e9ea06/attachment.html>


More information about the Squeak-dev mailing list