Skip to content

Commit 09c5d67

Browse files
author
Johan Brichau
committed
deprecate beginsWithSubCollection: and endsWithSubCollection: in favor of the new greaseBeginsWith: and greaseEndsWith:
1 parent bbcb179 commit 09c5d67

File tree

7 files changed

+36
-2
lines changed

7 files changed

+36
-2
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
*Grease-Pharo100-Core
22
beginsWithSubCollection: aSequenceableCollection
33
"Some platforms implement #beginsWith: to answer true for an empty argument."
4+
self
5+
greaseDeprecatedApi: 'SequenceableCollection>>#beginsWithSubCollection:'
6+
details: 'Use SequenceableCollection>>#greaseBegins:'.
7+
aSequenceableCollection isEmpty ifTrue: [ ^ false ].
48
^ self beginsWith: aSequenceableCollection
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
*Grease-Pharo100-Core
22
endsWithSubCollection: aSequenceableCollection
33
"Some platforms implement #endsWith: to answer true for an empty argument."
4+
self
5+
greaseDeprecatedApi: 'SequenceableCollection>>#endsWithSubCollection:'
6+
details: 'Use SequenceableCollection>>#greaseEndsWith:'.
7+
aSequenceableCollection isEmpty ifTrue: [ ^ false ].
48
^ self endsWith: aSequenceableCollection
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*Grease-Pharo100-Core
2+
greaseBeginsWith: aSequenceableCollection
3+
aSequenceableCollection isEmpty ifTrue: [ ^ true ].
4+
^ self beginsWith: aSequenceableCollection
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*Grease-Pharo100-Core
2+
greaseEndsWith: aSequenceableCollection
3+
aSequenceableCollection isEmpty ifTrue: [ ^ true ].
4+
^ self endsWith: aSequenceableCollection

repository/Grease-Pharo90-Slime.package/GRNotPortableCollectionsRule.class/instance/initialize.st

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ initialize
33
super initialize.
44
self rewriteRule
55
replace: '`@collection beginsWith: `@subCollection'
6-
with: '`@collection beginsWithSubCollection: `@subCollection';
6+
with: '`@collection greaseBeginsWith: `@subCollection';
77
replace: '`@collection endsWith: `@subCollection'
8-
with: '`@collection endsWithSubCollection: `@subCollection'
8+
with: '`@collection greaseEndsWith: `@subCollection'
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
tests
2+
testGreaseBeginsWith
3+
| collection |
4+
collection := self arbitraryCollection.
5+
self assert: (collection greaseBeginsWith: (collection copyWithout: collection last)).
6+
self assert: (collection greaseBeginsWith: collection).
7+
self deny: (collection greaseBeginsWith: (collection copyWith: collection first)).
8+
self assert: (collection greaseBeginsWith: self emptyCollection).
9+
self deny: (self emptyCollection greaseBeginsWith: collection)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
tests
2+
testGreaseEndsWith
3+
| collection |
4+
collection := self arbitraryCollection.
5+
self assert: (collection greaseEndsWith: (collection copyWithout: collection first)).
6+
self assert: (collection greaseEndsWith: collection).
7+
self deny: (collection greaseEndsWith: (collection copyWith: collection first)).
8+
self assert: (collection greaseEndsWith: self emptyCollection).
9+
self deny: (self emptyCollection greaseEndsWith: collection)

0 commit comments

Comments
 (0)