Andreas Raab uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-ul.115.mcz==================== Summary ====================
Name: CollectionsTests-ul.115
Author: ul
Time: 20 November 2009, 11:00:51 am
UUID: 92f79dd7-6f72-d645-aa5f-29c581c1e1f8
Ancestors: CollectionsTests-nice.114
- added a new class: WeakSetTest with a test: #testIncludes which (besides the common inclusion testing) demonstrates a bug in WeakSet >> #includes:
=============== Diff against CollectionsTests-nice.114 ===============
Item was added:
+ ClassTestCase subclass: #WeakSetTest
+ instanceVariableNames: ''
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'CollectionsTests-Weak'!
Item was added:
+ ----- Method: WeakSetTest>>testIncludes (in category 'as yet unclassified') -----
+ testIncludes
+
+ | weakSet transientFakeNilObject |
+ weakSet := WeakSet new.
+ #(true nil 1) do: [ :each |
+ self deny: (weakSet includes: each) ].
+ weakSet add: true.
+ self assert: (weakSet includes: true).
+ weakSet remove: true.
+ self deny: (weakSet includes: true).
+ transientFakeNilObject := ((1 to: 1000) detect: [ :each | each asString hash - nil hash \\ weakSet capacity = 0 ]) asString. "this string will occupy the same slot as nil would"
+ weakSet add: transientFakeNilObject.
+ transientFakeNilObject := transientFakeNilObject copy.
+ Smalltalk garbageCollect. "get rid of transientFakeNilObject"
+ self deny: (weakSet includes: transientFakeNilObject).
+ self deny: (weakSet includes: nil)
+
+
+ !