[squeak-dev] The Trunk: CollectionsTests-ul.145.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Feb 19 15:25:56 UTC 2010


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

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

Name: CollectionsTests-ul.145
Author: ul
Time: 19 February 2010, 4:03:17.711 pm
UUID: fb47dfc3-b48c-fe45-a11c-6761281063bf
Ancestors: CollectionsTests-ar.144

- a few tests for KeyedSet

=============== Diff against CollectionsTests-ar.144 ===============

Item was added:
+ ----- Method: KeyedSetTest>>testLike (in category 'tests') -----
+ testLike
+ 	
+ 	| k |
+ 	k := KeyedSet keyBlock: [ :each | each * 2 ].
+ 	self assert: (k like: 1) isNil.
+ 	k add: 1.
+ 	self assert: (k like: 1) = 1.
+ 	k add: 2.
+ 	self assert: (k like: 2) = 2.
+ 	self assert: (k like: 3) isNil.!

Item was changed:
  ----- Method: SetWithNilTest>>testKeyedSetWithNil (in category 'tests') -----
  testKeyedSetWithNil
  	| set |
  	self runSetWithNilTestOf: [KeyedSet keyBlock:[:o| o]].
  	set := KeyedSet keyBlock:[:o| o].
  	set add: nil.
  	self assert: (set at: nil) == nil.
+ 	self assert: (set includes: nil)
  !

Item was added:
+ ----- Method: KeyedSetTest>>testLikeIfAbsent (in category 'tests') -----
+ testLikeIfAbsent
+ 	
+ 	| k missing |
+ 	k := KeyedSet keyBlock: [ :each | each * 2 ].
+ 	missing := false.
+ 	self assert: (k like: 1 ifAbsent: [ missing := true. nil ]) isNil.
+ 	self assert: missing.
+ 	k add: 1.
+ 	missing := false.
+ 	self assert: (k like: 1 ifAbsent: [ missing := true. nil ]) = 1.
+ 	self deny: missing.
+ 	k add: 2.
+ 	self assert: (k like: 2 ifAbsent: nil) = 2.
+ 	self assert: (k like: 3 ifAbsent: nil) isNil!




More information about the Squeak-dev mailing list