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

Marcel Taeumel marcel.taeumel at hpi.de
Fri Apr 17 08:10:30 UTC 2020


Hi all!

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



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/20200417/656058b4/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 44739 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200417/656058b4/attachment-0001.png>


More information about the Squeak-dev mailing list