The Trunk: CollectionsTests-ul.139.mcz

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

The Trunk: CollectionsTests-ul.139.mcz

commits-2
Levente Uzonyi uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-ul.139.mcz

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

Name: CollectionsTests-ul.139
Author: ul
Time: 4 February 2010, 2:12:42.253 am
UUID: daca3284-58c0-6049-9575-44cc4e09e097
Ancestors: CollectionsTests-ar.138

- some tests for WeakRegistry

=============== Diff against CollectionsTests-ar.138 ===============

Item was added:
+ ----- Method: WeakRegistryTest>>testGrowingByAHighPriorityProcessDoesntLeak (in category 'as yet unclassified') -----
+ testGrowingByAHighPriorityProcessDoesntLeak
+
+ | w finalized block object executor semaphore |
+ w := WeakRegistry new: 1.
+ finalized := false.
+ block := [ :v | finalized := v ].
+ object := Object new.
+ executor := ObjectFinalizer new
+ receiver: block
+ selector: #value:
+ argument: true;
+ yourself.
+ w add: object executor: executor.
+ semaphore := Semaphore new.
+ [
+ object := nil. "let it go"
+ w addAll: (1 to: 1000). "force growing"
+ semaphore signal ]
+ forkAt: WeakArray runningFinalizationProcess priority + 1.
+ semaphore wait.
+ Smalltalk garbageCollect. "finalize it"
+ self assert: w size = 1000.
+ self assert: finalized!

Item was added:
+ ----- Method: WeakRegistryTest>>testFinalization (in category 'as yet unclassified') -----
+ testFinalization
+
+ | w finalized block object |
+ w := WeakRegistry new: 1.
+ finalized := false.
+ block := [ :v | finalized := v ].
+ object := ObjectFinalizer new "an object that responds to #finalize"
+ receiver: block
+ selector: #value:
+ argument: true;
+ yourself.
+ w add: object.
+ object := nil. "let it go"
+ Smalltalk garbageCollect. "finalize it"
+ self assert: w isEmpty.
+ self assert: finalized!

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

Item was added:
+ ----- Method: WeakRegistryTest>>testGrowingDoesntLeak (in category 'as yet unclassified') -----
+ testGrowingDoesntLeak
+
+ | w finalized block object executor |
+ w := WeakRegistry new: 1.
+ finalized := false.
+ block := [ :v | finalized := v ].
+ object := Object new.
+ executor := ObjectFinalizer new
+ receiver: block
+ selector: #value:
+ argument: true;
+ yourself.
+ w add: object executor: executor.
+ object := nil. "let it go"
+ w addAll: (1 to: 1000). "force growing"
+ Smalltalk garbageCollect. "finalize it"
+ self assert: w size = 1000.
+ self assert: finalized!