[squeak-dev] The Trunk: KernelTests-nice.108.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Nov 14 21:18:32 UTC 2009


Nicolas Cellier uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-nice.108.mcz

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

Name: KernelTests-nice.108
Author: nice
Time: 14 November 2009, 10:18:20 am
UUID: eb00b015-1a50-486c-a016-8d916812b282
Ancestors: KernelTests-nice.107

move DependentsArrayTest from Kernel to KernelTests

=============== Diff against KernelTests-nice.107 ===============

Item was added:
+ ClassTestCase subclass: #DependentsArrayTest
+ 	instanceVariableNames: ''
+ 	classVariableNames: ''
+ 	poolDictionaries: ''
+ 	category: 'KernelTests-Objects'!
+ 
+ !DependentsArrayTest commentStamp: '<historical>' prior: 0!
+ This class is to test the special implementation of DependentsArray.
+ 
+ DependentsArray size will not count nil elements (the ones reclaimed by garbage collector).
+ Consequently, any message implemented with a construction like (1 to: self size do: [:i | ]) and sent to the dependents of any object might not behave as supposed to.!

Item was added:
+ ----- Method: DependentsArrayTest>>testCanDiscardEdits (in category 'testing') -----
+ testCanDiscardEdits
+ 	"self debug: #testCanDiscardEdits."
+ 
+ 	| anObject aView  |
+ 	anObject := Object new.
+ 	aView := StringHolderView new
+ 		model: Transcript;
+ 		window: (0 at 0 extent: 60 at 60);
+ 		borderWidth: 1.
+ 	aView hasUnacceptedEdits: true.
+ 	anObject addDependent: Object new. "this entry should be garbage collected"
+ 	anObject addDependent: aView.
+ 
+ 	Smalltalk garbageCollect. "force garbage collection"
+ 
+ 	self
+ 		should: [anObject dependents size = 1]
+ 		description: 'first dependent of anObject should have been collected, second should not'.
+ 
+ 	self
+ 		shouldnt: [anObject canDiscardEdits]
+ 		description: 'anObject cannot discard edits because aView is a dependent of anObject and aView has unaccepted edits'.!

Item was added:
+ ----- Method: DependentsArrayTest>>testAddingTwice (in category 'testing') -----
+ testAddingTwice
+ 	
+ 	| test dep2 deps |
+ 	test := Object new.
+ 	dep2 := String with: $z with: $u with: $t.
+ 	
+ 	test addDependent: String new.
+ 	test addDependent: dep2.
+ 	
+ 	Smalltalk garbageCollect. "this will make first dependent vanish, replaced by nil"
+ 	
+ 	test addDependent: dep2.
+ 	
+ 	deps := test dependents.
+ 	self should: [deps asIdentitySet size = deps size] description: 'No object should be added twice in dependents'!




More information about the Squeak-dev mailing list