[Pharo-project] I am the only one who finds #assert:equals: oppostite to expected?

Damien Cassou damien.cassou at gmail.com
Sat Apr 30 19:13:05 CEST 2011

On Sat, Apr 30, 2011 at 4:20 PM, Mariano Martinez Peck
<marianopeck at gmail.com> wrote:
> testBlah
>     | universalAnswer |
>     universalAnswer := 30.
>     universalAnswer := universalAnswer + 11.
>     self assert: universalAnswer equals: 42.
> In this case, 42 is the "expected" and "universalAnswer" is the "actual"
> value.
> I feel weird writing like this:
>     self assert: 42 equals: universalAnswer.

I think I'm responsible for this non sense, sorry about that. When I
put the parameters in this order, I thought the result would be
similar to JUnit in which 'expected' is always before 'actual'.
Unfortunately, it looks like I just forgot to read the whole sentence:
'self assert that something equals 42' reads much better than the
other way around. I don't think too much code depends on this
#assert:equals: method as it has only been introduced recently.

I vote for changing the order.

Damien Cassou

"Lambdas are relegated to relative obscurity until Java makes them
popular by not having them." James Iry

More information about the Pharo-project mailing list