[squeak-dev] The Trunk: CollectionsTests-cmm.206.mcz
Levente Uzonyi
leves at elte.hu
Wed Sep 4 15:02:32 UTC 2013
On Sat, 31 Aug 2013, commits at source.squeak.org wrote:
> Chris Muller uploaded a new version of CollectionsTests to project The Trunk:
> http://source.squeak.org/trunk/CollectionsTests-cmm.206.mcz
>
> ==================== Summary ====================
>
> Name: CollectionsTests-cmm.206
> Author: cmm
> Time: 31 August 2013, 4:34:41.685 pm
> UUID: 18d460d5-be23-418b-a3f0-b340b0c3e948
> Ancestors: CollectionsTests-nice.205
>
> testAsMutator test with a selector that already ends with a colon.
The previous "contract" was that the user was responsible for sending the
#asMutator message to the right receiver. Let's say that "contract" is
wrong. How would you fix #asMutator?
Would you raise an error if the receiver is not an accessor? E.g.:
self numArgs
caseOf: {
[ 0 ] -> [ ^(self copyWith: $:) asSymbol ] }
[ 1 ] -> [ self isKeyword ifTrue: [ ^self ] ].
otherwise: [ ].
self error: 'Receiver is not an accessor.'
Or just try to add a colon to the end if it's not there? E.g.:
(self size > 0 and: [ (self at: self size) == $: ]) ifTrue: [ ^self ].
^(self copyWith: $:) asSymbol
Levente
>
> =============== Diff against CollectionsTests-nice.205 ===============
>
> Item was changed:
> ----- Method: SymbolTest>>testAsMutator (in category 'tests') -----
> testAsMutator
> + self
> + assert: #x asMutator = #x: ;
> + assert: #x: asMutator = #x: ;
> + assert: #x asMutator isSymbol!
> -
> - self assert: #x asMutator = #x:.
> - self assert: #x asMutator isSymbol!
>
>
>
More information about the Squeak-dev
mailing list
|