[Cuis-dev] Test error message wrongly formatted

Hernán Wilkinson hernan.wilkinson at 10pines.com
Sat Jul 29 06:25:29 PDT 2023


Hi Hilaire,
 That it is what I said in my first response of the original thread. People
do not know that the first parameter is the expected and I agree that it is
not intuitive, but it is keep like that for historical reasons and because
a lot of people use it correctly.
 The solution is simple: redefine assert:equals: in the test class to do:
assert: actual equals: expected
 ^super assert: expected equals: actual

Cheers!
Hernan
On Sat, 29 Jul 2023 at 08:31 Hilaire Fernandes <hfern at free.fr> wrote:

> Hi Hernán,
>
> I understand but the problem is that the users I have observed have the
> reverse understanding. For example from the packages below:
>
> *NeoCSV.* ported from Pharo. The more than 50 tests are written with a
> different understanding. See the expected value is the second parameter:
>
> testEmptyFieldQuoted
>     self
>         assert: (NeoCSVReader on: '"1",,"3"' readStream) upToEnd
>         equals: #(('1' nil '3'))
>
>
> *Locale.* package ported from Squeak:
>
> testFromISOString
>
>     | locale |
>     locale := LocaleID isoString: 'en-us'.
>     self
>         assert: locale isoLanguage equals: 'en';
>         assert: locale isoCountry equals: 'us'
>
>
> I personally never used assert:equal: before so I don't know about other
> package using it.
>
> Hilaire
>
>
> Le 29/07/2023 à 02:05, Hernán Wilkinson a écrit :
>
> Hi Hilaire,
>  What is happening is correct.
>  I mean, the first parameter has to be the expected object. That it is why
> it says “Expected …” no matter what the parameter is.
>
> --

*Hernán WilkinsonAgile Software Development, Teaching & Coaching*
*Phone: +54-011*-4893-2057
*Twitter: @HernanWilkinson*
*site: http://www.10Pines.com <http://www.10pines.com/>*
Address: Alem 896, Floor 6, Buenos Aires, Argentina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20230729/e18c6fe2/attachment-0001.htm>


More information about the Cuis-dev mailing list