[squeak-dev] The Trunk: CollectionsTests-dtl.375.mcz
commits at source.squeak.org
commits at source.squeak.org
Sat Apr 30 21:47:11 UTC 2022
David T. Lewis uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-dtl.375.mcz
==================== Summary ====================
Name: CollectionsTests-dtl.375
Author: dtl
Time: 30 April 2022, 5:47:10.423283 pm
UUID: 5a5a04ca-3618-427d-b61d-66da38ece296
Ancestors: CollectionsTests-ct.374
Test updates to complement Collections-eem.1008
Change beginsWith: and endsWith: to be true for the empty sequence, e.g. 'foo' beginsWith: '' is now true. See http://lists.squeakfoundation.org/pipermail/squeak-dev/2022-April/220038.html
=============== Diff against CollectionsTests-ct.374 ===============
Item was changed:
----- Method: LinkedListTest>>testsBeginsWithEmpty (in category 'tests - begins ends with') -----
testsBeginsWithEmpty
+ self assert: (self nonEmpty beginsWith:(self empty)).
- self deny: (self nonEmpty beginsWith:(self empty)).
self deny: (self empty beginsWith:(self nonEmpty )).
!
Item was changed:
----- Method: LinkedListTest>>testsEndsWithEmpty (in category 'tests - begins ends with') -----
testsEndsWithEmpty
+ self assert: (self nonEmpty endsWith: self empty).
- self deny: (self nonEmpty endsWith: self empty).
self deny: (self empty endsWith: self nonEmpty).
!
Item was changed:
----- Method: SequenceableCollectionTest>>testBeginsWith (in category 'tests - testing') -----
testBeginsWith
"We can't test SequenceableCollection directly. However, we can test a sampling of its descendants."
| la prefix oc |
la := #(1 2 3 4 5 6).
oc := OrderedCollection new.
oc add: 1; add: 2; add: 3.
self assert: (la beginsWith: #(1)).
+ self deny: (la beginsWith: #(2)).
self assert: (la beginsWith: #(1 2)).
+ self deny: (la beginsWith: #(1 1)).
+ self deny: (la beginsWith: #(2 2)).
self assert: (la beginsWith: #(1 2 3)).
+ self deny: (la beginsWith: #(1 2 2)).
self assert: (la beginsWith: oc).
+ self assert: (la beginsWith: #()).
+ self assert: (la beginsWith: '').
+ self assert: (la beginsWith: OrderedCollection new).
- self deny: (la beginsWith: #()).
- self deny: (la beginsWith: '').
- self deny: (la beginsWith: OrderedCollection new).
self assert: (oc beginsWith: #(1 2)).
prefix := OrderedCollection new.
+ self assert: (oc beginsWith: prefix).
- self deny: (oc beginsWith: prefix).
prefix add: 1.
self assert: (oc beginsWith: prefix).
prefix add: 2.
self assert: (oc beginsWith: prefix).
prefix add: 3.
self assert: (oc beginsWith: prefix).
prefix add: 4.
self deny: (oc beginsWith: prefix).!
Item was changed:
----- Method: SequenceableCollectionTest>>testBeginsWithAnyOf (in category 'tests - testing') -----
testBeginsWithAnyOf
"We can't test SequenceableCollection directly. However, we can test a sampling of its descendants."
| la oc |
la := #(1 2 3 4 5 6).
oc := OrderedCollection new.
oc add: 1; add: 2; add: 3.
self assert: (la beginsWithAnyOf: #((17) (1) (42))).
self assert: (la beginsWithAnyOf: #((17) (1 2) (42))).
self assert: (la beginsWithAnyOf: #((17) (1 2 3) (42))).
self deny: (la beginsWithAnyOf: #()).
+ self assert: (la beginsWithAnyOf: #(())).
- self deny: (la beginsWithAnyOf: #(())).
self deny: (la beginsWithAnyOf: #((42))).
!
Item was changed:
----- Method: SequenceableCollectionTest>>testEndsWith (in category 'tests - testing') -----
testEndsWith
"We can't test SequenceableCollection directly. However, we can test a sampling of its descendants."
| la oc suffix |
la := #(1 2 3 4 5 6).
oc := OrderedCollection new.
oc add: 4; add: 5; add: 6.
self assert: (la endsWith: #(6)).
+ self deny: (la endsWith: #(5)).
self assert: (la endsWith: #(5 6)).
+ self deny: (la endsWith: #(5 5)).
+ self deny: (la endsWith: #(6 6 )).
self assert: (la endsWith: #(4 5 6)).
+ self deny: (la endsWith: #(5 5 6)).
self assert: (la endsWith: oc).
+ self assert: (la endsWith: #()).
+ self assert: (la endsWith: '').
- self deny: (la endsWith: #()).
- self deny: (la endsWith: '').
suffix := OrderedCollection new.
+ self assert: (oc endsWith: suffix).
suffix add: 6.
self assert: (oc endsWith: suffix).
suffix addFirst: 5.
self assert: (oc endsWith: suffix).
suffix addFirst: 4.
self assert: (oc endsWith: suffix).
suffix addFirst: 3.
self deny: (oc endsWith: suffix).!
Item was changed:
----- Method: SequenceableCollectionTest>>testEndsWithAnyOf (in category 'tests - testing') -----
testEndsWithAnyOf
"We can't test SequenceableCollection directly. However, we can test a sampling of its descendants."
| la oc |
la := #(6 5 4 3 2 1).
oc := OrderedCollection new.
oc add: 3; add: 2; add: 1.
self assert: (la endsWithAnyOf: #((17) (1) (42))).
self assert: (la endsWithAnyOf: #((17) (2 1) (42))).
self assert: (la endsWithAnyOf: #((17) (3 2 1) (42))).
self deny: (la endsWithAnyOf: #()).
+ self assert: (la endsWithAnyOf: #(())).
- self deny: (la endsWithAnyOf: #(())).
self deny: (la endsWithAnyOf: #((42))).
!
Item was changed:
----- Method: StringTest>>testBeginsWith (in category 'tests - finding') -----
testBeginsWith
self assert: ('Elvis' beginsWith: 'Elv').
self assert: ('Elvis' beginsWith: 'Elvis').
self assert: ('Elvis' beginsWith: 'E').
self deny: ('Elvis' beginsWith: 'e').
self deny: ('Elvis' beginsWith: 'Elvis ').
+ self assert: ('' beginsWith: '').
+ self assert: ('abc' beginsWith: '')!
- self deny: ('' beginsWith: '').
- self deny: ('abc' beginsWith: '')!
Item was changed:
----- Method: StringTest>>testEndsWith (in category 'tests - finding') -----
testEndsWith
self assert: ('Elvis' endsWith: 'vis').
self assert: ('Elvis' endsWith: 'Elvis').
self assert: ('Elvis' endsWith: 's').
self deny: ('Elvis' endsWith: 'S').
self deny: ('Elvis' endsWith: ' Elvis').
+ self assert: ('' endsWith: '').
+ self assert: ('abc' endsWith: '')!
- self deny: ('' endsWith: '').
- self deny: ('abc' endsWith: '')!
Item was changed:
----- Method: WideStringTest>>testBeginsWith (in category 'tests - beginsWith') -----
testBeginsWith
"from johnmci at http://bugs.squeak.org/view.php?id=5331"
| w1 w2 |
self assert: ('abc' beginsWith: 'ab').
self assert: ('abc' beginsWith: 'ab' asWideString).
self assert: ('abc' asWideString beginsWith: 'ab').
self assert: ('abc' beginsWith: 'aX') not .
self assert: ('abc' beginsWith: 'AB') not.
self assert: ('abc' beginsWith: 'AB' asWideString) not .
self assert: ('ABC' asWideString beginsWith: 'ab') not.
+ self assert: ('' beginsWith: '' asWideString).
+ self assert: ('abc' beginsWith: '' asWideString).
w1 := WideString with: (Unicode value: 402) with: $a with: (Unicode value: 400) with: $b.
w2 := WideString with: (Unicode value: 402).
w1 beginsWith: w2.
+ self assert: (w1 beginsWith: '' asWideString).
+ self assert: (w1 beginsWith: '').
+ self assert: ('' asWideString beginsWith: '' asWideString).
+ self assert: ('' asWideString beginsWith: '').
!
More information about the Squeak-dev
mailing list
|