[Cuis-dev] Test error message wrongly formatted

Juan Vuletich juan at cuis.st
Mon Jul 31 11:13:11 PDT 2023


Done.

Fixed #assert:equals:, removed #assert:equalsExpected: and reviewed a 
ton of tests, fixing those that needed it. About half of the tests 
assumed Squeak's behavior.

Again, Thanks.

Cheers,

On 7/30/2023 6:59 PM, Martin McClure via Cuis-dev wrote:
> Hi Hernán,
>
> I'm afraid you can't blame Kent Beck for this ambiguity.
>
> #assert:equals: was not in Kent's original SUnit design -- at least 
> it's not in his paper from 1999, and it's not in Camp Smalltalk SUnit 
> 3.1 from 2003.
>
> At GemStone, we have an internal test framework that existed before 
> SUnit did, and its primary way of doing assertions is
>
>     self run: aBlock forResult: anObject.
>
> Fifteen years ago or so, Niall Ross was the primary SUnit maintainer, 
> and I suggested to him that SUnit could benefit from something like 
> #run:forResult:. He didn't think that particular selector fit SUnit's 
> way of doing things, but for SUnit 4.0 (2009 or so) he added 
> #assert:equals:.
>
> Niall's code did not specify which argument is the expected and which 
> the actual. The failure description just says "a is not equal to b." 
> So it was left ambiguous.
>
> However, I was never in doubt that the "proper" usage was "assert: 
> actual equals: expected." And there's quite a lot of Smalltalk code 
> that uses it that way. A random sampling of GemStone's many tests 
> shows exactly none that put the expected value first. And Pharo 
> explicitly shows which is which, their message pattern in TestAsserter is
>
>    assert: actual equals: expected
>
> and their tests follow that usage.
>
> So, since "we all expect the actual to be first" and there's a quite 
> lot of code in Smalltalk-land that agrees with that, I'd suggest that 
> Cuis follow suit.
>
> Regards,
> -Martin
>
>
> On 7/23/23 19:29, Hernán Wilkinson via Cuis-dev wrote:
>> Hi Hilaire
>>  I think all of us that used #assert:equals: had the same feeling as 
>> you someday.
>>  We all expect the actual to be first, but for some reason I do not 
>> know Kent Beck put the expected first when he wrote SUnit and all the 
>> descendant testing framework followed that convention (JUnit, NUnit, 
>> phpunit, etc etc).
>>  We should not change it for historical and compatibility reasons.
>>  Adding the message you suggest will not harm, but it is redundant...
>>  My advice, give it a couple of days, you will get used to it to put 
>> the expected first, it is a matter of time.
>>
>


-- 
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich



More information about the Cuis-dev mailing list