[squeak-dev] The Trunk: CollectionsTests-ct.374.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu Apr 7 21:04:47 UTC 2022
Christoph Thiede uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-ct.374.mcz
==================== Summary ====================
Name: CollectionsTests-ct.374
Author: ct
Time: 7 April 2022, 11:04:45.435279 pm
UUID: a950e576-05ed-e94c-8863-670bd6352c35
Ancestors: CollectionsTests-ct.373
Tests SequenceableCollection>>#test[Last]At:[IfPresent:][ifAbsent:]. Complements Collections-ct.872, Collections-ct.873.
=============== Diff against CollectionsTests-ct.373 ===============
Item was added:
+ ----- Method: SequenceableCollectionTest>>testAt (in category 'tests - testing') -----
+ testAt
+
+ | col |
+ col := #(2 3 4).
+ self assert: 3 equals: (col at: 2).
+ self shouldRaiseError: [col at: 4].!
Item was added:
+ ----- Method: SequenceableCollectionTest>>testAtIfAbsent (in category 'tests - testing') -----
+ testAtIfAbsent
+
+ | col |
+ col := #(2 3 4).
+ self assert: 3 equals: (col at: 2 ifAbsent: [self fail]).
+ self assert: #absent equals: (col at: 4 ifAbsent: [#absent]).!
Item was added:
+ ----- Method: SequenceableCollectionTest>>testAtIfPresent (in category 'tests - testing') -----
+ testAtIfPresent
+
+ | col |
+ col := #(2 3 4).
+ self assert: -3 equals: (col at: 2 ifPresent: #negated).
+ self assert: nil equals: (col at: 4 ifPresent: [self fail]).!
Item was added:
+ ----- Method: SequenceableCollectionTest>>testAtIfPresentIfAbsent (in category 'tests - testing') -----
+ testAtIfPresentIfAbsent
+
+ | col |
+ col := #(2 3 4).
+ self assert: -3 equals: (col at: 2 ifPresent: #negated ifAbsent: [self fail]).
+ self assert: #absent equals: (col at: 4 ifPresent: [self fail] ifAbsent: [#absent]).!
Item was added:
+ ----- Method: SequenceableCollectionTest>>testAtLast (in category 'tests - testing') -----
+ testAtLast
+
+ | col |
+ col := #(2 3 4).
+
+ self assert: 4 equals: (col atLast: 1).
+ self assert: 3 equals: (col atLast: 2).
+ self assert: 2 equals: (col atLast: 3).
+
+ self shouldRaiseError: [col atLast: 0].
+ self shouldRaiseError: [col atLast: 4].!
Item was added:
+ ----- Method: SequenceableCollectionTest>>testAtLastIfAbsent (in category 'tests - testing') -----
+ testAtLastIfAbsent
+
+ | col |
+ col := #(2 3 4).
+
+ self assert: 4 equals: (col atLast: 1 ifAbsent: [self fail]).
+ self assert: 3 equals: (col atLast: 2 ifAbsent: [self fail]).
+ self assert: 2 equals: (col atLast: 3 ifAbsent: [self fail]).
+
+ self assert: #absent equals: (col atLast: 0 ifAbsent: [#absent]).
+ self assert: #absent equals: (col atLast: 4 ifAbsent: [#absent]).!
Item was added:
+ ----- Method: SequenceableCollectionTest>>testAtLastIfPresent (in category 'tests - testing') -----
+ testAtLastIfPresent
+
+ | col |
+ col := #(2 3 4).
+
+ self assert: -4 equals: (col atLast: 1 ifPresent: #negated).
+ self assert: -3 equals: (col atLast: 2 ifPresent: #negated).
+ self assert: -2 equals: (col atLast: 3 ifPresent: #negated).
+
+ self assert: nil equals: (col atLast: 0 ifPresent: [self fail]).
+ self assert: nil equals: (col atLast: 4 ifPresent: [self fail]).!
Item was added:
+ ----- Method: SequenceableCollectionTest>>testAtLastIfPresentIfAbsent (in category 'tests - testing') -----
+ testAtLastIfPresentIfAbsent
+
+ | col |
+ col := #(2 3 4).
+
+ self assert: -4 equals: (col atLast: 1 ifPresent: #negated ifAbsent: [self fail]).
+ self assert: -3 equals: (col atLast: 2 ifPresent: #negated ifAbsent: [self fail]).
+ self assert: -2 equals: (col atLast: 3 ifPresent: #negated ifAbsent: [self fail]).
+
+ self assert: #absent equals: (col atLast: 0 ifPresent: [self fail] ifAbsent: [#absent]).
+ self assert: #absent equals: (col atLast: 4 ifPresent: [self fail] ifAbsent: [#absent]).!
More information about the Squeak-dev
mailing list
|