You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Empty subcollection tests fail on latest Pharo and Squeak versions #147
Our tests for #beginsWithSubCollection: and #endsWithSubCollection: with empty arguments fail on the latest Pharo and Squeak versions. It looks like they changed the behavior of #beginsWith: and #endsWith:
The current expectation seems to be based on ANSI #indexOfSubCollection:startingAt: which states
Answer 0 if no such subsequence is found in the receiver, or if targetSequence is empty.
An illustrative example
#(1 2 3)beginsWithSubCollection:#(1). "true"#(1 2 3)beginsWithSubCollection:#(). "false in Pharo 10 and Squeak5, true in Pharo 11 and Squeak 6 "#(1 2 3)endsWithSubCollection:#(3). "true"#(1 2 3)endsWithSubCollection:#(). "false in Pharo 10 and Squeak 5,true in Pharo 11 and Squeak 6 "
There are several possible solutions, the ones with the least chance of blast damage seem to be:
remove the empty argument tests, we don't seem to have any senders with empty arguments
introduce #greaseBeginsWithSubCollection: and #greaseEndsWithSubCollection;
Removing the tests fixes the tests but Grease for GemStone actually adds endsWithSubCollection and beginsWithSubCollection to GLASS/GsDevKit and implements the behaviour of Pharo 10:
With Grease being part of GLASS, there can be projects depending on these 'old' semantics if we would change this to be in line with Pharo 11. Question is: should we change the existing implementation in the GemStone package or, as removing the test would imply, leave out the compatibility from Grease since Seaside does not actually rely on this compatibility?
@jbrichau if I read this correctly, you seem to be planning on introducing grease variants of those two methods and you will stop using beginsWithSubCollection: and endsWithSubCollection: in Seaside ... so that seems to be the most reasonable way of introducing new behavior and I'm inclined to leave the current GemStone implementation as is and then users will have the ability to pick and choose the implementation that they prefer ...
To give all users of Grease the chance to convert and adapt to the new behavior, new methods are introduced and the old ones keep their current behavior. See #157
Activity
JupiterJones commentedon Sep 2, 2022
This bug in Pharo (and squeak, I think) was fixed back in May. Still, there will be versions out there with the bug still present.
See beginsWith: and endsWith: should return true on empty string
Remove empty collection tests
jbrichau commentedon Sep 16, 2022
Removing the tests fixes the tests but Grease for GemStone actually adds
endsWithSubCollectionandbeginsWithSubCollectionto GLASS/GsDevKit and implements the behaviour of Pharo 10:With Grease being part of GLASS, there can be projects depending on these 'old' semantics if we would change this to be in line with Pharo 11. Question is: should we change the existing implementation in the GemStone package or, as removing the test would imply, leave out the compatibility from Grease since Seaside does not actually rely on this compatibility?
Maybe @dalehenrich has a thought?
dalehenrich commentedon Sep 16, 2022
@jbrichau if I read this correctly, you seem to be planning on introducing grease variants of those two methods and you will stop using beginsWithSubCollection: and endsWithSubCollection: in Seaside ... so that seems to be the most reasonable way of introducing new behavior and I'm inclined to leave the current GemStone implementation as is and then users will have the ability to pick and choose the implementation that they prefer ...
jbrichau commentedon Feb 5, 2023
To give all users of Grease the chance to convert and adapt to the new behavior, new methods are introduced and the old ones keep their current behavior. See #157