[squeak-dev] The Inbox: SUnit-ct.130.mcz

Marcel Taeumel marcel.taeumel at hpi.de
Tue Jan 11 11:51:41 UTC 2022


Hi Christoph --

That's correct. All current overrides of Object >> #error are ugly. I checked smalltalkCI. You proposed change should not break it. Maybe stay alert for a while and consult Fabio again after merging this.

+1 Go ahead.

Best,
Marcel
Am 10.01.2022 18:17:58 schrieb christoph.thiede at student.hpi.uni-potsdam.de <christoph.thiede at student.hpi.uni-potsdam.de>:
Hi all,

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:

https://sourcegraph.com/search?q=context:global+%5CbTestResult%5Cs%2Berror%5Cb+lang:Smalltalk+-lang:c%23&patternType=regexp&case=yes

What do you think, shall we merge or drop this?

PS: Promise >> #error seems no better to me ...

Best,
Christoph

---
Sent from Squeak Inbox Talk [https://github.com/hpi-swa-lab/squeak-inbox-talk]

On 2020-09-24T09:28:33+00:00, commits at source.squeak.org wrote:

> Christoph Thiede uploaded a new version of SUnit to project The Inbox:
> http://source.squeak.org/inbox/SUnit-ct.130.mcz
>
> ==================== Summary ====================
>
> Name: SUnit-ct.130
> Author: ct
> Time: 24 September 2020, 11:28:31.626426 am
> UUID: 43df5072-3a69-634c-946a-ec59903c2519
> Ancestors: SUnit-pre.122
>
> 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.
>
> =============== Diff against SUnit-pre.122 ===============
>
> Item was changed:
> ----- Method: SUnitTest>>testDialectLocalizedException (in category 'tests') -----
> testDialectLocalizedException
>
>     self
>         should: [TestResult signalFailureWith: 'Foo']
>         raise: TestResult failure.
>     self
>         should: [TestResult signalErrorWith: 'Foo']
> +         raise: TestResult exError.!
> -         raise: TestResult error.
> -
> -             !
>
> Item was changed:
> ----- Method: SUnitTest>>testException (in category 'tests') -----
> testException
>
>     self
>         should: [self error: 'foo']
> +         raise: TestResult exError!
> -         raise: TestResult error
> -             !
>
> Item was changed:
> ----- Method: SUnitTest>>testWithExceptionDo (in category 'tests') -----
> testWithExceptionDo
>
>     self
>         should: [self error: 'foo']
> +         raise: TestResult exError
> -         raise: TestResult error
>         withExceptionDo: [:exception |
>             self assert: (exception description includesSubstring: 'foo')
> +         ]!
> -         ]
> -             !
>
> Item was changed:
> ----- Method: TestResult class>>error (in category 'exceptions') -----
> error
> +
> +     self deprecated: 'ct: Send #exError to retrieve an exception class or #error: to signal an error, depending on what you need.'.
> +     ^ self exError!
> -     ^self exError
> -             !
>
> Item was changed:
> ----- Method: TestResult class>>signalErrorWith: (in category 'exceptions') -----
> signalErrorWith: aString
> +     ^ self exError signal: aString!
> -     self error signal: aString
> -             !
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220111/33bf2579/attachment.html>


More information about the Squeak-dev mailing list