Test expectation language (was Re: [squeak-dev] The Inbox: CollectionsTests-dtl.209.mcz)

Frank Shearar frank.shearar at gmail.com
Sat Jan 4 12:57:50 UTC 2014


On 4 January 2014 00:14, Colin Putney <colin at wiresong.com> wrote:
>
>
>
> On Fri, Jan 3, 2014 at 3:42 PM, Tobias Pape <Das.Linux at gmx.de> wrote:
>>
>> > Would it be blasphemy to have a global or class called It? It should:
>> > $a equal: $b.
>>
>> Strangely, I like it.
>
>
> Why? "It should a equal b" isn't a coherent sentence.
>
> SUnit doesn't try to make everything into an executable specification (which
> is a good thing), but at least "self assert: a equals: b" reads like fluent
> Smalltalk.

The problem is that #assert:equals: looks symmetrical, but it's not. I
don't like the "self" part of "self assert: a equals: b" just because
it doesn't add any information: it's only there because Smalltalk
doesn't support implicit self-sends (like Ruby or Newspeak).

Anyway, the reason I mention RSpec at all is that I like their move
away from monkey patching Object so that everything understands
:should. Instead, they now wrap an object up in an object that adds
expectation stuff. That's not a problem with SUnit, mostly. But I
guess #assert: kind've means two things: both an assertion of some
condition that must hold, and also as a testing tool.

I do nearly like Phexample's syntax
(http://smalltalkthoughts.blogspot.co.uk/2009/11/phexample-because-examples-expand-on.html),
and I think Niko Schwarz's "build examples on top of each other" idea
is great. We run Phexample under CI, but I'm not proposing that we
replace SUnit.

frank

> Colin


More information about the Squeak-dev mailing list