[squeak-dev] The Trunk: Tests-dtl.395.mcz

commits at source.squeak.org commits at source.squeak.org
Sun May 13 23:12:39 UTC 2018


David T. Lewis uploaded a new version of Tests to project The Trunk:
http://source.squeak.org/trunk/Tests-dtl.395.mcz

==================== 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'.
+ !



More information about the Squeak-dev mailing list