Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the expected output for str-slice(). #997

Merged
merged 2 commits into from
Dec 12, 2016
Merged

Fix the expected output for str-slice(). #997

merged 2 commits into from
Dec 12, 2016

Conversation

nex3
Copy link
Contributor

@nex3 nex3 commented Dec 11, 2016

No description provided.

xzyfer added a commit to xzyfer/libsass that referenced this pull request Dec 11, 2016
When is `$end-at` is more negative than the length of the string
return an empty string.

Fixes sass#2240
Spec sass/sass-spec#997
@xzyfer
Copy link
Contributor

xzyfer commented Dec 11, 2016

I'm not sure I completely follow the issue. Can you please confirm what the output of the following should be?

a {
  test-11: str-slice('aöc', 0, -3);
  test-12: str-slice('aöc', 1, -3);

  test-16: str-slice('aöc', 0, -4);
  test-17: str-slice('aöc', 1, -4);

  test-18: str-slice('aöc', 2, -4);
  test-19: str-slice('aöc', 3, -4);
}

From my understanding they should all return "", am I mistaken?

@nex3
Copy link
Contributor Author

nex3 commented Dec 11, 2016

@xzyfer str-slice('aöc', 0, -3) should both return "a", because the $end-at parameter is inclusive and points to the third-from-last character, a. The same is true for str-slice('aöc', 1, -3), since indices are 1-based and so the index 1 also points at a. The others should all return "".

LibSass fixes this behavior in sass/libsass#2241.
@nex3 nex3 merged commit 6627154 into master Dec 12, 2016
@nex3 nex3 deleted the fix-slice branch December 12, 2016 00:30
@xzyfer
Copy link
Contributor

xzyfer commented Dec 12, 2016

Sorry I'm not clear why these both return a.

test-11: str-slice('aöc', 0, -3);
test-16: str-slice('aöc', 0, -4);

See https://github.com/sass/sass-spec/pull/997/files#diff-2a1fce6f95db3f518285362f272d8e61R18

Seems to run contradictory to your previous comment.

xzyfer added a commit to xzyfer/sass-spec that referenced this pull request Dec 15, 2016
The spec was updated in sass#997 with incorrect output generated by a
big in Ruby Sass sass/sass#2211.

This updates the expected output and disables the spec since all
implemenations are now failing.
xzyfer added a commit to xzyfer/sass-spec that referenced this pull request Dec 15, 2016
This spec was updated with incorrect output in sass#997 due to a Ruby
Sass bug. In sass#1004 the output was updated to be correct and the spec
disabled for all implementations because they all suffered from the
original bug.

This PR enables it for LibSass which is now passing with correct output.
xzyfer added a commit to xzyfer/sass-spec that referenced this pull request Dec 15, 2016
This spec was updated with incorrect output in sass#997 due to a Ruby
Sass bug. In sass#1004 the output was updated to be correct and the spec
disabled for all implementations because they all suffered from the
original bug.

This PR enables it for LibSass which is now passing with correct output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants