The Inbox: CollectionsTests-fbs.190.mcz

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

The Inbox: CollectionsTests-fbs.190.mcz

commits-2
Frank Shearar uploaded a new version of CollectionsTests to project The Inbox:
http://source.squeak.org/inbox/CollectionsTests-fbs.190.mcz

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

Name: CollectionsTests-fbs.190
Author: fbs
Time: 20 August 2012, 4:51:57.144 pm
UUID: 434a1777-9786-4203-b2a1-3ca8e9854eb1
Ancestors: CollectionsTests-ul.189

SequenceableCollection >> flatten turns a nested SequenceableCollection - a collection of collections of ... -  into a simple collection. Thus, #(1 (2 3) (4)) flatten = #(1 2 3 4).

=============== Diff against CollectionsTests-ul.189 ===============

Item was added:
+ ----- Method: SequenceableCollectionTest>>testFlattenFlattensRecursively (in category 'tests - copying') -----
+ testFlattenFlattensRecursively
+ self assert: #(1 2 3 4) equals: #(1 #(2 #(3) 4)) flatten.!

Item was added:
+ ----- Method: SequenceableCollectionTest>>testFlattenOfEmptyCollectionIsSelf (in category 'tests - copying') -----
+ testFlattenOfEmptyCollectionIsSelf
+ self assert: {} equals: {} flatten.!

Item was added:
+ ----- Method: SequenceableCollectionTest>>testFlattenOfFlatCollectionIsSelf (in category 'tests - copying') -----
+ testFlattenOfFlatCollectionIsSelf
+ self assert: #(1 2 3) equals: #(1 2 3) flatten.!

Item was added:
+ ----- Method: SequenceableCollectionTest>>testFlattenReturnsCopy (in category 'tests - copying') -----
+ testFlattenReturnsCopy
+ | a b |
+ a := Array with: 1 with: 2.
+ b := a flatten.
+ b at: 1 put: 3.
+
+ self assert: #(1 2) equals: a.!