Mariano, I agree, I have NEVER written self assert: expected = actual description: 'expected should equal this result but is not'. That makes me think of this story: In my company, C++ "experts" decided to nether write bool isActive ... if (isActive) { ... } because they pretend every condition must be a test (== <= etc...) to be sure it's a boolean... So they ended up wrting this kind of stupid thing: if (isActive==true) { ... } But I told them : what if you forget one of the equal signs ? Isn't it worse than above ? A lint rule would be so much better ! They said ah, yes you're right, we now gonna write it: if( true==isActive ) { ... } Sometimes, I see loops written like this while(false==isNotActive) { ... } and scratch my head a few seconds. I think our minds are just different... Nicolas 2011/4/30 Peter Hugosson-Miller <oldmanlink@gmail.com>:
It feels backwards to me too, in the same way that "one plus one equals two" feels more natural than "two equals one plus one".
-- Cheers, Peter. On 30 apr 2011, at 16:20, Mariano Martinez Peck <marianopeck@gmail.com> wrote:
Hi guys. I always code my tests something like this:
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 don't know why...but I do..the same as when doing should: []Â raise: Error. In that case you put the "actual" first and the "expected" at the end...
ok....the "problem" is that assert:equals: is in fact:  asserts: expected equals: actual instead of asserts: actual equals: expected
So, with my test I would receive a description in the debugger that says "'Expected 41 but was 42.'" which is completely the opposite. Of course, if I write my tests in the way I don't like, that is: Â self assert: 42 equals: universalAnswer.
then i got the correct message "'Expected 42 but was 41.'"
I don't pretend pharo change this because I guess it is standard, and blah blah blah. But senders of #assert:equals: should both, some written as mine (so the message is incorrect for them) and some correct.
In addition, I think it is a problem of the selector name. If we could make it clearer, the won't be necessary to confuse "actual" with "expected".
Cheers
-- Mariano http://marianopeck.wordpress.com