Nicolas Cellier uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-nice.97.mcz==================== Summary ====================
Name: CollectionsTests-nice.97
Author: nice
Time: 25 September 2009, 8:31:56 am
UUID: 4faed0c6-ac60-e145-b88d-be50d2569c01
Ancestors: CollectionsTests-ar.96
Test from
http://bugs.squeak.org/view.php?id=7095Assert this feature:
Dictionary>>#collect: should preserve the keys
=============== Diff against CollectionsTests-ar.96 ===============
Item was added:
+ ----- Method: DictionaryTest>>testCollect (in category 'testing') -----
+ testCollect
+ "Ensure that Dictionary>>collect: answers a dictionary not something else"
+ | dict expected result |
+ dict := Dictionary newFromPairs:{
+ #first. 1.
+ #second. 2.
+ #third. 3.
+ #fourth. 4.
+ #fifth. 5.
+ }.
+ result := dict collect:[:each| each asWords].
+ expected := Dictionary newFromPairs:{
+ #first. 'one'.
+ #second. 'two'.
+ #third. 'three'.
+ #fourth. 'four'.
+ #fifth. 'five'.
+ }.
+ self assert: result = expected.!
Item was added:
+ ----- Method: DictionaryTest>>testSelect (in category 'testing') -----
+ testSelect
+ "Ensure that Dictionary>>select: answers a dictionary not something else"
+ | dict expected result |
+ dict := Dictionary newFromPairs:{
+ #first. 1.
+ #second. 2.
+ #third. 3.
+ #fourth. 4.
+ #fifth. 5.
+ }.
+ result := dict select:[:each| each odd].
+ expected := Dictionary newFromPairs:{
+ #first. 1.
+ #third. 3.
+ #fifth. 5.
+ }.
+ self assert: result = expected.!
Item was added:
+ ----- Method: DictionaryTest>>testReject (in category 'testing') -----
+ testReject
+ "Ensure that Dictionary>>reject: answers a dictionary not something else"
+ | dict expected result |
+ dict := Dictionary newFromPairs:{
+ #first. 1.
+ #second. 2.
+ #third. 3.
+ #fourth. 4.
+ #fifth. 5.
+ }.
+ result := dict reject:[:each| each odd].
+ expected := Dictionary newFromPairs:{
+ #second. 2.
+ #fourth. 4.
+ }.
+ self assert: result = expected.!