Hi all,<br>
<br>
I am still convinced that overriding #error as an accessor is not a good practice, but I am unsure whether this patch would be too much a breaking change, considering the amount of senders to this method in projects using Squeak or other Smalltalk distributions. Solely on GitHub:<br>
<br>
https://sourcegraph.com/search?q=context:global+%5CbTestResult%5Cs%2Berror%5Cb+lang:Smalltalk+-lang:c%23&patternType=regexp&case=yes<br>
<br>
What do you think, shall we merge or drop this?<br>
<br>
PS: Promise >> #error seems no better to me ...<br>
<br>
Best,<br>
Christoph<br>
<br>
<font color="#808080">---<br>
</font><font color="#808080"><i>Sent from </i></font><font color="#808080"><i><a href="https://github.com/hpi-swa-lab/squeak-inbox-talk"><u><font color="#808080">Squeak Inbox Talk</font></u></a></i></font><br>
<br>
On 2020-09-24T09:28:33+00:00, commits@source.squeak.org wrote:<br>
<br>
> Christoph Thiede uploaded a new version of SUnit to project The Inbox:<br>
> http://source.squeak.org/inbox/SUnit-ct.130.mcz<br>
> <br>
> ==================== Summary ====================<br>
> <br>
> Name: SUnit-ct.130<br>
> Author: ct<br>
> Time: 24 September 2020, 11:28:31.626426 am<br>
> UUID: 43df5072-3a69-634c-946a-ec59903c2519<br>
> Ancestors: SUnit-pre.122<br>
> <br>
> Deprecates TestResult class >> #error and replaces sends to it with #exError. It is a bad and erroneous practice to override #error in a way that does not signal an error but returns a class object.<br>
> <br>
> =============== Diff against SUnit-pre.122 ===============<br>
> <br>
> Item was changed:<br>
>   ----- Method: SUnitTest>>testDialectLocalizedException (in category 'tests') -----<br>
>   testDialectLocalizedException<br>
>   <br>
>       self<br>
>           should: [TestResult signalFailureWith: 'Foo']<br>
>           raise: TestResult failure.<br>
>       self<br>
>           should: [TestResult signalErrorWith: 'Foo']<br>
> +         raise: TestResult exError.!<br>
> -         raise: TestResult error.<br>
> - <br>
> -             !<br>
> <br>
> Item was changed:<br>
>   ----- Method: SUnitTest>>testException (in category 'tests') -----<br>
>   testException<br>
>   <br>
>       self<br>
>           should: [self error: 'foo']<br>
> +         raise: TestResult exError!<br>
> -         raise: TestResult error<br>
> -             !<br>
> <br>
> Item was changed:<br>
>   ----- Method: SUnitTest>>testWithExceptionDo (in category 'tests') -----<br>
>   testWithExceptionDo<br>
>   <br>
>       self<br>
>           should: [self error: 'foo']<br>
> +         raise: TestResult exError<br>
> -         raise: TestResult error<br>
>           withExceptionDo: [:exception |<br>
>               self assert: (exception description includesSubstring: 'foo')<br>
> +         ]!<br>
> -         ]<br>
> -             !<br>
> <br>
> Item was changed:<br>
>   ----- Method: TestResult class>>error (in category 'exceptions') -----<br>
>   error<br>
> + <br>
> +     self deprecated: 'ct: Send #exError to retrieve an exception class or #error: to signal an error, depending on what you need.'.<br>
> +     ^ self exError!<br>
> -     ^self exError<br>
> -             !<br>
> <br>
> Item was changed:<br>
>   ----- Method: TestResult class>>signalErrorWith: (in category 'exceptions') -----<br>
>   signalErrorWith: aString <br>
> +     ^ self exError signal: aString!<br>
> -     self error signal: aString<br>
> -             !<br>
> <br>