The Trunk: CollectionsTests-mt.327.mcz

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

The Trunk: CollectionsTests-mt.327.mcz

commits-2
Marcel Taeumel uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-mt.327.mcz

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

Name: CollectionsTests-mt.327
Author: mt
Time: 19 November 2019, 11:09:01.125265 am
UUID: e3c47aea-e83f-e946-a003-82efd171f133
Ancestors: CollectionsTests-mt.326

Adds tests for #detect:.

=============== Diff against CollectionsTests-mt.326 ===============

Item was added:
+ ----- Method: CollectionTest>>testDetect (in category 'tests') -----
+ testDetect
+
+ self assert: #x equals: (nonEmpty detect: [:ea | ea isSymbol]).
+ self should: [nonEmpty detect: [:ea | ea isNumber]] raise: Error.!

Item was added:
+ ----- Method: CollectionTest>>testDetectIfFound (in category 'tests') -----
+ testDetectIfFound
+
+ self assert: 42 equals: (nonEmpty detect: [:ea | ea isSymbol] ifFound: [:symbol | 42]).
+ self assert: nil equals:  (nonEmpty detect: [:ea | ea isNumber] ifFound: [:number | #x]).!

Item was added:
+ ----- Method: CollectionTest>>testDetectIfFoundIfNone (in category 'tests') -----
+ testDetectIfFoundIfNone
+
+ self assert: 42 equals: (nonEmpty
+ detect: [:ea | ea isSymbol]
+ ifFound: [:symbol | 42]
+ ifNone: [#x]).
+ self assert: #x equals:  (nonEmpty
+ detect: [:ea | ea isNumber]
+ ifFound: [:symbol | 42]
+ ifNone: [#x]).!

Item was added:
+ ----- Method: CollectionTest>>testDetectIfNone (in category 'tests') -----
+ testDetectIfNone
+
+ self assert: #x equals: (nonEmpty detect: [:ea | ea isSymbol] ifNone: [42]).
+ self assert: 42 equals:  (nonEmpty detect: [:ea | ea isNumber] ifNone: [42]).!