The Inbox: CollectionsTests-jr.319.mcz

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

The Inbox: CollectionsTests-jr.319.mcz

commits-2
A new version of CollectionsTests was added to project The Inbox:
http://source.squeak.org/inbox/CollectionsTests-jr.319.mcz

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

Name: CollectionsTests-jr.319
Author: jr
Time: 25 September 2019, 3:24:53.304261 pm
UUID: f44f2265-88ab-3042-b84f-bdb5bbd8b8ef
Ancestors: CollectionsTests-dtl.318

Add test for change in Collections-jr.855

=============== Diff against CollectionsTests-dtl.318 ===============

Item was added:
+ ClassTestCase subclass: #WeakKeyDictionaryTest
+ instanceVariableNames: ''
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'CollectionsTests-Weak'!

Item was added:
+ ----- Method: WeakKeyDictionaryTest>>testNilDoesNotInheritValueOfGarbageCollectedObject (in category 'tests') -----
+ testNilDoesNotInheritValueOfGarbageCollectedObject
+ "When objects are garbage collected, the keys in the names hash table become nil.
+ This must not mislead the dictionary to answer that nil had one of the values of the former
+ objects!!"
+ | dictionary hashTable |
+ dictionary := self targetClass new.
+ "Craft a hash table where all keys were freed."
+ hashTable := dictionary array.
+ self assert: hashTable size > 0.
+ hashTable replace: [:each | WeakKeyAssociation key: nil value: 1].
+ self assert: (dictionary at: nil ifAbsent: []) isNil. "and not 1"!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: CollectionsTests-jr.319.mcz

Jakob Reschke
Copy&paste glitch in the method's comment... uploading a fixed version with the same ancestors in a moment. This one should be discarded.

Am Mi., 25. Sept. 2019 um 15:25 Uhr schrieb <[hidden email]>:
A new version of CollectionsTests was added to project The Inbox:
http://source.squeak.org/inbox/CollectionsTests-jr.319.mcz

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

Name: CollectionsTests-jr.319
Author: jr
Time: 25 September 2019, 3:24:53.304261 pm
UUID: f44f2265-88ab-3042-b84f-bdb5bbd8b8ef
Ancestors: CollectionsTests-dtl.318

Add test for change in Collections-jr.855

=============== Diff against CollectionsTests-dtl.318 ===============

Item was added:
+ ClassTestCase subclass: #WeakKeyDictionaryTest
+       instanceVariableNames: ''
+       classVariableNames: ''
+       poolDictionaries: ''
+       category: 'CollectionsTests-Weak'!

Item was added:
+ ----- Method: WeakKeyDictionaryTest>>testNilDoesNotInheritValueOfGarbageCollectedObject (in category 'tests') -----
+ testNilDoesNotInheritValueOfGarbageCollectedObject
+       "When objects are garbage collected, the keys in the names hash table become nil.
+       This must not mislead the dictionary to answer that nil had one of the values of the former
+       objects!!"
+       | dictionary hashTable |
+       dictionary := self targetClass new.
+       "Craft a hash table where all keys were freed."
+       hashTable := dictionary array.
+       self assert: hashTable size > 0.
+       hashTable replace: [:each | WeakKeyAssociation key: nil value: 1].
+       self assert: (dictionary at: nil ifAbsent: []) isNil. "and not 1"!