Skip to content

Empty subcollection tests fail on latest Pharo and Squeak versions #147

@marschall

Description

@marschall

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 Squeak
5, 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;

See http://lists.squeakfoundation.org/pipermail/seaside-dev/2022-September/007363.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions