forked from sass/sass-spec
-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add specs for string split #2
Closed
Closed
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1a8341f
first draft of specs for string-split
dvdherron 976c958
Merge branch 'main' into string-split
dvdherron 9654df7
Merge branch 'main' into string-split
dvdherron 71a50b1
clean up draft
dvdherron e6843de
add too_many_args error
dvdherron ca52474
Merge branch 'main' into string-split
dvdherron af96c97
add private use test
dvdherron 3609f39
fix typo
dvdherron 7ade349
review edits
dvdherron File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
<===> options.yml | ||
--- | ||
:ignore_for: | ||
- libsass | ||
|
||
<===> | ||
================================================================================ | ||
<===> empty/input.scss | ||
a {b: split("")} | ||
|
||
<===> empty/output.css | ||
a { | ||
b: [""]; | ||
} | ||
|
||
<===> | ||
================================================================================ | ||
<===> separator/input.scss | ||
a {b: split("a, b, c", ", ")} | ||
|
||
<===> separator/output.css | ||
a { | ||
b: ["a", "b", "c"]; | ||
} | ||
|
||
<===> | ||
================================================================================ | ||
<===> empty_separator/input.scss | ||
a {b: split("Helvetica", "")} | ||
|
||
<===> empty_separator/output.css | ||
a { | ||
b: ["H", "e", "l", "v", "e", "t", "i", "c", "a"]; | ||
} | ||
|
||
<===> | ||
================================================================================ | ||
<===> separator_not_found/input.scss | ||
a {b: split("a, b, c", "&")} | ||
|
||
<===> separator_not_found/output.css | ||
a { | ||
b: ["a, b, c"]; | ||
} | ||
|
||
<===> | ||
================================================================================ | ||
<===> limit/input.scss | ||
a {b: split("a, b, c, d", ", ", 2)} | ||
|
||
<===> limit/output.css | ||
a { | ||
b: ["a", "b", "c, d"]; | ||
} | ||
|
||
<===> | ||
================================================================================ | ||
<===> limit_zero/input.scss | ||
a {b: split("a, b, c", ", ", 0)} | ||
|
||
<===> limit_zero/output.css | ||
a { | ||
b: ["a, b, c"]; | ||
} | ||
|
||
<===> | ||
================================================================================ | ||
<===> double_width_character/input.scss | ||
// Sass treats strings as sequences of Unicode codepoint; it doesn't care if a | ||
// character is represented as two UTF-16 code units. | ||
a {b: split("👭a", "")} | ||
|
||
<===> double_width_character/output.css | ||
a { | ||
b: ["👭", "a"]; | ||
} | ||
|
||
<===> | ||
================================================================================ | ||
<===> private_use_character/input.scss | ||
// Dart Sass emits private-use characters as escapes in expanded mode, but it | ||
// should stil treat them as single characters for the purpose of functions. | ||
a {b: split("\E000"), ""} | ||
|
||
<===> private_use_character/output.css | ||
a { | ||
b: ["\E000"]; | ||
} | ||
|
||
<===> | ||
================================================================================ | ||
<===> named/input.scss | ||
a {b: split($string: "a/b/c", $separator: "/", $limit: 1)} | ||
|
||
<===> named/output.css | ||
a { | ||
b: ["a", "b/c"]; | ||
} | ||
|
||
<===> | ||
================================================================================ | ||
<===> error/too_many_args/input.scss | ||
a {b: split("a/b/c", "/", 1, 3)} | ||
|
||
<===> error/too_many_args/error | ||
Error: Only 3 arguments allowed, but 4 were passed. | ||
1 | a {b: split("a/b/c", "/", 1, 3)} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ invocation | ||
' | ||
,--> sass:string | ||
1 | @function split($string, $separator, $limit: null) { | ||
| ======================================== declaration | ||
' | ||
input.scss 1:7 root stylesheet | ||
|
||
<===> | ||
================================================================================ | ||
<===> error/type/string/input.scss | ||
a {b: split(1, "%")} | ||
|
||
<===> error/type/string/error | ||
Error: $string: 1 is not a string. | ||
, | ||
1 | a {b: split(1, "%")} | ||
| ^^^^^^^^^^^^^ | ||
' | ||
input.scss 1:7 root stylesheet | ||
|
||
<===> | ||
================================================================================ | ||
<===> error/type/separator/input.scss | ||
a {b: split("1/2/3", /)} | ||
|
||
<===> error/type/separator/error | ||
Error: $separator: / is not a string. | ||
, | ||
1 | a {b: split("1/2/3", /)} | ||
| ^^^^^^^^^^^^^^^^^ | ||
' | ||
input.scss 1:7 root stylesheet | ||
|
||
<===> | ||
================================================================================ | ||
<===> error/type/limit/input.scss | ||
a {b: split("1/2/3", "/", "1")} | ||
|
||
<===> error/type/limit/error | ||
Error: $limit: "1" is not a number. | ||
, | ||
1 | a {b: split("1/2/3", "/", "1")} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ||
' | ||
input.scss 1:7 root stylesheet | ||
|
||
<===> | ||
================================================================================ | ||
<===> error/decimal/input.scss | ||
a {b: split("1/2/3", "/", 0.5)} | ||
|
||
<===> error/decimal/error | ||
Error: $limit: 0.5 is not an int. | ||
, | ||
1 | a {b: split("1/2/3", "/", 0.5)} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ | ||
' | ||
input.scss 1:7 root stylesheet | ||
|
||
<===> | ||
================================================================================ | ||
<===> error/negative_limit/input.scss | ||
a {b: split("1/2/3", "/", -1)} | ||
|
||
<===> error/negative_limit/error | ||
Error: $limit: Must be a positive int or null. | ||
, | ||
1 | a {b: split("1/2/3", "/", -1)} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ | ||
' | ||
input.scss 1:7 root stylesheet |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: still
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I'll fix.