[squeak-dev] The Trunk: Tests-mt.430.mcz

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Sat Apr 18 13:55:14 UTC 2020


> Any idea on how to fix that? #caseError must not be sent to "self" if inlined:


See Compiler-nice.427 (inbox) and caseerror.1.cs (http://forum.world.st/Problems-with-caseError-tp5111930p5112255.html). What a mess. *sigh* :-)


Best,

Christoph

________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Taeumel, Marcel
Gesendet: Freitag, 17. April 2020 10:10:30
An: gettimothy via Squeak-dev
Betreff: Re: [squeak-dev] The Trunk: Tests-mt.430.mcz

Hi all!

Any idea on how to fix that? #caseError must not be sent to "self" if inlined:

[cid:8cfca4c8-4bf7-44c9-ab78-715b19fe2135]

Best,
Marcel

Am 17.04.2020 10:00:17 schrieb commits at source.squeak.org <commits at source.squeak.org>:

Marcel Taeumel uploaded a new version of Tests to project The Trunk:
http://source.squeak.org/trunk/Tests-mt.430.mcz

==================== Summary ====================

Name: Tests-mt.430
Author: mt
Time: 17 April 2020, 10:00:04.765586 am
UUID: f6a52e06-a24a-ca4b-bbea-8cf479934e4a
Ancestors: Tests-ul.429

First steps to improve CaseErrorTest:
- the faulty #printOn: must be in a separate object so that the instance of TestCase can be printed as usual in logs and views
- adds #testCaseErrorMessage, which actually documents another bug, which is that #printString in #caseError is called on the wrong object

I suppose that the idea of having "self printString" in #caseError is that the user learns about the actual cases of the receiver *and not* about the outer-context object that is triggering that case-of in the first place.

=============== Diff against Tests-ul.429 ===============

Item was removed:
- ----- Method: CaseErrorTest>>printOn: (in category 'tests') -----
- printOn: aStream
- 3 caseOf:
- { [1] -> [aStream nextPutAll: 'option 1'].
- [2] -> [aStream nextPutAll: 'option 2'] }
- "caseError in printOn:"!

Item was changed:
----- Method: CaseErrorTest>>testCaseErrorInPrintOn (in category 'tests') -----
testCaseErrorInPrintOn
+ self should: [ CaseErrorTestObject new printString ] raise: Error!
- self should: [ self printString ] raise: Error!

Item was added:
+ ----- Method: CaseErrorTest>>testCaseErrorMessage (in category 'tests') -----
+ testCaseErrorMessage
+ "Check whether the error message actually includes the printString of the object where #caseOf: is sent to. As of April 17, 2020, the error message actually uses the printString of the outer-contxt receiver, which is wrong. Take a look at Object >> #caseOf:. There is no indication of 'self' not being the receiver of #caseOf:."
+
+ ['my message' caseOf: { [1] -> ['option 1'] }]
+ on: Error
+ do: [:error | self assert: (error messageText includesSubstring: 'my message' printString)].!

Item was added:
+ Object subclass: #CaseErrorTestObject
+ instanceVariableNames: ''
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'Tests-Bugs'!

Item was added:
+ ----- Method: CaseErrorTestObject>>printOn: (in category 'printing') -----
+ printOn: aStream
+ 3 caseOf:
+ { [1] -> [aStream nextPutAll: 'option 1'].
+ [2] -> [aStream nextPutAll: 'option 2'] }
+ "caseError in printOn:"!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200418/a4e7afa7/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 44739 bytes
Desc: image.png
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200418/a4e7afa7/attachment-0001.png>


More information about the Squeak-dev mailing list