The Trunk: Tests-dtl.395.mcz

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

The Trunk: Tests-dtl.395.mcz

David T. Lewis uploaded a new version of Tests to project The Trunk:

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

Name: Tests-dtl.395
Author: dtl
Time: 13 May 2018, 7:12:22.626004 pm
UUID: da0200e6-5c03-4bf3-9f9f-60f6f92beeee
Ancestors: Tests-mt.394

Sending perform: #== with: anObject to an instance of MCPackageInEnvironment should test identity of the actual instance, not the MCPackage to which it refers. If this is not so, a PluggableDictionary will fail when doing identity checks on its keys, as is the case for a SystemTracer adding all objects to its oop dictionary.

Add MCPackageInEnvironmentTest to document the issue.

=============== Diff against Tests-mt.394 ===============

Item was added:
+ MCTestCase subclass: #MCPackageInEnvironmentTest
+ instanceVariableNames: ''
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'Tests-Monticello'!

Item was added:
+ ----- Method: MCPackageInEnvironmentTest>>testPerformIdentityEquals (in category 'testing') -----
+ testPerformIdentityEquals
+ "Verify that #perform:with: can be used to send #== for identity test. Required
+ for identity test in PluggableDictionary. Delegation to the MCPackage does not
+ work in that case because the package is a different object."
+ | aProtoObj |
+ aProtoObj :=MCPackageInEnvironment
+ decorating: (MCPackage new name: 'No Name Yet')
+ in: Environment default.
+ self assert: [aProtoObj == aProtoObj]
+ description: 'Direct test for identity does not invoke delegation'.
+ "Normal perform:with: delegation with any selector other than #=="
+ aProtoObj perform: #name: with: #FOO.
+ self assert: #FOO equals: aProtoObj name
+ description: 'name of the MCPackage should have been set to #FOO'.
+ "Selector #== must refer to aProtoObj, not to the MCPackage to which it delegates"
+ self assert: [aProtoObj perform: #== with: aProtoObj]
+ description: 'If aProtoObj delegates to the MCPackage the identity test will fail'.
+ !