Andreas Raab uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-ar.135.mcz ==================== Summary ==================== Name: CollectionsTests-ar.135 Author: ar Time: 1 February 2010, 8:24:38.93 pm UUID: e7dd8e8c-60b1-fa4a-be32-1f9004b37691 Ancestors: CollectionsTests-ar.134 Tests for sets with nil: Documents current behavior including the cases that aren't supported (KeyedSet and WeakSet since they have some additional requirements). =============== Diff against CollectionsTests-ar.134 =============== Item was added: + ----- Method: SetWithNilTest>>testIdentitySetWithNil (in category 'tests') ----- + testIdentitySetWithNil + self shouldnt:[IdentitySet with: nil] raise: Error. + self shouldnt:[IdentitySet withAll: #(nil nil nil)] raise: Error. + + self assert: (IdentitySet with: nil) size = 1. + self assert: (IdentitySet withAll: #(nil nil nil)) size = 1. + + self assert: (IdentitySet with: nil) anyOne = nil. + self assert: ((IdentitySet with: nil) remove: nil) == nil. + self assert: ((IdentitySet with: nil) remove: nil; yourself) isEmpty. + + self assert: (IdentitySet withAll: #(1 nil foo)) size = 3. + self assert: ((IdentitySet withAll: #(1 nil foo)) remove: nil; yourself) size = 2. + + self assert: ((IdentitySet with: nil) collect:[:x| x]) = (IdentitySet with: nil). + self assert: ((IdentitySet with: nil) collect:[:x| x] as: Array) = #(nil). + ! Item was added: + ----- Method: SetWithNilTest>>testKeyedSetWithNil (in category 'tests') ----- + testKeyedSetWithNil + self should:[KeyedSet with: nil] raise: Error. + ! Item was added: + ----- Method: SetWithNilTest>>testWeakSetWithNil (in category 'tests') ----- + testWeakSetWithNil + self should:[WeakSet with: nil] raise: Error. + ! Item was added: + TestCase subclass: #SetWithNilTest + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'CollectionsTests-Unordered'! Item was added: + ----- Method: SetWithNilTest>>testSetWithNil (in category 'tests') ----- + testSetWithNil + self shouldnt:[Set with: nil] raise: Error. + self shouldnt:[Set withAll: #(nil nil nil)] raise: Error. + + self assert: (Set with: nil) size = 1. + self assert: (Set withAll: #(nil nil nil)) size = 1. + + self assert: (Set with: nil) anyOne = nil. + self assert: ((Set with: nil) remove: nil) == nil. + self assert: ((Set with: nil) remove: nil; yourself) isEmpty. + + self assert: (Set withAll: #(1 nil foo)) size = 3. + self assert: ((Set withAll: #(1 nil foo)) remove: nil; yourself) size = 2. + + self assert: ((Set with: nil) collect:[:x| x]) = (Set with: nil). + self assert: ((Set with: nil) collect:[:x| x] as: Array) = #(nil). + ! Item was added: + ----- Method: SetWithNilTest>>testPluggableSetWithNil (in category 'tests') ----- + testPluggableSetWithNil + self shouldnt:[PluggableSet with: nil] raise: Error. + self shouldnt:[PluggableSet withAll: #(nil nil nil)] raise: Error. + + self assert: (PluggableSet with: nil) size = 1. + self assert: (PluggableSet withAll: #(nil nil nil)) size = 1. + + self assert: (PluggableSet with: nil) anyOne = nil. + self assert: ((PluggableSet with: nil) remove: nil) == nil. + self assert: ((PluggableSet with: nil) remove: nil; yourself) isEmpty. + + self assert: (PluggableSet withAll: #(1 nil foo)) size = 3. + self assert: ((PluggableSet withAll: #(1 nil foo)) remove: nil; yourself) size = 2. + + self assert: ((PluggableSet with: nil) collect:[:x| x]) = (PluggableSet with: nil). + self assert: ((PluggableSet with: nil) collect:[:x| x] as: Array) = #(nil). + ! |
Free forum by Nabble | Edit this page |