diff --git a/spec/callable/arguments.hrx b/spec/callable/arguments.hrx index 2f384ce7b1..844eeed78c 100644 --- a/spec/callable/arguments.hrx +++ b/spec/callable/arguments.hrx @@ -263,6 +263,20 @@ a { b: (positional: ((1,)), named: (c: 2)); } +<===> +================================================================================ +<===> function/arguments/sass/input.sass +@function a($b, $c) + @return d + +e + f: a(g, h) + +<===> function/arguments/sass/output.css +e { + f: d; +} + <===> ================================================================================ <===> function/error/comma_only/input.scss @@ -291,43 +305,3 @@ Error: Positional arguments must come before keyword arguments. | ^ ' input.scss 3:14 root stylesheet - -<===> -================================================================================ -<===> function/error/sass/multi-line-arguments/declaration/input.sass -@function a( - $b, - $c -) - @return d - -e - f: a(g, h) - -<===> function/error/sass/multi-line-arguments/declaration/error -Error: expected ")". - , -1 | @function a( - | ^ - ' - input.sass 1:13 root stylesheet - -<===> -================================================================================ -<===> function/error/sass/multi-line-arguments/invocation/input.sass -@function a($b, $c) - @return d - -e - f: a( - g, - h - ) - -<===> function/error/sass/multi-line-arguments/invocation/error -Error: expected ")". - , -5 | f: a( - | ^ - ' - input.sass 5:8 root stylesheet diff --git a/spec/callable/whitespace.hrx b/spec/callable/whitespace.hrx new file mode 100644 index 0000000000..30f1929703 --- /dev/null +++ b/spec/callable/whitespace.hrx @@ -0,0 +1,479 @@ +<===> newlines/function/after_paren/scss/input.scss +@function a( + $b, $c){} + +<===> newlines/function/after_paren/scss/output.css + +<===> +================================================================================ +<===> newlines/function/after_paren/sass/input.sass +@function a( + $b, $c) + +<===> newlines/function/after_paren/sass/output.css + +<===> +================================================================================ +<===> newlines/function/after_arg/scss/input.scss +@function a($b + , $c){} + +<===> newlines/function/after_arg/scss/output.css + +<===> +================================================================================ +<===> newlines/function/after_arg/sass/input.sass +@function a($b + , $c) + +<===> newlines/function/after_arg/sass/output.css + +<===> +================================================================================ +<===> newlines/function/after_comma/scss/input.scss +@function a($b, + $c){} + +<===> newlines/function/after_comma/scss/output.css + +<===> +================================================================================ +<===> newlines/function/after_comma/sass/input.sass +@function a($b, + $c) + +<===> newlines/function/after_comma/sass/output.css + +<===> +================================================================================ +<===> newlines/function/before_colon/scss/input.scss +@function a($b, $c + :d){} + +<===> newlines/function/before_colon/scss/output.css + +<===> +================================================================================ +<===> newlines/function/before_colon/sass/input.sass +@function a($b, $c + :d) + +<===> newlines/function/before_colon/sass/output.css + +<===> +================================================================================ +<===> newlines/function/after_colon/scss/input.scss +@function a($b, $c: + d){} + +<===> newlines/function/after_colon/scss/output.css + +<===> +================================================================================ +<===> newlines/function/after_colon/sass/input.sass +@function a($b, $c: + d) + +<===> newlines/function/after_colon/sass/output.css + +<===> +================================================================================ +<===> newlines/function/space_after_colon/sass/input.sass +@function a($b, $c: d + e) + +<===> newlines/function/space_after_colon/sass/output.css + +<===> +================================================================================ +<===> newlines/function/before_paren/scss/input.scss +@function a($b, $c + ){} + +<===> newlines/function/before_paren/scss/output.css + +<===> +================================================================================ +<===> newlines/function/before_paren/sass/input.sass +@function a($b, $c + ) + +<===> newlines/function/before_paren/sass/output.css + +<===> +================================================================================ +<===> newlines/function/before_list_arg/scss/input.scss +@function a( + $b...){} + +<===> newlines/function/before_list_arg/scss/output.css + +<===> +================================================================================ +<===> newlines/function/before_list_arg/sass/input.sass +@function a( + $b...) + +<===> newlines/function/before_list_arg/sass/output.css + +<===> +================================================================================ +<===> newlines/function/before_list/scss/input.scss +@function a($b + ...){} + +<===> newlines/function/before_list/scss/output.css + +<===> +================================================================================ +<===> newlines/function/before_list/sass/input.sass +@function a($b + ...) + +<===> newlines/function/before_list/sass/output.css + +<===> +================================================================================ +<===> newlines/function/after_list/scss/input.scss +@function a($b... + ){} + +<===> newlines/function/after_list/scss/output.css + +<===> +================================================================================ +<===> newlines/function/after_list/sass/input.sass +@function a($b... + ) + +<===> newlines/function/after_list/sass/output.css + +<===> +================================================================================ +<===> newlines/function_invocation/after_paren/scss/input.scss +@function a($b, $c){@return null} +$d: a( + e, f) +<===> newlines/function_invocation/after_paren/scss/output.css + +<===> +================================================================================ +<===> newlines/function_invocation/after_paren/sass/input.sass +@function a($b, $c) + @return null +$d: a( + e, f) + +<===> newlines/function_invocation/after_paren/sass/output.css + +<===> +================================================================================ +<===> newlines/function_invocation/after_arg/scss/input.scss +@function a($b, $c){@return null} +$d: a(e + , f) + +<===> newlines/function_invocation/after_arg/scss/output.css + +<===> +================================================================================ +<===> newlines/function_invocation/after_arg/sass/input.sass +@function a($b, $c) + @return null +$d: a(e + , f) + +<===> newlines/function_invocation/after_arg/sass/output.css + +<===> +================================================================================ +<===> newlines/function_invocation/after_comma/scss/input.scss +@function a($b, $c){@return null} +$d: a(e, + f) + +<===> newlines/function_invocation/after_comma/scss/output.css + +<===> +================================================================================ +<===> newlines/function_invocation/after_comma/sass/input.sass +@function a($b, $c) + @return null +$d: a(e, + f) + +<===> newlines/function_invocation/after_comma/sass/output.css + +<===> +================================================================================ +<===> newlines/function_invocation/before_colon/scss/input.scss +@function a($b, $c:d){@return null} +$e: a(f, $c + :g) + +<===> newlines/function_invocation/before_colon/scss/output.css + +<===> +================================================================================ +<===> newlines/function_invocation/before_colon/sass/input.sass +@function a($b, $c:d) + @return null +$e: a(f, $c + :g) + +<===> newlines/function_invocation/before_colon/sass/output.css + +<===> +================================================================================ +<===> newlines/function_invocation/after_colon/scss/input.scss +@function a($b, $c:d){@return null} +$e: a(f, $c: + g) + +<===> newlines/function_invocation/after_colon/scss/output.css + +<===> +================================================================================ +<===> newlines/function_invocation/after_colon/sass/input.sass +@function a($b, $c:d) + @return null +$e: a(f, $c: + g) + +<===> newlines/function_invocation/after_colon/sass/output.css + +<===> +================================================================================ +<===> newlines/function_invocation/space_after_colon/sass/input.sass +@function a($b, $c:d) + @return null +$e: a(f, $c: g + h) + +<===> newlines/function_invocation/space_after_colon/sass/output.css + +<===> +================================================================================ +<===> newlines/function_invocation/before_paren/scss/input.scss +@function a($b, $c:d){@return null} +$e: a(f, $c: g + ) + +<===> newlines/function_invocation/before_paren/scss/output.css + +<===> +================================================================================ +<===> newlines/function_invocation/before_paren/sass/input.sass +@function a($b, $c:d) + @return null +$e: a(f, $c: g + ) + +<===> newlines/function_invocation/before_paren/sass/output.css + +<===> +================================================================================ +<===> newlines/function_invocation/before_list_arg/scss/input.scss +@function a($b, $c){@return null} +$d: e f; +$g: a( + $d...) + +<===> newlines/function_invocation/before_list_arg/scss/output.css + +<===> +================================================================================ +<===> newlines/function_invocation/before_list_arg/sass/input.sass +@function a($b, $c) + @return null +$d: e, f +$g: a( + $d...) + +<===> newlines/function_invocation/before_list_arg/sass/output.css + +<===> +================================================================================ +<===> newlines/function_invocation/before_list/scss/input.scss +@function a($b, $c){@return null} +$d: e f; +$g: a($d + ...) + +<===> newlines/function_invocation/before_list/scss/output.css + +<===> +================================================================================ +<===> newlines/function_invocation/before_list/sass/input.sass +@function a($b, $c) + @return null +$d: e, f +$g: a($d + ...) + +<===> newlines/function_invocation/before_list/sass/output.css + +<===> +================================================================================ +<===> newlines/function_invocation/after_list/scss/input.scss +@function a($b, $c){@return null} +$d: e f; +$g: a($d... + ) + +<===> newlines/function_invocation/after_list/scss/output.css + +<===> +================================================================================ +<===> newlines/function_invocation/after_list/sass/input.sass +@function a($b, $c) + @return null +$d: e, f +$g: a($d... + ) + +<===> newlines/function_invocation/after_list/sass/output.css + +<===> +================================================================================ +<===> newlines/mixin/after_paren/scss/input.scss +@mixin a( + $b, $c){} + +<===> newlines/mixin/after_paren/scss/output.css + +<===> +================================================================================ +<===> newlines/mixin/after_paren/sass/input.sass +@mixin a( + $b, $c) + +<===> newlines/mixin/after_paren/sass/output.css + +<===> +================================================================================ +<===> newlines/mixin/after_arg/scss/input.scss +@mixin a($b + , $c){} + +<===> newlines/mixin/after_arg/scss/output.css + +<===> +================================================================================ +<===> newlines/mixin/after_arg/sass/input.sass +@mixin a($b + , $c) + +<===> newlines/mixin/after_arg/sass/output.css + +<===> +================================================================================ +<===> newlines/mixin/after_comma/scss/input.scss +@mixin a($b, + $c){} + +<===> newlines/mixin/after_comma/scss/output.css + +<===> +================================================================================ +<===> newlines/mixin/after_comma/sass/input.sass +@mixin a($b, + $c) + +<===> newlines/mixin/after_comma/sass/output.css + +<===> +================================================================================ +<===> newlines/mixin/before_colon/scss/input.scss +@mixin a($b, $c + :d){} + +<===> newlines/mixin/before_colon/scss/output.css + +<===> +================================================================================ +<===> newlines/mixin/before_colon/sass/input.sass +@mixin a($b, $c + :d) + +<===> newlines/mixin/before_colon/sass/output.css + +<===> +================================================================================ +<===> newlines/mixin/after_colon/scss/input.scss +@mixin a($b, $c: + d){} + +<===> newlines/mixin/after_colon/scss/output.css + +<===> +================================================================================ +<===> newlines/mixin/after_colon/sass/input.sass +@mixin a($b, $c: + d) + +<===> newlines/mixin/after_colon/sass/output.css + +<===> +================================================================================ +<===> newlines/mixin/before_paren/scss/input.scss +@mixin a($b, $c + ){} + +<===> newlines/mixin/before_paren/scss/output.css + +<===> +================================================================================ +<===> newlines/mixin/before_paren/sass/input.sass +@mixin a($b, $c + ) + +<===> newlines/mixin/before_paren/sass/output.css + +<===> +================================================================================ +<===> newlines/mixin/before_list_arg/scss/input.scss +@mixin a( + $b...){} + +<===> newlines/mixin/before_list_arg/scss/output.css + +<===> +================================================================================ +<===> newlines/mixin/before_list_arg/sass/input.sass +@mixin a( + $b...) + +<===> newlines/mixin/before_list_arg/sass/output.css + +<===> +================================================================================ +<===> newlines/mixin/before_list/scss/input.scss +@mixin a($b + ...){} + +<===> newlines/mixin/before_list/scss/output.css + +<===> +================================================================================ +<===> newlines/mixin/before_list/sass/input.sass +@mixin a($b + ...) + +<===> newlines/mixin/before_list/sass/output.css + +<===> +================================================================================ +<===> newlines/mixin/after_list/scss/input.scss +@mixin a($b... + ){} + +<===> newlines/mixin/after_list/scss/output.css + +<===> +================================================================================ +<===> newlines/mixin/after_list/sass/input.sass +@mixin a($b... + ) + +<===> newlines/mixin/after_list/sass/output.css diff --git a/spec/core_functions/newlines.hrx b/spec/core_functions/newlines.hrx new file mode 100644 index 0000000000..ff75b3852a --- /dev/null +++ b/spec/core_functions/newlines.hrx @@ -0,0 +1,62 @@ +<===> after_paren/input.sass +@use "sass:list"; +a + b: list.append( + c d, e) + +<===> after_paren/output.css +a { + b: c d e; +} + +<===> +================================================================================ +<===> after_value/input.sass +@use "sass:list"; +a + b: list.append(c + d, e) + +<===> after_value/output.css +a { + b: c d e; +} + +<===> +================================================================================ +<===> before_comma/input.sass +@use "sass:list"; +a + b: list.append(c d + , e) + +<===> before_comma/output.css +a { + b: c d e; +} + +<===> +================================================================================ +<===> after_comma/input.sass +@use "sass:list"; +a + b: list.append(c d, + e) + +<===> after_comma/output.css +a { + b: c d e; +} + +<===> +================================================================================ +<===> before_paren/input.sass +@use "sass:list"; +a + b: list.append(c d, e + ) + +<===> before_paren/output.css +a { + b: c d e; +} diff --git a/spec/css/charset.hrx b/spec/css/charset.hrx new file mode 100644 index 0000000000..a982a17d43 --- /dev/null +++ b/spec/css/charset.hrx @@ -0,0 +1,19 @@ +<===> whitespace/scss/input.scss +@charset + "a"; + +<===> whitespace/scss/output.css + +<===> +================================================================================ +<===> error/whitespace/sass/input.sass +@charset + "a" + +<===> error/whitespace/sass/error +Error: Expected string. + , +1 | @charset + | ^ + ' + input.sass 1:9 root stylesheet diff --git a/spec/css/comment.hrx b/spec/css/comment.hrx index 5de76a124e..99417e3055 100644 --- a/spec/css/comment.hrx +++ b/spec/css/comment.hrx @@ -211,6 +211,18 @@ a { b: c; } +<===> +================================================================================ +<===> loud/multi_line/sass/input.sass +a + b: c /* d + e */ f + +<===> loud/multi_line/sass/output.css +a { + b: c f; +} + <===> ================================================================================ <===> error/loud/unterminated/scss/input.scss @@ -233,22 +245,7 @@ a b: c /* d <===> error/loud/unterminated/sass/error -Error: expected */. - , -2 | b: c /* d - | ^ - ' - input.sass 2:12 root stylesheet - -<===> -================================================================================ -<===> error/loud/multi_line/sass/input.sass -a - b: c /* d - e */ f - -<===> error/loud/multi_line/sass/error -Error: expected */. +Error: expected more input. , 2 | b: c /* d | ^ diff --git a/spec/css/custom_properties/syntax.hrx b/spec/css/custom_properties/syntax.hrx index a608ddf09d..ce80365353 100644 --- a/spec/css/custom_properties/syntax.hrx +++ b/spec/css/custom_properties/syntax.hrx @@ -55,3 +55,42 @@ a {b: var(---)} a { b: var(---); } + +<===> +================================================================================ +<===> sass/multiline_list/paren/input.sass +a + --b: (c + d) + +<===> sass/multiline_list/paren/output.css +a { + --b: (c + d); +} + +<===> +================================================================================ +<===> sass/multiline_list/brace/input.sass +a + --b: {c + d} + +<===> sass/multiline_list/brace/output.css +a { + --b: {c + d}; +} + +<===> +================================================================================ +<===> sass/multiline_list/bracket/input.sass +a + --b: [c + d] + +<===> sass/multiline_list/bracket/output.css +a { + --b: [c + d]; +} diff --git a/spec/css/custom_properties/value_interpolation.hrx b/spec/css/custom_properties/value_interpolation.hrx index 69dd6d3061..9c7560f837 100644 --- a/spec/css/custom_properties/value_interpolation.hrx +++ b/spec/css/custom_properties/value_interpolation.hrx @@ -80,14 +80,14 @@ a { <===> ================================================================================ -<===> scss/linebreak-interpolation/input.scss +<===> scss/linebreak_interpolation/input.scss a{ --b: #{1 + 2}; } -<===> scss/linebreak-interpolation/output.css +<===> scss/linebreak_interpolation/output.css a { --b: 3; } @@ -149,17 +149,14 @@ a { <===> ================================================================================ -<===> error/sass/linebreak-interpolation/input.sass +<===> sass/linebreak_interpolation/input.sass a --b: #{1 + 2} -<===> error/sass/linebreak-interpolation/error -Error: expected "}". - , -2 | --b: #{1 - | ^ - ' - input.sass 2:12 root stylesheet +<===> sass/linebreak_interpolation/output.css +a { + --b: 3; +} diff --git a/spec/css/functions/newlines.hrx b/spec/css/functions/newlines.hrx new file mode 100644 index 0000000000..811ae3b996 --- /dev/null +++ b/spec/css/functions/newlines.hrx @@ -0,0 +1,105 @@ +<===> value/before/input.sass +a + b: c( + d) + +<===> value/before/output.css +a { + b: c(d); +} + +<===> +================================================================================ +<===> value/after/input.sass +a + b: c(d + ) + +<===> value/after/output.css +a { + b: c(d); +} + +<===> +================================================================================ +<===> value/between/input.sass +a + b: c(d + e) + +<===> value/between/output.css +a { + b: c(d e); +} + +<===> +================================================================================ +<===> comma/before/input.sass +a + b: c(d + ,e) + +<===> comma/before/output.css +a { + b: c(d, e); +} + +<===> +================================================================================ +<===> comma/after/input.sass +a + b: c(d, + e) + +<===> comma/after/output.css +a { + b: c(d, e); +} + +<===> +================================================================================ +<===> trailing_comma/before/input.sass +a + b: c(d + ,) + +<===> trailing_comma/before/output.css +a { + b: c(d); +} + +<===> +================================================================================ +<===> trailing_comma/after/input.sass +a + b: c(d, + ) + +<===> trailing_comma/after/output.css +a { + b: c(d); +} + +<===> +================================================================================ +<===> slash/before/input.sass +a + b: c(d + / e) + +<===> slash/before/output.css +a { + b: c(d/e); +} + +<===> +================================================================================ +<===> slash/after/input.sass +a + b: c(d / + e) + +<===> slash/after/output.css +a { + b: c(d/e); +} diff --git a/spec/css/functions/url.hrx b/spec/css/functions/url.hrx index 25e9d2004a..f327ca9c35 100644 --- a/spec/css/functions/url.hrx +++ b/spec/css/functions/url.hrx @@ -15,3 +15,42 @@ a {b: url(http://c.d/e!f)} a { b: url(http://c.d/e!f); } + +<===> +================================================================================ +<===> whitespace/sass/after_open/middle/input.sass +a + b: url( + c) + +<===> whitespace/sass/after_open/middle/output.css +a { + b: url(c); +} + +<===> +================================================================================ +<===> whitespace/sass/before_close/middle/input.sass +a + b: url(c + ) + +<===> whitespace/sass/before_close/middle/output.css +a { + b: url(c); +} + +<===> +================================================================================ +<===> error/whitespace/sass/before_paren/middle/input.sass +a + b: url + (c) + +<===> error/whitespace/sass/before_paren/middle/error +Error: Expected identifier. + , +2 | b: url + | ^ + ' + input.sass 2:9 root stylesheet diff --git a/spec/css/important.hrx b/spec/css/important.hrx index 072b272d0b..e53968604f 100644 --- a/spec/css/important.hrx +++ b/spec/css/important.hrx @@ -1,3 +1,15 @@ +<===> syntax/sass/multiline/after_bang/input.sass +a + b: c! + important + +<===> syntax/sass/multiline/after_bang/output.css +a { + b: c !important; +} + +<===> +================================================================================ <===> error/syntax/eof_after_bang/input.scss // Regression test for sass/dart-sass#1049. The lack of a trailing newline is // necessary for the regression test. @@ -9,3 +21,18 @@ Error: Expected "important". | ^ ' input.scss 3:8 root stylesheet + +<===> +================================================================================ +<===> error/syntax/sass/multiline/after_prop/input.sass +a + b: c + !important + +<===> error/syntax/sass/multiline/after_prop/error +Error: Expected identifier. + , +2 | b: c + | ^ + ' + input.sass 2:7 root stylesheet diff --git a/spec/css/media/whitespace.hrx b/spec/css/media/whitespace.hrx new file mode 100644 index 0000000000..0f71d035f2 --- /dev/null +++ b/spec/css/media/whitespace.hrx @@ -0,0 +1,143 @@ +<===> before_query/scss/input.scss +@media + screen {} + +<===> before_query/scss/output.css + +<===> +================================================================================ +<===> after_query/scss/input.scss +@media screen + {} + +<===> after_query/scss/output.css + +<===> +================================================================================ +<===> paren/after_paren/sass/input.sass +@media ( + a: b) + +<===> paren/after_paren/sass/output.css + +<===> +================================================================================ +<===> paren/after_key/sass/input.sass +@media (a + : b) + +<===> paren/after_key/sass/output.css + +<===> +================================================================================ +<===> paren/after_colon/sass/input.sass +@media (a: + b) + +<===> paren/after_colon/sass/output.css + +<===> +================================================================================ +<===> paren/after_value/sass/input.sass +@media (a: b + ) + +<===> paren/after_value/sass/output.css + +<===> +================================================================================ +<===> paren/nested/after_inside/sass/input.sass +@media ((a: b) + ) + +<===> paren/nested/after_inside/sass/output.css + +<===> +================================================================================ +<===> paren/nested/after_and/sass/input.sass +@media ((a: b) and + (c: d)) + +<===> paren/nested/after_and/sass/output.css + +<===> +================================================================================ +<===> paren/nested/after_or/sass/input.sass +@media ((a: b) or + (c: d)) + +<===> paren/nested/after_or/sass/output.css + +<===> +================================================================================ +<===> paren/after_not/sass/input.sass +@media (not + (a: b)) + +<===> paren/after_not/sass/output.css + +<===> +================================================================================ +<===> paren/after_operator/sass/input.sass +@media (a > + b) + +<===> paren/after_operator/sass/output.css + +<===> +================================================================================ +<===> paren/after_second_operator/sass/input.sass +@media (a > b > + c) + +<===> paren/after_second_operator/sass/output.css + +<===> +================================================================================ +<===> error/before_query/sass/input.sass +@media + screen + +<===> error/before_query/sass/error +Error: Expected identifier. + , +1 | @media + | ^ + ' + input.sass 1:7 root stylesheet + +<===> +================================================================================ +<===> error/logic_sequence/before_operator/sass/input.sass +@media (a: b) + and (c: d) + +<===> error/logic_sequence/before_operator/sass/error +WARNING: This selector doesn't have any properties and won't be rendered. + + , +2 | and (c: d) + | ^^^^^^^^^^ + ' + input.sass 2:3 root stylesheet + +Error: expected selector. + , +2 | and (c: d) + | ^ + ' + input.sass 2:7 root stylesheet + +<===> +================================================================================ +<===> error/logic_sequence/after_operator/sass/input.sass +@media (a: b) and + (c: d) + +<===> error/logic_sequence/after_operator/sass/error +Error: expected media condition in parentheses. + , +1 | @media (a: b) and + | ^ + ' + input.sass 1:18 root stylesheet diff --git a/spec/css/moz_document/whitespace.hrx b/spec/css/moz_document/whitespace.hrx new file mode 100644 index 0000000000..a31300babf --- /dev/null +++ b/spec/css/moz_document/whitespace.hrx @@ -0,0 +1,51 @@ +<===> before_arg/scss/input.scss +@-moz-document + url-prefix(a) {} + +<===> before_arg/scss/output.css +@-moz-document url-prefix(a) {} + +<===> before_arg/scss/warning +DEPRECATION WARNING [moz-document]: @-moz-document is deprecated and support will be removed in Dart Sass 2.0.0. + +For details, see https://sass-lang.com/d/moz-document. + + , +1 | / @-moz-document +2 | \ url-prefix(a) {} + ' + input.scss 1:1 root stylesheet + +<===> +================================================================================ +<===> after_arg/scss/input.scss +@-moz-document url-prefix(a) + {} + +<===> after_arg/scss/output.css +@-moz-document url-prefix(a) {} + +<===> after_arg/scss/warning +DEPRECATION WARNING [moz-document]: @-moz-document is deprecated and support will be removed in Dart Sass 2.0.0. + +For details, see https://sass-lang.com/d/moz-document. + + , +1 | / @-moz-document url-prefix(a) +2 | \ {} + ' + input.scss 1:1 root stylesheet + +<===> +================================================================================ +<===> error/before_arg/sass/input.sass +@-moz-document + url-prefix(a) + +<===> error/before_arg/sass/error +Error: Expected identifier. + , +1 | @-moz-document + | ^ + ' + input.sass 1:15 root stylesheet diff --git a/spec/css/plain/import/whitespace.hrx b/spec/css/plain/import/whitespace.hrx new file mode 100644 index 0000000000..373e634f20 --- /dev/null +++ b/spec/css/plain/import/whitespace.hrx @@ -0,0 +1,222 @@ +<===> error/after_import/sass/input.sass +@import +"a" + +<===> error/after_import/sass/error +DEPRECATION WARNING [import]: Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0. + +More info and automated migrator: https://sass-lang.com/d/import + + , +1 | @import + | ^ + ' + input.sass 1:9 root stylesheet + +WARNING: This selector doesn't have any properties and won't be rendered. + + , +2 | "a" + | ^^^ + ' + input.sass 2:1 root stylesheet + +Error: This file is already being loaded. + , +1 | @import + | ^ + ' + input.sass 1:9 root stylesheet + +<===> +================================================================================ +<===> error/after_import_indented/sass/input.sass +@import + "a" + +<===> error/after_import_indented/sass/error +Error: Nothing may be indented beneath a @import rule. + , +2 | "a" + | ^ + ' + input.sass 2:3 root stylesheet + +<===> +================================================================================ +<===> error/after_identifier/sass/input.sass +@import "a" + b + +<===> error/after_identifier/sass/error +Error: Nothing may be indented beneath a @import rule. + , +2 | b + | ^ + ' + input.sass 2:3 root stylesheet + +<===> +================================================================================ +<===> error/supports/declaration/followed_by_import_arg/after_comma/sass/input.sass +@import "a" supports(b: c), + "d.css" + +<===> error/supports/declaration/followed_by_import_arg/after_comma/sass/error +Error: Nothing may be indented beneath a @import rule. + , +2 | "d.css" + | ^ + ' + input.sass 2:3 root stylesheet + +<===> +================================================================================ +<===> error/supports/condition_function/before_paren/sass/input.sass +@import "a.css" supports(a + (b)) + +<===> error/supports/condition_function/before_paren/sass/error +Error: expected ":". + , +2 | (b)) + | ^ + ' + input.sass 2:6 root stylesheet + +<===> +================================================================================ +<===> error/media/before/sass/input.sass +@import url("a.css") + print + +<===> error/media/before/sass/error +Error: Nothing may be indented beneath a @import rule. + , +2 | print + | ^ + ' + input.sass 2:3 root stylesheet + +<===> +================================================================================ +<===> supports/declaration/prop/after_open/scss/input.scss +@import "a.css" supports( + a: b) + +<===> supports/declaration/prop/after_open/scss/output.css +@import "a.css" supports(a: b); + +<===> +================================================================================ +<===> supports/declaration/prop/after_open/sass/input.sass +@import "a.css" supports( + a: b) + +<===> supports/declaration/prop/after_open/sass/output.css +@import "a.css" supports(a: b); + +<===> +================================================================================ +<===> supports/declaration/prop/space_after_open/scss/input.scss +@import "a.css" supports( a: b) + +<===> supports/declaration/prop/space_after_open/scss/output.css +@import "a.css" supports(a: b); + +<===> +================================================================================ +<===> supports/declaration/prop/space_after_open/sass/input.sass +@import "a.css" supports( a: b) + +<===> supports/declaration/prop/space_after_open/sass/output.css +@import "a.css" supports(a: b); + +<===> +================================================================================ +<===> supports/declaration/prop/after_key/sass/input.sass +@import "a.css" supports(a + : b) + +<===> supports/declaration/prop/after_key/sass/output.css +@import "a.css" supports(a: b); + +<===> +================================================================================ +<===> supports/declaration/prop/after_color/sass/input.sass +@import "a.css" supports(a: + b) + +<===> supports/declaration/prop/after_color/sass/output.css +@import "a.css" supports(a: b); + +<===> +================================================================================ +<===> supports/declaration/prop/after_value/sass/input.sass +@import "a.css" supports(a: b + ) + +<===> supports/declaration/prop/after_value/sass/output.css +@import "a.css" supports(a: b); + +<===> +================================================================================ +<===> supports/condition_and/before_and/sass/input.sass +@import "a.css" supports((a: b) + and (c: d)) + +<===> supports/condition_and/before_and/sass/output.css +@import "a.css" supports((a: b) and (c: d)); + +<===> +================================================================================ +<===> supports/condition_and/after_and/sass/input.sass +@import "a.css" supports((a: b) and + (c: d)) + +<===> supports/condition_and/after_and/sass/output.css +@import "a.css" supports((a: b) and (c: d)); + +<===> +================================================================================ +<===> supports/condition_function/after_paren/sass/input.sass +@import "a.css" supports(a( + b)) + +<===> supports/condition_function/after_paren/sass/output.css +@import "a.css" supports(a( b)); + +<===> +================================================================================ +<===> supports/condition_function/before_end_paren/sass/input.sass +@import "a.css" supports(a(b + )) + +<===> supports/condition_function/before_end_paren/sass/output.css +@import "a.css" supports(a(b )); + +<===> +================================================================================ +<===> supports/condition_negation/after_not/sass/input.sass +@import "a.css" supports(not + (a: b)) + +<===> supports/condition_negation/after_not/sass/output.css +@import "a.css" supports(not (a: b)); + +<===> +================================================================================ +<===> supports/condition_negation/before_not/sass/input.sass +@import "a.css" supports( + not (a: b)) + +<===> supports/condition_negation/before_not/sass/output.css +@import "a.css" supports(not (a: b)); + +<===> +================================================================================ +<===> supports/calc/sass/input.sass +@import "a.css" supports(calc(1)); + +<===> supports/calc/sass/output.css +@import "a.css" supports(calc(1)); diff --git a/spec/css/selector/attribute.hrx b/spec/css/selector/attribute.hrx index 5268b27809..70bfb0a9c7 100644 --- a/spec/css/selector/attribute.hrx +++ b/spec/css/selector/attribute.hrx @@ -78,6 +78,114 @@ a: b; } +<===> +================================================================================ +<===> sass/whitespace/after_lbracket/input.sass +a[ + b] + c: d + +<===> sass/whitespace/after_lbracket/output.css +a[b] { + c: d; +} + +<===> +================================================================================ +<===> sass/whitespace/after_lbracket_indented/input.sass +a[ + b] + c: d + +<===> sass/whitespace/after_lbracket_indented/output.css +a[b] { + c: d; +} + +<===> +================================================================================ +<===> sass/whitespace/after_val/input.sass +a[b + ] + c: d + +<===> sass/whitespace/after_val/output.css +a[b] { + c: d; +} + +<===> +================================================================================ +<===> sass/whitespace/before_operator/input.sass +a[b + =c] + d: e + +<===> sass/whitespace/before_operator/output.css +a[b=c] { + d: e; +} + +<===> +================================================================================ +<===> sass/whitespace/after_operator/input.sass +a[b= + c] + d: e + +<===> sass/whitespace/after_operator/output.css +a[b=c] { + d: e; +} + +<===> +================================================================================ +<===> scss/whitespace/after_lbracket/input.scss +a[ + b] + {c: d} + +<===> scss/whitespace/after_lbracket/output.css +a[b] { + c: d; +} + +<===> +================================================================================ +<===> scss/whitespace/after_val/input.scss +a[b + ] + {c: d} + +<===> scss/whitespace/after_val/output.css +a[b] { + c: d; +} + +<===> +================================================================================ +<===> scss/whitespace/before_operator/input.scss +a[b + =c] + {d: e} + +<===> scss/whitespace/before_operator/output.css +a[b=c] { + d: e; +} + +<===> +================================================================================ +<===> scss/whitespace/after_operator/input.scss +a[b= + c] + {d: e} + +<===> scss/whitespace/after_operator/output.css +a[b=c] { + d: e; +} + <===> ================================================================================ <===> error/modifier/no_operator/input.scss diff --git a/spec/css/selector/combinator/newline.hrx b/spec/css/selector/combinator/newline.hrx new file mode 100644 index 0000000000..67f7001e14 --- /dev/null +++ b/spec/css/selector/combinator/newline.hrx @@ -0,0 +1,156 @@ +<===> child/before/input.sass +a +> b + c: d + +<===> child/before/output.css +> b { + c: d; +} + +<===> child/before/warning +WARNING: This selector doesn't have any properties and won't be rendered. + + , +1 | a + | ^^ + ' + input.sass 1:1 root stylesheet + +DEPRECATION WARNING [bogus-combinators]: The selector "> b" is invalid CSS. +This will be an error in Dart Sass 2.0.0. + +More info: https://sass-lang.com/d/bogus-combinators + + , +2 | > b + | ^^^ + ' + input.sass 2:1 root stylesheet + +<===> +================================================================================ +<===> child/after/input.sass +a > +b + c: d + +<===> child/after/output.css +b { + c: d; +} + +<===> child/after/warning +WARNING: This selector doesn't have any properties and won't be rendered. + + , +1 | a > + | ^^^ + ' + input.sass 1:1 root stylesheet + +<===> +================================================================================ +<===> next_sibling/before/input.sass +a ++ b + c: d + +<===> next_sibling/before/output.css ++ b { + c: d; +} + +<===> next_sibling/before/warning +WARNING: This selector doesn't have any properties and won't be rendered. + + , +1 | a + | ^^ + ' + input.sass 1:1 root stylesheet + +DEPRECATION WARNING [bogus-combinators]: The selector "+ b" is invalid CSS. +This will be an error in Dart Sass 2.0.0. + +More info: https://sass-lang.com/d/bogus-combinators + + , +2 | + b + | ^^^ + ' + input.sass 2:1 root stylesheet + +<===> +================================================================================ +<===> next_sibling/after/input.sass +a + +b + c: d + +<===> next_sibling/after/output.css +b { + c: d; +} + +<===> next_sibling/after/warning +WARNING: This selector doesn't have any properties and won't be rendered. + + , +1 | a + + | ^^^ + ' + input.sass 1:1 root stylesheet + +<===> +================================================================================ +<===> subsequent_sibling/before/input.sass +a +~ b + c: d + +<===> subsequent_sibling/before/output.css +~ b { + c: d; +} + +<===> subsequent_sibling/before/warning +WARNING: This selector doesn't have any properties and won't be rendered. + + , +1 | a + | ^^ + ' + input.sass 1:1 root stylesheet + +DEPRECATION WARNING [bogus-combinators]: The selector "~ b" is invalid CSS. +This will be an error in Dart Sass 2.0.0. + +More info: https://sass-lang.com/d/bogus-combinators + + , +2 | ~ b + | ^^^ + ' + input.sass 2:1 root stylesheet + +<===> +================================================================================ +<===> subsequent_sibling/after/input.sass +a ~ +b + c: d + +<===> subsequent_sibling/after/output.css +b { + c: d; +} + +<===> subsequent_sibling/after/warning +WARNING: This selector doesn't have any properties and won't be rendered. + + , +1 | a ~ + | ^^^ + ' + input.sass 1:1 root stylesheet diff --git a/spec/css/selector/placeholder.hrx b/spec/css/selector/placeholder.hrx index 0e038ae008..b97117d83d 100644 --- a/spec/css/selector/placeholder.hrx +++ b/spec/css/selector/placeholder.hrx @@ -38,10 +38,6 @@ a:where(c) { <===> ================================================================================ -<===> pseudoselectors/where/nesting/options.yml -:todo: - - sass/dart-sass#1451 - <===> pseudoselectors/where/nesting/input.scss a { :where(&) { diff --git a/spec/css/selector/pseudoselector.hrx b/spec/css/selector/pseudoselector.hrx index 2507c523cb..0a13daba75 100644 --- a/spec/css/selector/pseudoselector.hrx +++ b/spec/css/selector/pseudoselector.hrx @@ -8,3 +8,53 @@ a { a b:c, a > d { x: y; } + +<===> +================================================================================ +<===> whitespace/sass/before_param/input.sass +a:b( + c) + d: e + +<===> whitespace/sass/before_param/output.css +a:b(c) { + d: e; +} + +<===> +================================================================================ +<===> whitespace/sass/after_param/input.sass +a:b(c + ) + d: e + +<===> whitespace/sass/after_param/output.css +a:b(c) { + d: e; +} + +<===> +================================================================================ +<===> with_attribute/sass/input.sass +a:b([c]) + d: e + +<===> with_attribute/sass/output.css +a:b([c]) { + d: e; +} + +<===> +================================================================================ +<===> error/with_attribute_mismatched/sass/input.scss +a:b([c)]{ + d: e; +} + +<===> error/with_attribute_mismatched/sass/error +Error: expected "]". + , +1 | a:b([c)]{ + | ^ + ' + input.scss 1:7 root stylesheet diff --git a/spec/css/style_rule.hrx b/spec/css/style_rule.hrx index 10b04b8617..4d15ce6ddf 100644 --- a/spec/css/style_rule.hrx +++ b/spec/css/style_rule.hrx @@ -331,3 +331,124 @@ a {b: c // a { b: c; } + +<===> +================================================================================ +<===> sass/declaration/semicolon/input.sass +a + b: c; + + +<===> sass/declaration/semicolon/output.css +a { + b: c; +} + +<===> +================================================================================ +<===> sass/multiple/cr/input.sass +a + b: c; + d: e; + +<===> sass/multiple/cr/output.css +a { + b: c; + d: e; +} + +<===> +================================================================================ +<===> sass/multiple/ff/input.sass +a + b: c; + d: e; + +<===> sass/multiple/ff/output.css +a { + b: c; + d: e; +} + +<===> +================================================================================ +<===> sass/trailing_whitespace/input.sass +a + b: c; + d: e; + +<===> sass/trailing_whitespace/output.css +a { + b: c; + d: e; +} + +<===> +================================================================================ +<===> sass/preceding_whitespace/input.sass +a + b: c ; + d: e; + +<===> sass/preceding_whitespace/output.css +a { + b: c; + d: e; +} + +<===> +================================================================================ +<===> sass/trailing_comment/input.sass +a + b: c; // f + d: e; + +<===> sass/trailing_comment/output.css +a { + b: c; + d: e; +} + +<===> +================================================================================ +<===> sass/trailing_inline_comment/input.sass +a + b: c; /* f */ + d: e; + +<===> sass/trailing_inline_comment/output.css +a { + b: c; + d: e; +} + +<===> +================================================================================ +<===> sass/trailing_loud_comment/input.sass +a + b: c; + /* f */ + d: e; + +<===> sass/trailing_loud_comment/output.css +a { + b: c; + /* f */ + d: e; +} + +<===> +================================================================================ +<===> sass/nested/input.sass +a + b: c; + d + e: f; + +<===> sass/nested/output.css +a { + b: c; +} +a d { + e: f; +} diff --git a/spec/css/supports/whitespace.hrx b/spec/css/supports/whitespace.hrx new file mode 100644 index 0000000000..ab621531e7 --- /dev/null +++ b/spec/css/supports/whitespace.hrx @@ -0,0 +1,473 @@ +<===> before_query/scss/input.scss +@supports + (a: b) {c {d: e}} + +<===> before_query/scss/output.css +@supports (a: b) { + c { + d: e; + } +} + +<===> +================================================================================ +<===> declaration/normal_prop/after_open_paren/scss/input.scss +@supports ( + a: b) {c {d: e}} + +<===> declaration/normal_prop/after_open_paren/scss/output.css +@supports (a: b) { + c { + d: e; + } +} + +<===> +================================================================================ +<===> declaration/normal_prop/after_open_paren/sass/input.sass +@supports ( + a: b) + c + d: e + +<===> declaration/normal_prop/after_open_paren/sass/output.css +@supports (a: b) { + c { + d: e; + } +} + +<===> +================================================================================ +<===> declaration/normal_prop/before_colon/scss/input.scss +@supports (a + : b) {c {d: e}} + +<===> declaration/normal_prop/before_colon/scss/output.css +@supports (a: b) { + c { + d: e; + } +} + +<===> +================================================================================ +<===> declaration/normal_prop/before_colon/sass/input.sass +@supports (a + : b) + c + d: e + +<===> declaration/normal_prop/before_colon/sass/output.css +@supports (a: b) { + c { + d: e; + } +} + +<===> +================================================================================ +<===> declaration/normal_prop/after_colon/scss/input.scss +@supports (a: + b) {c {d: e}} + +<===> declaration/normal_prop/after_colon/scss/output.css +@supports (a: b) { + c { + d: e; + } +} + +<===> +================================================================================ +<===> declaration/normal_prop/after_colon/sass/input.sass +@supports (a: + b) + c + d: e + +<===> declaration/normal_prop/after_colon/sass/output.css +@supports (a: b) { + c { + d: e; + } +} + +<===> +================================================================================ +<===> declaration/normal_prop/before_close_paren/scss/input.scss +@supports (a: b + ) {c {d: e}} + +<===> declaration/normal_prop/before_close_paren/scss/output.css +@supports (a: b) { + c { + d: e; + } +} + +<===> +================================================================================ +<===> declaration/normal_prop/before_close_paren/sass/input.sass +@supports (a: b + ) + c + d: e + +<===> declaration/normal_prop/before_close_paren/sass/output.css +@supports (a: b) { + c { + d: e; + } +} + +<===> +================================================================================ +<===> function/after_open_paren/scss/input.scss +@supports a( + b) {c {d: e}} + +<===> function/after_open_paren/scss/output.css +@supports a( + b) { + c { + d: e; + } +} + +<===> +================================================================================ +<===> function/after_open_paren/sass/input.sass +@supports a( + b) + c + d: e + +<===> function/after_open_paren/sass/output.css +@supports a( + b) { + c { + d: e; + } +} + +<===> +================================================================================ +<===> function/before_close_paren/scss/input.scss +@supports a(b + ) {c {d: e}} + +<===> function/before_close_paren/scss/output.css +@supports a(b + ) { + c { + d: e; + } +} + +<===> +================================================================================ +<===> function/before_close_paren/sass/input.sass +@supports a(b + ) + c + d: e + +<===> function/before_close_paren/sass/output.css +@supports a(b + ) { + c { + d: e; + } +} + +<===> +================================================================================ +<===> anything/after_open_paren/scss/input.scss +@supports ( + a b) {c {d: e}} + +<===> anything/after_open_paren/scss/output.css +@supports (a b) { + c { + d: e; + } +} + +<===> +================================================================================ +<===> anything/after_open_paren/sass/input.sass +@supports ( + a b) + c + d: e + +<===> anything/after_open_paren/sass/output.css +@supports (a b) { + c { + d: e; + } +} + +<===> +================================================================================ +<===> anything/after_not_in_paren/sass/input.sass +@supports (not + (a)) + b + c: d + +<===> anything/after_not_in_paren/sass/output.css +@supports not (a) { + b { + c: d; + } +} + +<===> +================================================================================ +<===> anything/after_ident/scss/input.scss +@supports (a + b) {c {d: e}} + +<===> anything/after_ident/scss/output.css +@supports (a + b) { + c { + d: e; + } +} + +<===> +================================================================================ +<===> anything/after_ident/sass/input.sass +@supports (a + b) + c + d: e + +<===> anything/after_ident/sass/output.css +@supports (a + b) { + c { + d: e; + } +} + +<===> +================================================================================ +<===> anything/before_close_paren/scss/input.scss +@supports (a b + ) {c {d: e}} + +<===> anything/before_close_paren/scss/output.css +@supports (a b + ) { + c { + d: e; + } +} + +<===> +================================================================================ +<===> anything/before_close_paren/sass/input.sass +@supports (a b + ) + c + d: e + +<===> anything/before_close_paren/sass/output.css +@supports (a b + ) { + c { + d: e; + } +} + +<===> +================================================================================ +<===> after_query/scss/input.scss +@supports (a: b) + {c {d: e}} + +<===> after_query/scss/output.css +@supports (a: b) { + c { + d: e; + } +} + +<===> +================================================================================ +<===> negation/after_not_in_paren/sass/input.sass +@supports (not + (a)) + b + c: d + +<===> negation/after_not_in_paren/sass/output.css +@supports not (a) { + b { + c: d; + } +} + +<===> +================================================================================ +<===> multi_conditions/after_and_in_paren/sass/input.sass +@supports ((a) and + (b)) + c + d: e + +<===> multi_conditions/after_and_in_paren/sass/output.css +@supports (a) and (b) { + c { + d: e; + } +} + +<===> +================================================================================ +<===> interpolation/paren/before_operator/input.sass +@supports (#{"(a: b)"} + and (c: d)) + @d + +<===> interpolation/paren/before_operator/output.css +@supports (a: b) and (c: d) { + @d; +} + +<===> +================================================================================ +<===> interpolation/paren/after_operator/input.sass +@supports (#{"(a: b)"} and + (c: d)) + @d + +<===> interpolation/paren/after_operator/output.css +@supports (a: b) and (c: d) { + @d; +} + +<===> +================================================================================ +<===> interpolation/paren/after_second/input.sass +@supports (#{"(a: b)"} and (c: d) + and (e: f)) + @d + +<===> interpolation/paren/after_second/output.css +@supports (a: b) and (c: d) and (e: f) { + @d; +} + +<===> +================================================================================ +<===> error/before_query/sass/input.sass +@supports + (a: b) + c + d: e + +<===> error/before_query/sass/error +Error: expected "(". + , +1 | @supports + | ^ + ' + input.sass 1:10 root stylesheet + +<===> +================================================================================ +<===> error/interpolation/no_paren/before_operator/input.sass +@supports #{"(a: b)"} + and (c: d) + @d + +<===> error/interpolation/no_paren/before_operator/error +Error: expected selector. + , +2 | and (c: d) + | ^ + ' + input.sass 2:7 root stylesheet + +<===> +================================================================================ +<===> error/interpolation/no_paren/after_second/input.sass +@supports #{"(a: b)"} and (c: d) + and (e: f) + @d + +<===> error/interpolation/no_paren/after_second/error +Error: expected selector. + , +2 | and (e: f) + | ^ + ' + input.sass 2:7 root stylesheet + +<===> +================================================================================ +<===> error/interpolation/no_paren/after_operator/input.sass +@supports #{"(a: b)"} and + (c: d) + @d + +<===> error/interpolation/no_paren/after_operator/error +Error: expected "(". + , +1 | @supports #{"(a: b)"} and + | ^ + ' + input.sass 1:26 root stylesheet + +<===> +================================================================================ +<===> error/multi_conditions/before_and/sass/input.sass +@supports (a) + and (b) + c + d: e + +<===> error/multi_conditions/before_and/sass/error +Error: expected selector. + , +2 | and (b) + | ^ + ' + input.sass 2:6 root stylesheet + +<===> +================================================================================ +<===> error/multi_conditions/after_and/sass/input.sass +@supports (a) and + (b) + c + d: e + +<===> error/multi_conditions/after_and/sass/error +Error: expected "(". + , +1 | @supports (a) and + | ^ + ' + input.sass 1:18 root stylesheet + +<===> +================================================================================ +<===> error/negation/after_not/sass/input.sass +@supports not + (a) + b + c: d + +<===> error/negation/after_not/sass/error +Error: expected "(". + , +1 | @supports not + | ^ + ' + input.sass 1:14 root stylesheet diff --git a/spec/css/unknown_directive/semicolon.hrx b/spec/css/unknown_directive/semicolon.hrx new file mode 100644 index 0000000000..cf7b29bec2 --- /dev/null +++ b/spec/css/unknown_directive/semicolon.hrx @@ -0,0 +1,5 @@ +<===> sass/input.sass +@a b; + +<===> sass/output.css +@a b; diff --git a/spec/css/unknown_directive/whitespace.hrx b/spec/css/unknown_directive/whitespace.hrx new file mode 100644 index 0000000000..dd0ac0b786 --- /dev/null +++ b/spec/css/unknown_directive/whitespace.hrx @@ -0,0 +1,66 @@ +<===> no_children/before_value/scss/input.scss +@a + b + +<===> no_children/before_value/scss/output.css +@a b; + +<===> +================================================================================ +<===> no_children/before_value/sass/input.sass +@a + b + +<===> no_children/before_value/sass/output.css +@a {} + +<===> no_children/before_value/sass/warning +WARNING: This selector doesn't have any properties and won't be rendered. + + , +2 | b + | ^ + ' + input.sass 2:3 root stylesheet + +<===> +================================================================================ +<===> children/before_value/sass/input.sass +@a + b + c: d + +<===> children/before_value/sass/output.css +@a { + b { + c: d; + } +} + +<===> +================================================================================ +<===> children/before_value/scss/input.scss +@a + b {} + +<===> children/before_value/scss/output.css +@a b {} + +<===> +================================================================================ +<===> children/no_value/scss/input.scss +@a + {} + +<===> children/no_value/scss/output.css +@a {} + +<===> +================================================================================ +<===> children/no_value/sass/input.sass +@a + c: d +<===> children/no_value/sass/output.css +@a { + c: d; +} diff --git a/spec/directives/at_root.hrx b/spec/directives/at_root.hrx deleted file mode 100644 index f2a3dabb96..0000000000 --- a/spec/directives/at_root.hrx +++ /dev/null @@ -1,274 +0,0 @@ -<===> sass/empty/no_query/input.sass -@at-root - -<===> sass/empty/no_query/output.css - -<===> -================================================================================ -<===> sass/empty/query/input.sass -@at-root (with: rule) - -<===> sass/empty/query/output.css - -<===> -================================================================================ -<===> sass/empty/selector/input.sass -@at-root a - -<===> sass/empty/selector/output.css - -<===> sass/empty/selector/warning -WARNING: This selector doesn't have any properties and won't be rendered. - - , -1 | @at-root a - | ^ - ' - input.sass 1:10 root stylesheet - -<===> -================================================================================ -<===> keyframes/all/input.scss -@keyframes a { - @at-root (without: all) { - b {c: d} - } -} - -<===> keyframes/all/output.css -@keyframes a {} -b { - c: d; -} - -<===> -================================================================================ -<===> property_only/input.scss -@media print { - a { - @at-root (without: media) { - b: c; - } - } -} - -<===> property_only/output.css -a { - b: c; -} - -<===> -================================================================================ -<===> nested_import/with_no_use/input.scss -a { - @import "other"; -} - -<===> nested_import/with_no_use/other.scss -@at-root { - b { - c: d; - } -} - -<===> nested_import/with_no_use/output.css -b { - c: d; -} - -<===> nested_import/with_no_use/warning -DEPRECATION WARNING [import]: Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0. - -More info and automated migrator: https://sass-lang.com/d/import - - , -2 | @import "other"; - | ^^^^^^^ - ' - input.scss 2:11 root stylesheet - -<===> -================================================================================ -<===> nested_import/with_builtin_use/input.scss -a { - @import "other"; -} - -<===> nested_import/with_builtin_use/other.scss -@use "sass:math"; - -@at-root { - b { - c: d; - } -} - -<===> nested_import/with_builtin_use/output.css -b { - c: d; -} - -<===> nested_import/with_builtin_use/warning -DEPRECATION WARNING [import]: Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0. - -More info and automated migrator: https://sass-lang.com/d/import - - , -2 | @import "other"; - | ^^^^^^^ - ' - input.scss 2:11 root stylesheet - -<===> -================================================================================ -<===> nested_import/with_user_use/options.yml -:todo: - - sass/dart-sass#1347 - -<===> nested_import/with_user_use/input.scss -a { - @import "other"; -} - -<===> nested_import/with_user_use/other.scss -@use "used"; - -@at-root { - b { - c: d; - } -} - -<===> nested_import/with_user_use/used.scss -// nothing - -<===> nested_import/with_user_use/output.css -b { - c: d; -} - -<===> -================================================================================ -<===> load_css/input.scss -@use "sass:meta"; - -a { - @include meta.load-css("other"); -} - -<===> load_css/other.scss -@at-root { - b { - c: d; - } -} - -<===> load_css/output.css -a b { - c: d; -} - -<===> -================================================================================ -<===> comment/before_query/loud/input.scss -@at-root /**/ (without: media) {} - -<===> comment/before_query/loud/output.css - -<===> -================================================================================ -<===> comment/before_query/silent/input.scss -@at-root // - (without: media) {} - -<===> comment/before_query/silent/output.css - -<===> -================================================================================ -<===> comment/after_open_paren/loud/input.scss -@at-root (/**/ without: media) {} - -<===> comment/after_open_paren/loud/output.css - -<===> -================================================================================ -<===> comment/after_open_paren/silent/input.scss -@at-root (// - without: media) {} - -<===> comment/after_open_paren/silent/output.css - -<===> -================================================================================ -<===> comment/before_colon/loud/input.scss -@at-root (without /**/ : media) {} - -<===> comment/before_colon/loud/output.css - -<===> -================================================================================ -<===> comment/before_colon/silent/input.scss -@at-root (without // - : media) {} - -<===> comment/before_colon/silent/output.css - -<===> -================================================================================ -<===> comment/after_colon/loud/input.scss -@at-root (without: /**/ media) {} - -<===> comment/after_colon/loud/output.css - -<===> -================================================================================ -<===> comment/after_colon/silent/input.scss -@at-root (without: // - media) {} - -<===> comment/after_colon/silent/output.css - -<===> -================================================================================ -<===> comment/before_close_paren/loud/input.scss -@at-root (without: media /**/) {} - -<===> comment/before_close_paren/loud/output.css - -<===> -================================================================================ -<===> comment/before_close_paren/silent/input.scss -@at-root (without: media // - ) {} - -<===> comment/before_close_paren/silent/output.css - -<===> -================================================================================ -<===> comment/after_query/loud/input.scss -@at-root (without: media) /**/ {} - -<===> comment/after_query/loud/output.css - -<===> -================================================================================ -<===> comment/after_query/silent/input.scss -@at-root (without: media) // - {} - -<===> comment/after_query/silent/output.css - -<===> -================================================================================ -<===> comment/no_query/loud/input.scss -@at-root /**/ {} - -<===> comment/no_query/loud/output.css - -<===> -================================================================================ -<===> comment/no_query/silent/input.scss -@at-root // - {} - -<===> comment/no_query/silent/output.css diff --git a/spec/directives/at_root/comment.hrx b/spec/directives/at_root/comment.hrx new file mode 100644 index 0000000000..d829eee408 --- /dev/null +++ b/spec/directives/at_root/comment.hrx @@ -0,0 +1,102 @@ +<===> before_query/loud/input.scss +@at-root /**/ (without: media) {} + +<===> before_query/loud/output.css + +<===> +================================================================================ +<===> before_query/silent/input.scss +@at-root // + (without: media) {} + +<===> before_query/silent/output.css + +<===> +================================================================================ +<===> after_open_paren/loud/input.scss +@at-root (/**/ without: media) {} + +<===> after_open_paren/loud/output.css + +<===> +================================================================================ +<===> after_open_paren/silent/input.scss +@at-root (// + without: media) {} + +<===> after_open_paren/silent/output.css + +<===> +================================================================================ +<===> before_colon/loud/input.scss +@at-root (without /**/ : media) {} + +<===> before_colon/loud/output.css + +<===> +================================================================================ +<===> before_colon/silent/input.scss +@at-root (without // + : media) {} + +<===> before_colon/silent/output.css + +<===> +================================================================================ +<===> after_colon/loud/input.scss +@at-root (without: /**/ media) {} + +<===> after_colon/loud/output.css + +<===> +================================================================================ +<===> after_colon/silent/input.scss +@at-root (without: // + media) {} + +<===> after_colon/silent/output.css + +<===> +================================================================================ +<===> before_close_paren/loud/input.scss +@at-root (without: media /**/) {} + +<===> before_close_paren/loud/output.css + +<===> +================================================================================ +<===> before_close_paren/silent/input.scss +@at-root (without: media // + ) {} + +<===> before_close_paren/silent/output.css + +<===> +================================================================================ +<===> after_query/loud/input.scss +@at-root (without: media) /**/ {} + +<===> after_query/loud/output.css + +<===> +================================================================================ +<===> after_query/silent/input.scss +@at-root (without: media) // + {} + +<===> after_query/silent/output.css + +<===> +================================================================================ +<===> no_query/loud/input.scss +@at-root /**/ {} + +<===> no_query/loud/output.css + +<===> +================================================================================ +<===> no_query/silent/input.scss +@at-root // + {} + +<===> no_query/silent/output.css diff --git a/spec/directives/at_root/keyframes.hrx b/spec/directives/at_root/keyframes.hrx new file mode 100644 index 0000000000..5c37ca2858 --- /dev/null +++ b/spec/directives/at_root/keyframes.hrx @@ -0,0 +1,12 @@ +<===> all/input.scss +@keyframes a { + @at-root (without: all) { + b {c: d} + } +} + +<===> all/output.css +@keyframes a {} +b { + c: d; +} diff --git a/spec/directives/at_root/load_css.hrx b/spec/directives/at_root/load_css.hrx new file mode 100644 index 0000000000..c88f0b3389 --- /dev/null +++ b/spec/directives/at_root/load_css.hrx @@ -0,0 +1,18 @@ +<===> input.scss +@use "sass:meta"; + +a { + @include meta.load-css("other"); +} + +<===> other.scss +@at-root { + b { + c: d; + } +} + +<===> output.css +a b { + c: d; +} diff --git a/spec/directives/at_root/nested_import.hrx b/spec/directives/at_root/nested_import.hrx new file mode 100644 index 0000000000..a633f30457 --- /dev/null +++ b/spec/directives/at_root/nested_import.hrx @@ -0,0 +1,87 @@ +<===> with_no_use/input.scss +a { + @import "other"; +} + +<===> with_no_use/other.scss +@at-root { + b { + c: d; + } +} + +<===> with_no_use/output.css +b { + c: d; +} + +<===> with_no_use/warning +DEPRECATION WARNING [import]: Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0. + +More info and automated migrator: https://sass-lang.com/d/import + + , +2 | @import "other"; + | ^^^^^^^ + ' + input.scss 2:11 root stylesheet + +<===> +================================================================================ +<===> with_builtin_use/input.scss +a { + @import "other"; +} + +<===> with_builtin_use/other.scss +@use "sass:math"; + +@at-root { + b { + c: d; + } +} + +<===> with_builtin_use/output.css +b { + c: d; +} + +<===> with_builtin_use/warning +DEPRECATION WARNING [import]: Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0. + +More info and automated migrator: https://sass-lang.com/d/import + + , +2 | @import "other"; + | ^^^^^^^ + ' + input.scss 2:11 root stylesheet + +<===> +================================================================================ +<===> with_user_use/options.yml +:todo: + - sass/dart-sass#1347 + +<===> with_user_use/input.scss +a { + @import "other"; +} + +<===> with_user_use/other.scss +@use "used"; + +@at-root { + b { + c: d; + } +} + +<===> with_user_use/used.scss +// nothing + +<===> with_user_use/output.css +b { + c: d; +} diff --git a/spec/directives/at_root/property_only.hrx b/spec/directives/at_root/property_only.hrx new file mode 100644 index 0000000000..3c841d1fdd --- /dev/null +++ b/spec/directives/at_root/property_only.hrx @@ -0,0 +1,13 @@ +<===> input.scss +@media print { + a { + @at-root (without: media) { + b: c; + } + } +} + +<===> output.css +a { + b: c; +} diff --git a/spec/directives/at_root/sass.hrx b/spec/directives/at_root/sass.hrx new file mode 100644 index 0000000000..6cc5529fbb --- /dev/null +++ b/spec/directives/at_root/sass.hrx @@ -0,0 +1,27 @@ +<===> empty/no_query/input.sass +@at-root + +<===> empty/no_query/output.css + +<===> +================================================================================ +<===> empty/query/input.sass +@at-root (with: rule) + +<===> empty/query/output.css + +<===> +================================================================================ +<===> empty/selector/input.sass +@at-root a + +<===> empty/selector/output.css + +<===> empty/selector/warning +WARNING: This selector doesn't have any properties and won't be rendered. + + , +1 | @at-root a + | ^ + ' + input.sass 1:10 root stylesheet diff --git a/spec/directives/at_root/whitespace.hrx b/spec/directives/at_root/whitespace.hrx new file mode 100644 index 0000000000..9adc1e728c --- /dev/null +++ b/spec/directives/at_root/whitespace.hrx @@ -0,0 +1,120 @@ +<===> before_query/scss/input.scss +@at-root + (without: media) {} + +<===> before_query/scss/output.css + +<===> +================================================================================ +<===> after_open_paren/scss/input.scss +@at-root ( + without: media) {} + +<===> after_open_paren/scss/output.css + +<===> +================================================================================ +<===> after_open_paren/sass/input.sass +@at-root ( + without: media) + +<===> after_open_paren/sass/output.css + +<===> +================================================================================ +<===> before_colon/scss/input.scss +@at-root (without + : media) {} + +<===> before_colon/scss/output.css + +<===> +================================================================================ +<===> before_colon/sass/input.sass +@at-root (without + : media) + +<===> before_colon/sass/output.css + +<===> +================================================================================ +<===> after_colon/scss/input.scss +@at-root (without: + media) {} + +<===> after_colon/scss/output.css + +<===> +================================================================================ +<===> after_colon/sass/input.sass +@at-root (without: + media) + +<===> after_colon/sass/output.css + +<===> +================================================================================ +<===> before_close_paren/scss/input.scss +@at-root (without: media + ) {} + +<===> before_close_paren/scss/output.css + +<===> +================================================================================ +<===> before_close_paren/sass/input.sass +@at-root (without: media + ) + +<===> before_close_paren/sass/output.css + +<===> +================================================================================ +<===> after_query/scss/input.scss +@at-root (without: media) + {} + +<===> after_query/scss/output.css + +<===> +================================================================================ +<===> no_query/scss/input.scss +@at-root + {} + +<===> no_query/scss/output.css + +<===> +================================================================================ +<===> no_query/sass/input.sass +a + @at-root + b + c: d + +<===> no_query/sass/output.css +b { + c: d; +} + +<===> +================================================================================ +<===> error/before_query/sass/input.sass +@at-root + (without: media) + +<===> error/before_query/sass/error +WARNING: This selector doesn't have any properties and won't be rendered. + + , +2 | (without: media) + | ^^^^^^^^^^^^^^^^ + ' + input.sass 2:3 root stylesheet + +Error: expected selector. + , +1 | @at-root + | ^ + ' + input.sass 1:9 root stylesheet diff --git a/spec/directives/debug.hrx b/spec/directives/debug.hrx new file mode 100644 index 0000000000..434d2ed6d7 --- /dev/null +++ b/spec/directives/debug.hrx @@ -0,0 +1,18 @@ +<===> sass/semicolon/input.sass +@debug a; + +<===> sass/semicolon/output.css + +<===> sass/semicolon/warning +input.sass:1 DEBUG: a + +<===> +================================================================================ +<===> sass/multiline-after/input.sass +@debug +a + +<===> sass/multiline-after/output.css + +<===> sass/multiline-after/warning +input.sass:1 DEBUG: a diff --git a/spec/directives/each.hrx b/spec/directives/each.hrx index e03457f53c..c038564306 100644 --- a/spec/directives/each.hrx +++ b/spec/directives/each.hrx @@ -1,5 +1,4 @@ <===> sass/inline/input.sass - @each $a in b, c .#{$a} d: $a @@ -15,82 +14,134 @@ <===> ================================================================================ -<===> error/sass/multiline/after-each/input.sass - +<===> sass/multiline/after_each/input.sass @each $a in b, c .#{$a} d: $a -<===> error/sass/multiline/after-each/error -Error: expected "$". - , -2 | @each - | ^ - ' - input.sass 2:6 root stylesheet +<===> sass/multiline/after_each/output.css +.b { + d: b; +} + +.c { + d: c; +} <===> ================================================================================ -<===> error/sass/multiline/after-variable/input.sass - +<===> sass/multiline/after_variable/input.sass @each $a in b, c .#{$a} d: $a -<===> error/sass/multiline/after-variable/error -Error: Expected "in". - , -2 | @each $a - | ^ - ' - input.sass 2:10 root stylesheet +<===> sass/multiline/after_variable/output.css +.b { + d: b; +} + +.c { + d: c; +} <===> ================================================================================ -<===> error/sass/multiline/after-in/input.sass - +<===> sass/multiline/after_in/input.sass @each $a in b, c .#{$a} d: $a -<===> error/sass/multiline/after-in/error -Error: Expected expression. - , -2 | @each $a in - | ^ - ' - input.sass 2:12 root stylesheet +<===> sass/multiline/after_in/output.css +.b { + d: b; +} + +.c { + d: c; +} <===> ================================================================================ -<===> error/sass/multiline/in-expression/input.sass +<===> sass/multiline/in_expression/input.sass @each $a in b, c .#{$a} d: $a -<===> error/sass/multiline/in-expression/output.css +<===> sass/multiline/in_expression/output.css c .b { d: b; } <===> ================================================================================ -<===> error/sass/multiline/in-wrapped-expression/input.sass - +<===> sass/multiline/in_wrapped_expression/input.sass @each $a in (b, c) .#{$a} d: $a -<===> error/sass/multiline/in-wrapped-expression/error -Error: expected ")". - , -2 | @each $a in (b, - | ^ - ' - input.sass 2:16 root stylesheet +<===> sass/multiline/in_wrapped_expression/output.css +.b { + d: b; +} + +.c { + d: c; +} + +<===> +================================================================================ +<===> sass/destructured/multiline/after_first/input.sass +@each $a + , $b in (c: d) + .#{$a} + e: $b + +<===> sass/destructured/multiline/after_first/output.css +.c { + e: d; +} + +<===> +================================================================================ +<===> sass/destructured/multiline/after_comma/input.sass +@each $a, + $b in (c: d) + .#{$a} + e: $b + +<===> sass/destructured/multiline/after_comma/output.css +.c { + e: d; +} + +<===> +================================================================================ +<===> sass/destructured/multiline/after_second/input.sass +@each $a, $b + in (c: d) + .#{$a} + e: $b + +<===> sass/destructured/multiline/after_second/output.css +.c { + e: d; +} + +<===> +================================================================================ +<===> sass/destructured/multiline/before_third/input.sass +@each $a, $b + ,$c in (d: e) + .#{$a} + f: $b + +<===> sass/destructured/multiline/before_third/output.css +.d { + f: e; +} diff --git a/spec/directives/error.hrx b/spec/directives/error.hrx new file mode 100644 index 0000000000..d78500e2f8 --- /dev/null +++ b/spec/directives/error.hrx @@ -0,0 +1,37 @@ +<===> sass/semicolon/input.sass +@error a; + +<===> sass/semicolon/error +Error: a + , +1 | @error a; + | ^^^^^^^^ + ' + input.sass 1:1 root stylesheet + +<===> +================================================================================ +<===> sass/semicolon_comment/input.sass +@error a; // b + +<===> sass/semicolon_comment/error +Error: a + , +1 | @error a; // b + | ^^^^^^^^ + ' + input.sass 1:1 root stylesheet + +<===> +================================================================================ +<===> sass/multiline_after/input.sass +@error +a + +<===> sass/multiline_after/error +Error: a + , +1 | / @error +2 | \ a + ' + input.sass 1:1 root stylesheet diff --git a/spec/directives/extend/whitespace.hrx b/spec/directives/extend/whitespace.hrx new file mode 100644 index 0000000000..2b0c50d793 --- /dev/null +++ b/spec/directives/extend/whitespace.hrx @@ -0,0 +1,150 @@ +<===> before_arg/scss/input.scss +a {b: c} +d {@extend + a} + +<===> before_arg/scss/output.css +a, d { + b: c; +} + +<===> +================================================================================ +<===> before_arg/sass/input.sass +a + b: c +d + @extend + a + e: f + +<===> before_arg/sass/output.css +a, d { + b: c; +} + +d { + e: f; +} + +<===> +================================================================================ +<===> before_optional/scss/input.scss +a {@extend b + !optional} + +<===> before_optional/scss/output.css + +<===> +================================================================================ +<===> after_arg/sass/input.sass +a + b: c +d + @extend + a +b + e: f + +<===> after_arg/sass/output.css +a, d { + b: c; +} + +b { + e: f; +} + +<===> +================================================================================ +<===> multiple_selectors/newline/sass/input.sass +a + b: c +d + e: f + +g + @extend a + d + +<===> multiple_selectors/newline/sass/output.css +a, g { + b: c; +} + +d { + e: f; +} + +<===> multiple_selectors/newline/sass/warning +WARNING: This selector doesn't have any properties and won't be rendered. + + , +8 | d + | ^ + ' + input.sass 8:3 root stylesheet + +<===> +================================================================================ +<===> multiple_selectors/comma/sass/input.sass +a + b: c +d + e: f + +g + @extend a, + d + +<===> multiple_selectors/comma/sass/output.css +a, g { + b: c; +} + +d { + e: f; +} + +<===> multiple_selectors/comma/sass/warning +WARNING: This selector doesn't have any properties and won't be rendered. + + , +8 | d + | ^ + ' + input.sass 8:3 root stylesheet + +<===> +================================================================================ +<===> error/before_optional/sass/input.sass +a + @extend b + !optional + +<===> error/before_optional/sass/error +Error: Expected newline. + , +2 | @extend b + | ^ + ' + input.sass 2:12 root stylesheet + +<===> +================================================================================ +<===> error/after_arg_indented/sass/input.sass +a + b: c +d + @extend + a + b + e: f + +<===> error/after_arg_indented/sass/error +Error: Nothing may be indented beneath a @extend rule. + , +6 | b + | ^ + ' + input.sass 6:5 root stylesheet diff --git a/spec/directives/for/comment.hrx b/spec/directives/for/comment.hrx index ffd32bdcc9..e4626ea958 100644 --- a/spec/directives/for/comment.hrx +++ b/spec/directives/for/comment.hrx @@ -21,76 +21,27 @@ <===> ================================================================================ -<===> error/before_var/silent/sass/input.sass +<===> before_var/silent/sass/input.sass @for // $i from 1 through 10 -<===> error/before_var/silent/sass/error -Error: expected "$". - , -1 | @for // - | ^ - ' - input.sass 1:8 root stylesheet +<===> before_var/silent/sass/output.css <===> ================================================================================ -<===> error/before_from/silent/sass/input.sass +<===> before_from/silent/sass/input.sass @for $i // from 1 through 10 -<===> error/before_from/silent/sass/error -Error: Expected "from". - , -1 | @for $i // - | ^ - ' - input.sass 1:11 root stylesheet +<===> before_from/silent/sass/output.css <===> ================================================================================ -<===> error/after_from/silent/sass/input.sass -@for $i from // - 1 through 10 - - -<===> error/after_from/silent/sass/error -Error: Expected expression. - , -1 | @for $i from // - | ^^ - ' - input.sass 1:14 root stylesheet - -<===> -================================================================================ -<===> error/before_through/silent/sass/input.sass -@for $i from 1 // - through 10 - - -<===> error/before_through/silent/sass/error -Error: Expected "to" or "through". - , -1 | @for $i from 1 // - | ^^ - ' - input.sass 1:16 root stylesheet - -<===> -================================================================================ -<===> error/after_through/silent/sass/input.sass -@for $i from 1 through // - 10 - +<===> before_from/silent/scss/input.scss +@for $i // + from 1 through 10 {} -<===> error/after_through/silent/sass/error -Error: Expected expression. - , -1 | @for $i from 1 through // - | ^^ - ' - input.sass 1:24 root stylesheet +<===> before_from/silent/scss/output.css <===> ================================================================================ @@ -109,11 +60,19 @@ Error: Expected expression. <===> ================================================================================ -<===> before_from/silent/scss/input.scss -@for $i // - from 1 through 10 {} +<===> after_from/silent/sass/input.sass +@for $i from // + 1 through 10 -<===> before_from/silent/scss/output.css +<===> after_from/silent/sass/output.css + +<===> +================================================================================ +<===> after_from/silent/scss/input.scss +@for $i from // + 1 through 10 {} + +<===> after_from/silent/scss/output.css <===> ================================================================================ @@ -132,11 +91,19 @@ Error: Expected expression. <===> ================================================================================ -<===> after_from/silent/scss/input.scss -@for $i from // - 1 through 10 {} +<===> before_through/silent/sass/input.sass +@for $i from 1 // + through 10 -<===> after_from/silent/scss/output.css +<===> before_through/silent/sass/output.css + +<===> +================================================================================ +<===> before_through/silent/scss/input.scss +@for $i from 1 // + through 10 {} + +<===> before_through/silent/scss/output.css <===> ================================================================================ @@ -155,11 +122,20 @@ Error: Expected expression. <===> ================================================================================ -<===> before_through/silent/scss/input.scss -@for $i from 1 // - through 10 {} +<===> after_through/silent/sass/input.sass +@for $i from 1 through // + 10 -<===> before_through/silent/scss/output.css + +<===> after_through/silent/sass/output.css + +<===> +================================================================================ +<===> after_through/silent/scss/input.scss +@for $i from 1 through // + 10 {} + +<===> after_through/silent/scss/output.css <===> ================================================================================ @@ -175,14 +151,6 @@ Error: Expected expression. <===> after_through/loud/sass/output.css -<===> -================================================================================ -<===> after_through/silent/scss/input.scss -@for $i from 1 through // - 10 {} - -<===> after_through/silent/scss/output.css - <===> ================================================================================ <===> before_block/loud/scss/input.scss diff --git a/spec/directives/for/whitespace.hrx b/spec/directives/for/whitespace.hrx new file mode 100644 index 0000000000..c1443162c7 --- /dev/null +++ b/spec/directives/for/whitespace.hrx @@ -0,0 +1,120 @@ +<===> before_var/scss/input.scss +@for + $i from 1 through 10 {} + +<===> before_var/scss/output.css + +<===> +================================================================================ +<===> before_var/sass/input.sass +@for + $i from 1 through 10 + + +<===> before_var/sass/output.css + +<===> +================================================================================ +<===> before_from/scss/input.scss +@for $i + from 1 through 10 {} + +<===> before_from/scss/output.css + +<===> +================================================================================ +<===> before_from/sass/input.sass +@for $i + from 1 through 10 + +<===> before_from/sass/output.css + +<===> +================================================================================ +<===> after_from/scss/input.scss +@for $i from + 1 through 10 {} + +<===> after_from/scss/output.css + +<===> +================================================================================ +<===> after_from/sass/input.sass +@for $i from + 1 through 10 + +<===> after_from/sass/output.css + +<===> +================================================================================ +<===> before_through/scss/input.scss +@for $i from 1 + through 10 {} + +<===> before_through/scss/output.css + +<===> +================================================================================ +<===> before_through/sass/input.sass +@for $i from 1 + through 10 + +<===> before_through/sass/output.css + +<===> +================================================================================ +<===> after_through/scss/input.scss +@for $i from 1 through + 10 {} + + +<===> after_through/scss/output.css + +<===> +================================================================================ +<===> after_through/sass/input.sass +@for $i from 1 through + 10 + +<===> after_through/sass/output.css + +<===> +================================================================================ +<===> before_to/scss/input.scss +@for $i from 1 + to 10 {} + +<===> before_to/scss/output.css + +<===> +================================================================================ +<===> before_to/sass/input.sass +@for $i from 1 + to 10 + +<===> before_to/sass/output.css + +<===> +================================================================================ +<===> after_to/scss/input.scss +@for $i from 1 to + 10 {} + + +<===> after_to/scss/output.css + +<===> +================================================================================ +<===> after_to/sass/input.sass +@for $i from 1 to + 10 + +<===> after_to/sass/output.css + +<===> +================================================================================ +<===> before_block/scss/input.scss +@for $i from 1 through 10 + {} + +<===> before_block/scss/output.css diff --git a/spec/directives/forward/member/newlines.hrx b/spec/directives/forward/member/newlines.hrx new file mode 100644 index 0000000000..f781768bdc --- /dev/null +++ b/spec/directives/forward/member/newlines.hrx @@ -0,0 +1,55 @@ +<===> hide/after/input.sass +@forward "upstream" hide + a + +<===> hide/after/_upstream.sass +$a: b + +<===> hide/after/output.css + +<===> +================================================================================ +<===> show/after/input.sass +@forward "upstream" show + a + +<===> show/after/_upstream.sass +$a: b + +<===> show/after/output.css + +<===> +================================================================================ +<===> error/hide/between/input.sass +@forward "upstream" hide a + c + +<===> error/hide/between/_upstream.sass +$a: b +$c: d + +<===> error/hide/between/error +Error: Nothing may be indented beneath a @forward rule. + , +2 | c + | ^ + ' + input.sass 2:3 root stylesheet + +<===> +================================================================================ +<===> error/show/whitespace_between/input.sass +@forward "upstream" show a + c + +<===> error/show/whitespace_between/_upstream.sass +$a: b +$c: d + +<===> error/show/whitespace_between/error +Error: Nothing may be indented beneath a @forward rule. + , +2 | c + | ^ + ' + input.sass 2:3 root stylesheet diff --git a/spec/directives/forward/whitespace.hrx b/spec/directives/forward/whitespace.hrx new file mode 100644 index 0000000000..09af076c0c --- /dev/null +++ b/spec/directives/forward/whitespace.hrx @@ -0,0 +1,269 @@ +<===> before_url/scss/input.scss +@forward + "other" + +<===> before_url/scss/other.scss + +<===> before_url/scss/output.css + +<===> +================================================================================ +<===> before_url/sass/input.sass +@forward + "other" + +<===> before_url/sass/other.scss + +<===> before_url/sass/output.css + +<===> +================================================================================ +<===> before_keyword/scss/input.scss +@forward "other" + as a-* + +<===> before_keyword/scss/other.scss + +<===> before_keyword/scss/output.css + +<===> +================================================================================ +<===> error/before_keyword/sass/input.sass +@forward "other" + as a-* + +<===> error/before_keyword/sass/other.scss + +<===> error/before_keyword/sass/error +Error: Nothing may be indented beneath a @forward rule. + , +2 | as a-* + | ^ + ' + input.sass 2:3 root stylesheet + +<===> +================================================================================ +<===> after_keyword/scss/input.scss +@forward "other" as + a-* + +<===> after_keyword/scss/other.scss + +<===> after_keyword/scss/output.css + +<===> +================================================================================ +<===> after_keyword/sass/input.sass +@forward "other" as + a-* + +<===> after_keyword/sass/other.scss + +<===> after_keyword/sass/output.css + +<===> +================================================================================ +<===> after_open_paren/scss/input.scss +@forward "other" with ( + $a: b) + +<===> after_open_paren/scss/other.scss +$a: 1 !default + +<===> after_open_paren/scss/output.css + +<===> +================================================================================ +<===> after_paren/sass/input.sass +@forward "other" with ( + $a: b) + +<===> after_paren/sass/other.scss +$a: 1 !default + +<===> after_paren/sass/output.css + +<===> +================================================================================ +<===> before_colon/scss/input.scss +@forward "other" with ($a + : b) + +<===> before_colon/scss/other.scss +$a: 1 !default + +<===> before_colon/scss/output.css + +<===> +================================================================================ +<===> before_colon/sass/input.sass +@forward "other" with ($a + : b) + +<===> before_colon/sass/other.scss +$a: 1 !default + +<===> before_colon/sass/output.css + +<===> +================================================================================ +<===> after_colon/scss/input.scss +@forward "other" with ($a: + b) + +<===> after_colon/scss/other.scss +$a: 1 !default + +<===> after_colon/scss/output.css + +<===> +================================================================================ +<===> after_colon/sass/input.sass +@forward "other" with ($a: + b) + +<===> after_colon/sass/other.scss +$a: 1 !default + +<===> after_colon/sass/output.css + +<===> +================================================================================ +<===> after_variable_comma/scss/input.scss +@forward "other" with ($a: b, + $c: d) + +<===> after_variable_comma/scss/other.scss +$a: 1 !default; +$c: 1 !default + +<===> after_variable_comma/scss/output.css + +<===> +================================================================================ +<===> after_variable_comma/sass/input.sass +@forward "other" with ($a: b, + $c: d) + +<===> after_variable_comma/sass/other.sass +$a: 1 !default +$c: 1 !default + +<===> after_variable_comma/sass/output.css + +<===> +================================================================================ +<===> before_close_paren/scss/input.scss +@forward "other" with ($a: b + ) + +<===> before_close_paren/scss/other.scss +$a: 1 !default + +<===> before_close_paren/scss/output.css + +<===> +================================================================================ +<===> before_close_paren/sass/input.sass +@forward "other" with ($a: b + ) + +<===> before_close_paren/sass/other.scss +$a: 1 !default + +<===> before_close_paren/sass/output.css + +<===> +================================================================================ +<===> before_default/scss/input.scss +@forward "other" with ($a: b + !default) + +<===> before_default/scss/other.scss +$a: 1 !default + +<===> before_default/scss/output.css + +<===> +================================================================================ +<===> before_default/sass/input.sass +@forward "other" with ($a: b + !default) + +<===> before_default/sass/other.scss +$a: 1 !default + +<===> before_default/sass/output.css + +<===> +================================================================================ +<===> after_default/scss/input.scss +@forward "other" with ($a: b !default + ) + +<===> after_default/scss/other.scss +$a: 1 !default + +<===> after_default/scss/output.css + +<===> +================================================================================ +<===> after_default/sass/input.sass +@forward "other" with ($a: b !default + ) + +<===> after_default/sass/other.scss +$a: 1 !default + +<===> after_default/sass/output.css + +<===> +================================================================================ +<===> show/after_show/sass/input.sass +@forward "other" show + $a + +<===> show/after_show/sass/other.scss +$a: 1 !default + +<===> show/after_show/sass/output.css + +<===> +================================================================================ +<===> show/after_a/sass/input.sass +@forward "other" show $a + , $b + +<===> show/after_a/sass/other.scss +$a: 1 !default + +<===> show/after_a/sass/error +Error: Nothing may be indented beneath a @forward rule. + , +2 | , $b + | ^ + ' + input.sass 2:3 root stylesheet + +<===> +================================================================================ +<===> show/after_comma/sass/input.sass +@forward "other" show $a, + $b + +<===> show/after_comma/sass/other.scss +$a: 1 !default + +<===> show/after_comma/sass/output.css + +<===> +================================================================================ +<===> hide/after_hide/sass/input.sass +@forward "other" hide + $a + +<===> hide/after_hide/sass/other.scss +$a: 1 !default + +<===> hide/after_hide/sass/output.css diff --git a/spec/directives/function.hrx b/spec/directives/function.hrx deleted file mode 100644 index d0138b77b8..0000000000 --- a/spec/directives/function.hrx +++ /dev/null @@ -1,156 +0,0 @@ -<===> escaped/input.scss -// Function names can be defined and referred to using escapes, which are -// normalized. -@function f\6Fo-bar() {@return 1} - -a {b: foo-b\61r()} - -<===> escaped/output.css -a { - b: 1; -} - -<===> -================================================================================ -<===> custom_ident_name/input.scss -@function --a() {@return 1} -b {c: --a()} - -<===> custom_ident_name/output.css -b { - c: 1; -} - -<===> custom_ident_name/warning -DEPRECATION WARNING [css-function-mixin]: Sass @function names beginning with -- are deprecated for forward-compatibility with plain CSS mixins. - -For details, see https://sass-lang.com/d/css-function-mixin - - , -1 | @function --a() {@return 1} - | ^^^ - ' - input.scss 1:11 root stylesheet - -<===> -================================================================================ -<===> double_underscore_name/input.scss -@function __a() {@return 1} -b {c: __a()} - -<===> double_underscore_name/output.css -b { - c: 1; -} - -<===> -================================================================================ -<===> custom_ident_call/input.scss -@function __a() {@return 1} -b {c: --a()} - -<===> custom_ident_call/output.css -b { - c: 1; -} - -<===> custom_ident_call/warning -DEPRECATION WARNING [css-function-mixin]: Sass @function names beginning with -- are deprecated for forward-compatibility with plain CSS functions. - -For details, see https://sass-lang.com/d/css-function-mixin - - , -2 | b {c: --a()} - | ^^^ - ' - input.scss 2:7 root stylesheet - -<===> -================================================================================ -<===> vendor_like_underscore/README.md -Function names like `-moz-calc()` aren't allowed, but they are with underscores. - -<===> -================================================================================ -<===> vendor_like_underscore/start/input.scss -@function _moz-calc() {@return 1} -b {c: _moz-calc()} - -<===> vendor_like_underscore/start/output.css -b { - c: 1; -} - -<===> -================================================================================ -<===> vendor_like_underscore/middle/input.scss -@function -moz_calc() {@return 1} -b {c: -moz_calc()} - -<===> vendor_like_underscore/middle/output.css -b { - c: 1; -} - -<===> -================================================================================ -<===> comment/function/before_name/loud/input.scss -@function /**/ a() {} - -<===> comment/function/before_name/loud/output.css - -<===> -================================================================================ -<===> comment/function/before_name/silent/input.scss -@function // - a() {} - -<===> comment/function/before_name/silent/output.css - -<===> -================================================================================ -<===> comment/function/after_args/loud/input.scss -@function a() /**/ {} - -<===> comment/function/after_args/loud/output.css - -<===> -================================================================================ -<===> comment/function/after_args/silent/input.scss -@function a() // - {} - -<===> comment/function/after_args/silent/output.css - -<===> -================================================================================ -<===> comment/return/before_value/loud/input.scss -@function a() {@return /**/ b} - -<===> comment/return/before_value/loud/output.css - -<===> -================================================================================ -<===> comment/return/before_value/silent/input.scss -@function a() { - @return // - b -} - -<===> comment/return/before_value/silent/output.css - -<===> -================================================================================ -<===> comment/return/after_value/loud/input.scss -@function a() {@return b /**/} - -<===> comment/return/after_value/loud/output.css - -<===> -================================================================================ -<===> comment/return/after_value/silent/input.scss -@function a() { - @return b // -} - -<===> comment/return/after_value/silent/output.css diff --git a/spec/directives/function/comment.hrx b/spec/directives/function/comment.hrx new file mode 100644 index 0000000000..4bc66b00d7 --- /dev/null +++ b/spec/directives/function/comment.hrx @@ -0,0 +1,60 @@ +<===> function/before_name/loud/input.scss +@function /**/ a() {} + +<===> function/before_name/loud/output.css + +<===> +================================================================================ +<===> function/before_name/silent/input.scss +@function // + a() {} + +<===> function/before_name/silent/output.css + +<===> +================================================================================ +<===> function/after_args/loud/input.scss +@function a() /**/ {} + +<===> function/after_args/loud/output.css + +<===> +================================================================================ +<===> function/after_args/silent/input.scss +@function a() // + {} + +<===> function/after_args/silent/output.css + +<===> +================================================================================ +<===> return/before_value/loud/input.scss +@function a() {@return /**/ b} + +<===> return/before_value/loud/output.css + +<===> +================================================================================ +<===> return/before_value/silent/input.scss +@function a() { + @return // + b +} + +<===> return/before_value/silent/output.css + +<===> +================================================================================ +<===> return/after_value/loud/input.scss +@function a() {@return b /**/} + +<===> return/after_value/loud/output.css + +<===> +================================================================================ +<===> return/after_value/silent/input.scss +@function a() { + @return b // +} + +<===> return/after_value/silent/output.css diff --git a/spec/directives/function/custom_ident_call.hrx b/spec/directives/function/custom_ident_call.hrx new file mode 100644 index 0000000000..cc75c49e77 --- /dev/null +++ b/spec/directives/function/custom_ident_call.hrx @@ -0,0 +1,19 @@ +<===> input.scss +@function __a() {@return 1} +b {c: --a()} + +<===> output.css +b { + c: 1; +} + +<===> warning +DEPRECATION WARNING [css-function-mixin]: Sass @function names beginning with -- are deprecated for forward-compatibility with plain CSS functions. + +For details, see https://sass-lang.com/d/css-function-mixin + + , +2 | b {c: --a()} + | ^^^ + ' + input.scss 2:7 root stylesheet diff --git a/spec/directives/function/custom_ident_name.hrx b/spec/directives/function/custom_ident_name.hrx new file mode 100644 index 0000000000..8c027c27fd --- /dev/null +++ b/spec/directives/function/custom_ident_name.hrx @@ -0,0 +1,19 @@ +<===> input.scss +@function --a() {@return 1} +b {c: --a()} + +<===> output.css +b { + c: 1; +} + +<===> warning +DEPRECATION WARNING [css-function-mixin]: Sass @function names beginning with -- are deprecated for forward-compatibility with plain CSS mixins. + +For details, see https://sass-lang.com/d/css-function-mixin + + , +1 | @function --a() {@return 1} + | ^^^ + ' + input.scss 1:11 root stylesheet diff --git a/spec/directives/function/double_underscore_name.hrx b/spec/directives/function/double_underscore_name.hrx new file mode 100644 index 0000000000..f00154b187 --- /dev/null +++ b/spec/directives/function/double_underscore_name.hrx @@ -0,0 +1,8 @@ +<===> input.scss +@function __a() {@return 1} +b {c: __a()} + +<===> output.css +b { + c: 1; +} diff --git a/spec/directives/function/escaped.hrx b/spec/directives/function/escaped.hrx new file mode 100644 index 0000000000..a43f229f71 --- /dev/null +++ b/spec/directives/function/escaped.hrx @@ -0,0 +1,11 @@ +<===> input.scss +// Function names can be defined and referred to using escapes, which are +// normalized. +@function f\6Fo-bar() {@return 1} + +a {b: foo-b\61r()} + +<===> output.css +a { + b: 1; +} diff --git a/spec/directives/function/vendor_like_underscore.hrx b/spec/directives/function/vendor_like_underscore.hrx new file mode 100644 index 0000000000..cafc4dd990 --- /dev/null +++ b/spec/directives/function/vendor_like_underscore.hrx @@ -0,0 +1,24 @@ +<===> README.md +Function names like `-moz-calc()` aren't allowed, but they are with underscores. + +<===> +================================================================================ +<===> start/input.scss +@function _moz-calc() {@return 1} +b {c: _moz-calc()} + +<===> start/output.css +b { + c: 1; +} + +<===> +================================================================================ +<===> middle/input.scss +@function -moz_calc() {@return 1} +b {c: -moz_calc()} + +<===> middle/output.css +b { + c: 1; +} diff --git a/spec/directives/function/whitespace.hrx b/spec/directives/function/whitespace.hrx new file mode 100644 index 0000000000..9db4cd4dd4 --- /dev/null +++ b/spec/directives/function/whitespace.hrx @@ -0,0 +1,40 @@ +<===> before_name/scss/input.scss +@function + a() {} + +<===> before_name/scss/output.css + +<===> +================================================================================ +<===> before_name/sass/input.sass +@function + a() + +<===> before_name/sass/output.css + +<===> +================================================================================ +<===> after_name/sass/input.sass +@function a + () + +<===> after_name/sass/output.css + +<===> +================================================================================ +<===> nested_at_rule/scss/input.scss +@function a() {@debug + b; + @return null} + +<===> nested_at_rule/scss/output.css + +<===> +================================================================================ +<===> nested_at_rule/sass/input.sass +@function a() + @debug + b + @return null + +<===> nested_at_rule/sass/output.css diff --git a/spec/directives/if/comment.hrx b/spec/directives/if/comment.hrx index 1252255886..6a6b30922e 100644 --- a/spec/directives/if/comment.hrx +++ b/spec/directives/if/comment.hrx @@ -1,95 +1,95 @@ -<===> comment/if/before_condition/loud/input.scss +<===> if/before_condition/loud/input.scss @if /**/ true {} -<===> comment/if/before_condition/loud/output.css +<===> if/before_condition/loud/output.css <===> ================================================================================ -<===> comment/if/before_condition/silent/input.scss +<===> if/before_condition/silent/input.scss @if // true {} -<===> comment/if/before_condition/silent/output.css +<===> if/before_condition/silent/output.css <===> ================================================================================ -<===> comment/if/after_condition/loud/input.scss +<===> if/after_condition/loud/input.scss @if true /**/ {} -<===> comment/if/after_condition/loud/output.css +<===> if/after_condition/loud/output.css <===> ================================================================================ -<===> comment/if/after_condition/silent/input.scss +<===> if/after_condition/silent/input.scss @if true // {} -<===> comment/if/after_condition/silent/output.css +<===> if/after_condition/silent/output.css <===> ================================================================================ -<===> comment/else_if/before_if/loud/input.scss +<===> else_if/before_if/loud/input.scss @if true {} @else /**/ if true {} -<===> comment/else_if/before_if/loud/output.css +<===> else_if/before_if/loud/output.css <===> ================================================================================ -<===> comment/else_if/before_if/silent/input.scss +<===> else_if/before_if/silent/input.scss @if true {} @else // if true {} -<===> comment/else_if/before_if/silent/output.css +<===> else_if/before_if/silent/output.css <===> ================================================================================ -<===> comment/else_if/before_condition/loud/input.scss +<===> else_if/before_condition/loud/input.scss @if true {} @else if /**/ true {} -<===> comment/else_if/before_condition/loud/output.css +<===> else_if/before_condition/loud/output.css <===> ================================================================================ -<===> comment/else_if/before_condition/silent/input.scss +<===> else_if/before_condition/silent/input.scss @if true {} @else if // true {} -<===> comment/else_if/before_condition/silent/output.css +<===> else_if/before_condition/silent/output.css <===> ================================================================================ -<===> comment/else_if/after_condition/loud/input.scss +<===> else_if/after_condition/loud/input.scss @if true {} @else if true /**/ {} -<===> comment/else_if/after_condition/loud/output.css +<===> else_if/after_condition/loud/output.css <===> ================================================================================ -<===> comment/else_if/after_condition/silent/input.scss +<===> else_if/after_condition/silent/input.scss @if true {} @else if true // {} -<===> comment/else_if/after_condition/silent/output.css +<===> else_if/after_condition/silent/output.css <===> ================================================================================ -<===> comment/else/before_block/loud/input.scss +<===> else/before_block/loud/input.scss @if true {} @else /**/ {} -<===> comment/else/before_block/loud/output.css +<===> else/before_block/loud/output.css <===> ================================================================================ -<===> comment/else/before_block/silent/input.scss +<===> else/before_block/silent/input.scss @if true {} @else // {} -<===> comment/else/before_block/silent/output.css +<===> else/before_block/silent/output.css diff --git a/spec/directives/if/sass.hrx b/spec/directives/if/sass.hrx index c688c4057a..cb58325736 100644 --- a/spec/directives/if/sass.hrx +++ b/spec/directives/if/sass.hrx @@ -11,33 +11,33 @@ a { <===> ================================================================================ -<===> if-statement/input.sass +<===> if_statement/input.sass $b: c a @if $b == c value: 1 -<===> if-statement/output.css +<===> if_statement/output.css a { value: 1; } <===> ================================================================================ -<===> if-statement-wrapped/input.sass +<===> if_statement_wrapped/input.sass $b: c a @if ($b == c) d: e -<===> if-statement-wrapped/output.css +<===> if_statement_wrapped/output.css a { d: e; } <===> ================================================================================ -<===> error/if-statement-wrapped-multiline/input.sass +<===> if_statement_wrapped_multiline/input.sass $a: b $c: d a @@ -47,17 +47,14 @@ a ) e: f -<===> error/if-statement-wrapped-multiline/error -Error: expected ")". - , -4 | @if ( - | ^ - ' - input.sass 4:8 root stylesheet +<===> if_statement_wrapped_multiline/output.css +a { + e: f; +} <===> ================================================================================ -<===> error/if-statement-unwrapped-multiline/input.sass +<===> if_statement_unwrapped_multiline/input.sass $a: b $c: d a @@ -65,10 +62,7 @@ a $a == b and $c == d e: f -<===> error/if-statement-unwrapped-multiline/error -Error: Expected expression. - , -4 | @if - | ^ - ' - input.sass 4:7 root stylesheet +<===> if_statement_unwrapped_multiline/output.css +a { + e: f; +} diff --git a/spec/directives/if/whitespace.hrx b/spec/directives/if/whitespace.hrx new file mode 100644 index 0000000000..bc4ce20f6b --- /dev/null +++ b/spec/directives/if/whitespace.hrx @@ -0,0 +1,144 @@ +<===> if/before_condition/scss/input.scss +@if + true {} + +<===> if/before_condition/scss/output.css + +<===> +================================================================================ +<===> if/before_condition/sass/input.sass +@if + true + +<===> if/before_condition/sass/output.css + +<===> +================================================================================ +<===> else_if/before_if/sass/input.sass +@if true +@else + if true + +<===> else_if/before_if/sass/output.css + +<===> else_if/before_if/sass/warning +WARNING: This selector doesn't have any properties and won't be rendered. + + , +3 | if true + | ^^^^^^^ + ' + input.sass 3:3 root stylesheet + +<===> +================================================================================ +<===> else_if/before_condition/scss/input.scss +@if true {} +@else if + true {} + +<===> else_if/before_condition/scss/output.css + +<===> +================================================================================ +<===> else_if/before_condition/sass/input.sass +@if true +@else if + true + +<===> else_if/before_condition/sass/output.css + +<===> +================================================================================ +<===> else_if/after_condition/scss/input.scss +@if true {} +@else if true + {} + +<===> else_if/after_condition/scss/output.css + +<===> +================================================================================ +<===> else/before_block/scss/input.scss +@if true {} +@else + {} + +<===> else/before_block/scss/output.css + +<===> +================================================================================ +<===> condition/before_and/scss/input.scss +@if true + and true{} + +<===> condition/before_and/scss/output.css + +<===> +================================================================================ +<===> condition/before_and/sass/input.sass +@if true + and true + +<===> condition/before_and/sass/output.css + +<===> condition/before_and/sass/warning +WARNING: This selector doesn't have any properties and won't be rendered. + + , +2 | and true + | ^^^^^^^^ + ' + input.sass 2:3 root stylesheet + +<===> +================================================================================ +<===> condition/after_and/scss/input.scss +@if true and + true {} + +<===> condition/after_and/scss/output.css + +<===> +================================================================================ +<===> condition/after_and/sass/input.sass +@if true and + true + +<===> condition/after_and/sass/output.css + +<===> +================================================================================ +<===> error/else_if/before_if/scss/input.scss +@if true {} +@else + if true {} + +<===> error/else_if/before_if/scss/output.css + +<===> +================================================================================ +<===> error/top_level_else/sass/input.sass +@else + +<===> error/top_level_else/sass/error +Error: This at-rule is not allowed here. + , +1 | @else + | ^^^^^ + ' + input.sass 1:1 root stylesheet + +<===> +================================================================================ +<===> error/top_level_else_if/sass/input.sass +@else +if + +<===> error/top_level_else_if/sass/error +Error: This at-rule is not allowed here. + , +1 | @else + | ^^^^^ + ' + input.sass 1:1 root stylesheet diff --git a/spec/directives/import/css.hrx b/spec/directives/import/css.hrx index 4996fa07f5..c36b54fbe6 100644 --- a/spec/directives/import/css.hrx +++ b/spec/directives/import/css.hrx @@ -44,3 +44,11 @@ More info and automated migrator: https://sass-lang.com/d/import | ^^^^^^^^ ' input.scss 3:9 root stylesheet + +<===> +================================================================================ +<===> sass/semicolon/input.sass +@import url("a"); + +<===> sass/semicolon/output.css +@import url("a"); diff --git a/spec/directives/import/whitespace.hrx b/spec/directives/import/whitespace.hrx new file mode 100644 index 0000000000..a1c2329415 --- /dev/null +++ b/spec/directives/import/whitespace.hrx @@ -0,0 +1,145 @@ +<===> before_url/scss/input.scss +@import + "a.css" + +<===> before_url/scss/output.css +@import "a.css"; + +<===> +================================================================================ +<===> after_comma/sass/input.scss +@import "a.css", + "b.css" + +<===> after_comma/sass/output.css +@import "a.css"; +@import "b.css"; + +<===> +================================================================================ +<===> after_comma/scss/input.scss +@import "a.css", + "b.css" + +<===> after_comma/scss/output.css +@import "a.css"; +@import "b.css"; + +<===> +================================================================================ +<===> modifier/no_args/before/sass/input.scss +@import "a.css" + b + +<===> modifier/no_args/before/sass/output.css +@import "a.css" b; + +<===> +================================================================================ +<===> modifier/no_args/before/scss/input.scss +@import "a.css" + b + +<===> modifier/no_args/before/scss/output.css +@import "a.css" b; + +<===> +================================================================================ +<===> modifier/args/before/scss/input.scss +@import "a.css" + b(c) + +<===> modifier/args/before/scss/output.css +@import "a.css" b(c); + +<===> +================================================================================ +<===> modifier/args/after_open_paren/scss/input.scss +@import "a.css" b( + c) + +<===> modifier/args/after_open_paren/scss/output.css +@import "a.css" b( + c); + +<===> +================================================================================ +<===> modifier/args/after_open_paren/sass/input.sass +@import "a.css" b( + c) + +<===> modifier/args/after_open_paren/sass/output.css +@import "a.css" b( + c); + +<===> +================================================================================ +<===> modifier/args/before_close_paren/scss/input.scss +@import "a.css" b(c + ) + +<===> modifier/args/before_close_paren/scss/output.css +@import "a.css" b(c + ); + +<===> +================================================================================ +<===> modifier/args/before_close_paren/sass/input.sass +@import "a.css" b(c + ) + +<===> modifier/args/before_close_paren/sass/output.css +@import "a.css" b(c + ); + +<===> +================================================================================ +<===> before_comma/scss/input.scss +@import "a.css" + , "b.css" + +<===> before_comma/scss/output.css +@import "a.css"; +@import "b.css"; + +<===> +================================================================================ +<===> error/before_url/sass/input.sass +@import + "a.css" + +<===> error/before_url/sass/error +Error: Nothing may be indented beneath a @import rule. + , +2 | "a.css" + | ^ + ' + input.sass 2:3 root stylesheet + +<===> +================================================================================ +<===> error/before_comma/sass/input.sass +@import "a.css" + , "b.css" + +<===> error/before_comma/sass/error +Error: Nothing may be indented beneath a @import rule. + , +2 | , "b.css" + | ^ + ' + input.sass 2:3 root stylesheet + +<===> +================================================================================ +<===> error/modifier/args/before/sass/input.sass +@import "a.css" + b(c) + +<===> error/modifier/args/before/sass/error +Error: Nothing may be indented beneath a @import rule. + , +2 | b(c) + | ^ + ' + input.sass 2:3 root stylesheet diff --git a/spec/directives/mixin.hrx b/spec/directives/mixin.hrx deleted file mode 100644 index 1bd2cbd8bb..0000000000 --- a/spec/directives/mixin.hrx +++ /dev/null @@ -1,231 +0,0 @@ -<===> custom_ident_name/input.scss -@mixin --a {b: c} -d {@include --a} - -<===> custom_ident_name/output.css -d { - b: c; -} - -<===> custom_ident_name/warning -DEPRECATION WARNING [css-function-mixin]: Sass @mixin names beginning with -- are deprecated for forward-compatibility with plain CSS mixins. - -For details, see https://sass-lang.com/d/css-function-mixin - - , -1 | @mixin --a {b: c} - | ^^^ - ' - input.scss 1:8 root stylesheet - -<===> -================================================================================ -<===> double_underscore_name/input.scss -@mixin __a() {b: c} -d {@include __a} - -<===> double_underscore_name/output.css -d { - b: c; -} - -<===> -================================================================================ -<===> custom_ident_include/input.scss -@mixin __a() {b: c} -d {@include --a} - -<===> custom_ident_include/output.css -d { - b: c; -} - -<===> custom_ident_include/warning -DEPRECATION WARNING [css-function-mixin]: Sass @mixin names beginning with -- are deprecated for forward-compatibility with plain CSS mixins. - -For details, see https://sass-lang.com/d/css-function-mixin - - , -2 | d {@include --a} - | ^^^ - ' - input.scss 2:13 root stylesheet - -<===> -================================================================================ -<===> comment/mixin/before_name/loud/input.scss -@mixin /**/ a {} - -<===> comment/mixin/before_name/loud/output.css - -<===> -================================================================================ -<===> comment/mixin/before_name/silent/input.scss -@mixin // - a {} - -<===> comment/mixin/before_name/silent/output.css - -<===> -================================================================================ -<===> comment/mixin/after_args/loud/input.scss -@mixin a() /**/ {} - -<===> comment/mixin/after_args/loud/output.css - -<===> -================================================================================ -<===> comment/mixin/after_args/silent/input.scss -@mixin a() // - {} - -<===> comment/mixin/after_args/silent/output.css - -<===> -================================================================================ -<===> comment/content/after_content/loud/input.scss -@mixin a {@content /**/} - -<===> comment/content/after_content/loud/output.css - -<===> -================================================================================ -<===> comment/content/after_content/silent/input.scss -@mixin a { - @content // -} - -<===> comment/content/after_content/silent/output.css - -<===> -================================================================================ -<===> comment/content/after_args/loud/input.scss -@mixin a {@content() /**/} - -<===> comment/content/after_args/loud/output.css - -<===> -================================================================================ -<===> comment/content/after_args/silent/input.scss -@mixin a { - @content() // -} - -<===> comment/content/after_args/silent/output.css - -<===> -================================================================================ -<===> comment/include/before_name/loud/input.scss -@mixin a {} -@include /**/ a - -<===> comment/include/before_name/loud/output.css - -<===> -================================================================================ -<===> comment/include/before_name/silent/input.scss -@mixin a {} -@include // - a - -<===> comment/include/before_name/silent/output.css - -<===> -================================================================================ -<===> comment/include/after_name/loud/input.scss -@mixin a {} -@include a /**/ - -<===> comment/include/after_name/loud/output.css - -<===> -================================================================================ -<===> comment/include/after_name/silent/input.scss -@mixin a {} -@include a // - -<===> comment/include/after_name/silent/output.css - -<===> -================================================================================ -<===> comment/include/after_args/loud/input.scss -@mixin a {} -@include a() /**/ - -<===> comment/include/after_args/loud/output.css - -<===> -================================================================================ -<===> comment/include/after_args/silent/input.scss -@mixin a {} -@include a() // - -<===> comment/include/after_args/silent/output.css - -<===> -================================================================================ -<===> comment/include/before_block/loud/input.scss -@mixin a {@content} -@include a() /**/ {} - -<===> comment/include/before_block/loud/output.css - -<===> -================================================================================ -<===> comment/include/before_block/silent/input.scss -@mixin a {@content} -@include a() // - {} - -<===> comment/include/before_block/silent/output.css - -<===> -================================================================================ -<===> comment/include/before_using/loud/input.scss -@mixin a {@content} -@include a() /**/ using () {} - -<===> comment/include/before_using/loud/output.css - -<===> -================================================================================ -<===> comment/include/before_using/silent/input.scss -@mixin a {@content} -@include a() // - using () {} - -<===> comment/include/before_using/silent/output.css - -<===> -================================================================================ -<===> comment/include/after_using/loud/input.scss -@mixin a {@content} -@include a() using /**/ () {} - -<===> comment/include/after_using/loud/output.css - -<===> -================================================================================ -<===> comment/include/after_using/silent/input.scss -@mixin a {@content} -@include a() using // - () {} - -<===> comment/include/after_using/silent/output.css - -<===> -================================================================================ -<===> comment/include/after_using_arglist/loud/input.scss -@mixin a {@content} -@include a() using () /**/ {} - -<===> comment/include/after_using_arglist/loud/output.css - -<===> -================================================================================ -<===> comment/include/after_using_arglist/silent/input.scss -@mixin a {@content} -@include a() using () // - {} - -<===> comment/include/after_using_arglist/silent/output.css diff --git a/spec/directives/mixin/comment.hrx b/spec/directives/mixin/comment.hrx new file mode 100644 index 0000000000..6a7bf5482f --- /dev/null +++ b/spec/directives/mixin/comment.hrx @@ -0,0 +1,176 @@ +<===> mixin/before_name/loud/input.scss +@mixin /**/ a {} + +<===> mixin/before_name/loud/output.css + +<===> +================================================================================ +<===> mixin/before_name/silent/input.scss +@mixin // + a {} + +<===> mixin/before_name/silent/output.css + +<===> +================================================================================ +<===> mixin/after_args/loud/input.scss +@mixin a() /**/ {} + +<===> mixin/after_args/loud/output.css + +<===> +================================================================================ +<===> mixin/after_args/silent/input.scss +@mixin a() // + {} + +<===> mixin/after_args/silent/output.css + +<===> +================================================================================ +<===> content/after_content/loud/input.scss +@mixin a {@content /**/} + +<===> content/after_content/loud/output.css + +<===> +================================================================================ +<===> content/after_content/silent/input.scss +@mixin a { + @content // +} + +<===> content/after_content/silent/output.css + +<===> +================================================================================ +<===> content/after_args/loud/input.scss +@mixin a {@content() /**/} + +<===> content/after_args/loud/output.css + +<===> +================================================================================ +<===> content/after_args/silent/input.scss +@mixin a { + @content() // +} + +<===> content/after_args/silent/output.css + +<===> +================================================================================ +<===> include/before_name/loud/input.scss +@mixin a {} +@include /**/ a + +<===> include/before_name/loud/output.css + +<===> +================================================================================ +<===> include/before_name/silent/input.scss +@mixin a {} +@include // + a + +<===> include/before_name/silent/output.css + +<===> +================================================================================ +<===> include/after_name/loud/input.scss +@mixin a {} +@include a /**/ + +<===> include/after_name/loud/output.css + +<===> +================================================================================ +<===> include/after_name/silent/input.scss +@mixin a {} +@include a // + +<===> include/after_name/silent/output.css + +<===> +================================================================================ +<===> include/after_args/loud/input.scss +@mixin a {} +@include a() /**/ + +<===> include/after_args/loud/output.css + +<===> +================================================================================ +<===> include/after_args/silent/input.scss +@mixin a {} +@include a() // + +<===> include/after_args/silent/output.css + +<===> +================================================================================ +<===> include/before_block/loud/input.scss +@mixin a {@content} +@include a() /**/ {} + +<===> include/before_block/loud/output.css + +<===> +================================================================================ +<===> include/before_block/silent/input.scss +@mixin a {@content} +@include a() // + {} + +<===> include/before_block/silent/output.css + +<===> +================================================================================ +<===> include/before_using/loud/input.scss +@mixin a {@content} +@include a() /**/ using () {} + +<===> include/before_using/loud/output.css + +<===> +================================================================================ +<===> include/before_using/silent/input.scss +@mixin a {@content} +@include a() // + using () {} + +<===> include/before_using/silent/output.css + +<===> +================================================================================ +<===> include/after_using/loud/input.scss +@mixin a {@content} +@include a() using /**/ () {} + +<===> include/after_using/loud/output.css + +<===> +================================================================================ +<===> include/after_using/silent/input.scss +@mixin a {@content} +@include a() using // + () {} + +<===> include/after_using/silent/output.css + +<===> +================================================================================ +<===> include/after_using_arglist/loud/input.scss +@mixin a {@content} +@include a() using () /**/ {} + +<===> include/after_using_arglist/loud/output.css + +<===> +================================================================================ +<===> include/after_using_arglist/silent/input.scss +@mixin a {@content} +@include a() using () // + {} + +<===> include/after_using_arglist/silent/output.css diff --git a/spec/directives/mixin/custom_ident_include.hrx b/spec/directives/mixin/custom_ident_include.hrx new file mode 100644 index 0000000000..9672eaca12 --- /dev/null +++ b/spec/directives/mixin/custom_ident_include.hrx @@ -0,0 +1,19 @@ +<===> input.scss +@mixin __a() {b: c} +d {@include --a} + +<===> output.css +d { + b: c; +} + +<===> warning +DEPRECATION WARNING [css-function-mixin]: Sass @mixin names beginning with -- are deprecated for forward-compatibility with plain CSS mixins. + +For details, see https://sass-lang.com/d/css-function-mixin + + , +2 | d {@include --a} + | ^^^ + ' + input.scss 2:13 root stylesheet diff --git a/spec/directives/mixin/custom_ident_name.hrx b/spec/directives/mixin/custom_ident_name.hrx new file mode 100644 index 0000000000..9a49d6d32d --- /dev/null +++ b/spec/directives/mixin/custom_ident_name.hrx @@ -0,0 +1,19 @@ +<===> input.scss +@mixin --a {b: c} +d {@include --a} + +<===> output.css +d { + b: c; +} + +<===> warning +DEPRECATION WARNING [css-function-mixin]: Sass @mixin names beginning with -- are deprecated for forward-compatibility with plain CSS mixins. + +For details, see https://sass-lang.com/d/css-function-mixin + + , +1 | @mixin --a {b: c} + | ^^^ + ' + input.scss 1:8 root stylesheet diff --git a/spec/directives/mixin/double_underscore_name.hrx b/spec/directives/mixin/double_underscore_name.hrx new file mode 100644 index 0000000000..6c4102a1cf --- /dev/null +++ b/spec/directives/mixin/double_underscore_name.hrx @@ -0,0 +1,8 @@ +<===> input.scss +@mixin __a() {b: c} +d {@include __a} + +<===> output.css +d { + b: c; +} diff --git a/spec/directives/mixin/sass.hrx b/spec/directives/mixin/sass.hrx new file mode 100644 index 0000000000..047f9f1b17 --- /dev/null +++ b/spec/directives/mixin/sass.hrx @@ -0,0 +1,5 @@ +<===> content/semicolon/input.sass +@mixin a + @content; + +<===> content/semicolon/output.css diff --git a/spec/directives/mixin/whitespace.hrx b/spec/directives/mixin/whitespace.hrx new file mode 100644 index 0000000000..d40e9e2ae1 --- /dev/null +++ b/spec/directives/mixin/whitespace.hrx @@ -0,0 +1,193 @@ +<===> mixin/before_name/scss/input.scss +@mixin + a {} + +<===> mixin/before_name/scss/output.css + +<===> +================================================================================ +<===> mixin/before_name/sass/input.sass +@mixin + a + +<===> mixin/before_name/sass/output.css + +<===> +================================================================================ +<===> mixin/after_args/scss/input.scss +@mixin a() + {} + +<===> mixin/after_args/scss/output.css + +<===> +================================================================================ +<===> mixin/equals/before_name/sass/input.sass += + a + +d + @include a + +<===> mixin/equals/before_name/sass/output.css + +<===> +================================================================================ +<===> include/before_name/scss/input.scss +@mixin a {} +@include + a + +<===> include/before_name/scss/output.css + +<===> +================================================================================ +<===> include/before_name/sass/input.sass +@mixin a +@include + a + +<===> include/before_name/sass/output.css + +<===> +================================================================================ +<===> include/plus/none_before_name/sass/input.sass +@mixin a + b: c +d + +a + +<===> include/plus/none_before_name/sass/output.css +d { + b: c; +} + +<===> +================================================================================ +<===> include/plus/space_before_name/sass/input.sass +@mixin a + b: c +d + + a + +<===> include/plus/space_before_name/sass/output.css + +<===> include/plus/space_before_name/sass/warning +WARNING: This selector doesn't have any properties and won't be rendered. + + , +4 | + a + | ^^^ + ' + input.sass 4:3 root stylesheet + +<===> +================================================================================ +<===> include/plus/newline_before_name/sass/input.sass +@mixin a + b: c +d + + + a + +<===> include/plus/newline_before_name/sass/output.css + +<===> include/plus/newline_before_name/sass/warning +WARNING: This selector doesn't have any properties and won't be rendered. + + , +5 | a + | ^ + ' + input.sass 5:5 root stylesheet + +<===> +================================================================================ +<===> include/plus/before_name/sass/input.sass +@mixin a +b + + + a + +<===> include/plus/before_name/sass/output.css + +<===> include/plus/before_name/sass/warning +WARNING: This selector doesn't have any properties and won't be rendered. + + , +4 | a + | ^ + ' + input.sass 4:5 root stylesheet + +<===> +================================================================================ +<===> include/before_block/scss/input.scss +@mixin a {@content} +@include a() + {} + +<===> include/before_block/scss/output.css + +<===> +================================================================================ +<===> include/before_using/scss/input.scss +@mixin a {@content} +@include a() + using () {} + +<===> include/before_using/scss/output.css + +<===> +================================================================================ +<===> include/after_using/scss/input.scss +@mixin a {@content} +@include a() using + () {} + +<===> include/after_using/scss/output.css + +<===> +================================================================================ +<===> include/after_using/sass/input.sass +@mixin a + @content +@include a() using + () + +<===> include/after_using/sass/output.css + +<===> +================================================================================ +<===> include/after_using_arglist/scss/input.scss +@mixin a {@content} +@include a() using () + {} + +<===> include/after_using_arglist/scss/output.css + +<===> +================================================================================ +<===> error/include/before_using/sass/input.sass +@mixin a + @content +@include a() + using () + +<===> error/include/before_using/sass/error +WARNING: This selector doesn't have any properties and won't be rendered. + + , +4 | using () + | ^^^^^^^^ + ' + input.sass 4:3 root stylesheet + +Error: expected selector. + , +4 | using () + | ^ + ' + input.sass 4:9 @content + input.sass 2:3 a() + input.sass 3:1 root stylesheet diff --git a/spec/directives/return.hrx b/spec/directives/return.hrx new file mode 100644 index 0000000000..6bf16ed318 --- /dev/null +++ b/spec/directives/return.hrx @@ -0,0 +1,22 @@ +<===> sass/semicolon/input.sass +@function foo() + @return a; + +<===> sass/semicolon/output.css + +<===> +================================================================================ +<===> before_value/scss/input.scss +@function a() {@return + b} + +<===> before_value/scss/output.css + +<===> +================================================================================ +<===> before_value/sass/input.sass +@function a() + @return + b + +<===> before_value/sass/output.css diff --git a/spec/directives/use/whitespace.hrx b/spec/directives/use/whitespace.hrx new file mode 100644 index 0000000000..6a8056f1a9 --- /dev/null +++ b/spec/directives/use/whitespace.hrx @@ -0,0 +1,221 @@ +<===> before_url/scss/input.scss +@use + "other" + +<===> before_url/scss/other.scss + +<===> before_url/scss/output.css + +<===> +================================================================================ +<===> before_url/sass/input.sass +@use + "other" + +<===> before_url/sass/other.scss + +<===> before_url/sass/output.css + +<===> +================================================================================ +<===> before_keyword/scss/input.scss +@use "other" + as a + +<===> before_keyword/scss/other.scss + +<===> before_keyword/scss/output.css + +<===> +================================================================================ +<===> after_keyword/scss/input.scss +@use "other" as + a + +<===> after_keyword/scss/other.scss + +<===> after_keyword/scss/output.css + +<===> +================================================================================ +<===> after_keyword/sass/input.sass +@use "other" as + a + +<===> after_keyword/sass/other.scss + +<===> after_keyword/sass/output.css + +<===> +================================================================================ +<===> after_with/scss/input.scss +@use "other" with + ($a: b) + +<===> after_with/scss/other.scss +$a: 1 !default + +<===> after_with/scss/output.css + +<===> +================================================================================ +<===> after_with/sass/input.sass +@use "other" with + ($a: b) + +<===> after_with/sass/other.scss +$a: 1 !default + +<===> after_with/sass/output.css + +<===> +================================================================================ +<===> after_paren/scss/input.scss +@use "other" with ( + $a: b) + +<===> after_paren/scss/other.scss +$a: 1 !default + +<===> after_paren/scss/output.css + +<===> +================================================================================ +<===> after_paren/sass/input.sass +@use "other" with ( + $a: b) + +<===> after_paren/sass/other.scss +$a: 1 !default + +<===> after_paren/sass/output.css + +<===> +================================================================================ +<===> before_colon/scss/input.scss +@use "other" with ($a + : b) + +<===> before_colon/scss/other.scss +$a: 1 !default + +<===> before_colon/scss/output.css + +<===> +================================================================================ +<===> before_colon/sass/input.sass +@use "other" with ($a + : b) + +<===> before_colon/sass/other.scss +$a: 1 !default + +<===> before_colon/sass/output.css + +<===> +================================================================================ +<===> after_colon/scss/input.scss +@use "other" with ($a: + b) + +<===> after_colon/scss/other.scss +$a: 1 !default + +<===> after_colon/scss/output.css + +<===> +================================================================================ +<===> after_colon/sass/input.sass +@use "other" with ($a: + b) + +<===> after_colon/sass/other.scss +$a: 1 !default + +<===> after_colon/sass/output.css + +<===> +================================================================================ +<===> before_close_paren/scss/input.scss +@use "other" with ($a: b + ) + +<===> before_close_paren/scss/other.scss +$a: 1 !default + +<===> before_close_paren/scss/output.css + +<===> +================================================================================ +<===> before_close_paren/sass/input.sass +@use "other" with ($a: b + ) + +<===> before_close_paren/sass/other.scss +$a: 1 !default + +<===> before_close_paren/sass/output.css + +<===> +================================================================================ +<===> before_variable_comma/scss/input.scss +@use "other" with ($a: b + , $c: d) + +<===> before_variable_comma/scss/other.scss +$a: 1 !default; +$c: 1 !default + +<===> before_variable_comma/scss/output.css + +<===> +================================================================================ +<===> before_variable_comma/sass/input.sass +@use "other" with ($a: b + , $c: d) + +<===> before_variable_comma/sass/other.sass +$a: 1 !default +$c: 1 !default + +<===> before_variable_comma/sass/output.css + +<===> +================================================================================ +<===> after_variable_comma/scss/input.scss +@use "other" with ($a: b, + $c: d) + +<===> after_variable_comma/scss/other.scss +$a: 1 !default; +$c: 1 !default + +<===> after_variable_comma/scss/output.css + +<===> +================================================================================ +<===> after_variable_comma/sass/input.sass +@use "other" with ($a: b, + $c: d) + +<===> after_variable_comma/sass/other.sass +$a: 1 !default +$c: 1 !default + +<===> after_variable_comma/sass/output.css + +<===> +================================================================================ +<===> error/before_keyword/sass/input.sass +@use "other" + as a + +<===> error/before_keyword/sass/other.scss + +<===> error/before_keyword/sass/error +Error: Nothing may be indented beneath a @use rule. + , +2 | as a + | ^ + ' + input.sass 2:3 root stylesheet diff --git a/spec/directives/warn.hrx b/spec/directives/warn.hrx index cecf15a46e..9004f440be 100644 --- a/spec/directives/warn.hrx +++ b/spec/directives/warn.hrx @@ -175,3 +175,26 @@ WARNING: a <===> comment/after_expression/silent/warning WARNING: a input.scss 1:1 root stylesheet + +<===> +================================================================================ +<===> sass/semicolon/input.sass +@warn a; + +<===> sass/semicolon/output.css + +<===> sass/semicolon/warning +WARNING: a + input.sass 1:1 root stylesheet + +<===> +================================================================================ +<===> sass/multiline/input.sass +@warn +a + +<===> sass/multiline/output.css + +<===> sass/multiline/warning +WARNING: a + input.sass 1:1 root stylesheet diff --git a/spec/directives/while.hrx b/spec/directives/while.hrx new file mode 100644 index 0000000000..14b25c9dca --- /dev/null +++ b/spec/directives/while.hrx @@ -0,0 +1,13 @@ +<===> whitespace/before_var/scss/input.scss +@while + false {} + +<===> whitespace/before_var/scss/output.css + +<===> +================================================================================ +<===> whitespace/before_var/sass/input.sass +@while + false + +<===> whitespace/before_var/sass/output.css diff --git a/spec/expressions/comments.hrx b/spec/expressions/comments.hrx new file mode 100644 index 0000000000..c1257b5c64 --- /dev/null +++ b/spec/expressions/comments.hrx @@ -0,0 +1,156 @@ +<===> loud/sass/inline/closed/input.sass +/* a */ + +<===> loud/sass/inline/closed/output.css +/* a */ + +<===> +================================================================================ +<===> loud/sass/inline/open/input.sass +/* a + +<===> loud/sass/inline/open/output.css +/* a */ + +<===> +================================================================================ +<===> loud/sass/indented/closed/input.sass +/* + a */ + +<===> loud/sass/indented/closed/output.css +/* a */ + +<===> +================================================================================ +<===> loud/sass/indented/closed_after/input.sass +/* + a + */ + +<===> loud/sass/indented/closed_after/output.css +/* a + * */ + +<===> +================================================================================ +<===> loud/sass/indented/interpolation/input.sass +/* #{a + + b} */ + +<===> loud/sass/indented/interpolation/output.css +/* ab */ + +<===> +================================================================================ +<===> loud/sass/indented/open/input.sass +/* + a + +<===> loud/sass/indented/open/output.css +/* a */ + +<===> +================================================================================ +<===> silent/sass/inline/input.sass +// a + +<===> silent/sass/inline/output.css + +<===> +================================================================================ +<===> silent/sass/indented/identifier/input.sass +// + a + +<===> silent/sass/indented/identifier/output.css + +<===> +================================================================================ +<===> silent/sass/indented/interpolation/input.sass +// #{a + + b} + +<===> silent/sass/indented/interpolation/output.css + +<===> +================================================================================ +<===> as_whitespace/sass/inline/input.sass +a + b: c /* d */ e + +<===> as_whitespace/sass/inline/output.css +a { + b: c e; +} + +<===> +================================================================================ +<===> as_whitespace/sass/before-comment/input.sass +a + b: c /* + d */ e + +<===> as_whitespace/sass/before-comment/output.css +a { + b: c e; +} + +<===> +================================================================================ +<===> as_whitespace/sass/before-comment-no-indent/input.sass +a + b: c /* +d */ e + +<===> as_whitespace/sass/before-comment-no-indent/output.css +a { + b: c e; +} + +<===> +================================================================================ +<===> as_whitespace/sass/after-comment/input.sass +a + b: c /* d + */ e + +<===> as_whitespace/sass/after-comment/output.css +a { + b: c e; +} + +<===> +================================================================================ +<===> as_whitespace/sass/after-comment-no-indent/input.sass +a + b: c /* d +*/ e + +<===> as_whitespace/sass/after-comment-no-indent/output.css +a { + b: c e; +} + +<===> +================================================================================ +<===> error/loud/sass/indented/closed_no_indent/input.sass +/* + a +*/ + +<===> error/loud/sass/indented/closed_no_indent/error +WARNING: This selector doesn't have any properties and won't be rendered. + + , +3 | */ + | ^^ + ' + input.sass 3:1 root stylesheet + +Error: expected selector. + , +3 | */ + | ^ + ' + input.sass 3:2 root stylesheet diff --git a/spec/expressions/functions.hrx b/spec/expressions/functions.hrx new file mode 100644 index 0000000000..cbf0f57b0e --- /dev/null +++ b/spec/expressions/functions.hrx @@ -0,0 +1,62 @@ +<===> newlines/after_paren/input.sass +@use "sass:list" +a + b: list.append( + c d, e) + +<===> newlines/after_paren/output.css +a { + b: c d e; +} + +<===> +================================================================================ +<===> newlines/after_value/input.sass +@use "sass:list" +a + b: list.append(c + d, e) + +<===> newlines/after_value/output.css +a { + b: c d e; +} + +<===> +================================================================================ +<===> newlines/before_comma/input.sass +@use "sass:list" +a + b: list.append(c d + , e) + +<===> newlines/before_comma/output.css +a { + b: c d e; +} + +<===> +================================================================================ +<===> newlines/after_comma/input.sass +@use "sass:list" +a + b: list.append(c d, + e) + +<===> newlines/after_comma/output.css +a { + b: c d e; +} + +<===> +================================================================================ +<===> newlines/before_paren/input.sass +@use "sass:list" +a + b: list.append(c d, e + ) + +<===> newlines/before_paren/output.css +a { + b: c d e; +} diff --git a/spec/non_conformant/sass/semicolon/at_rule.hrx b/spec/non_conformant/sass/semicolon/at_rule.hrx deleted file mode 100644 index d34418431d..0000000000 --- a/spec/non_conformant/sass/semicolon/at_rule.hrx +++ /dev/null @@ -1,10 +0,0 @@ -<===> input.sass -@rule value; - -<===> error -Error: semicolons aren't allowed in the indented syntax. - , -1 | @rule value; - | ^ - ' - input.sass 1:12 root stylesheet diff --git a/spec/non_conformant/sass/semicolon/content.hrx b/spec/non_conformant/sass/semicolon/content.hrx deleted file mode 100644 index 8f3d755649..0000000000 --- a/spec/non_conformant/sass/semicolon/content.hrx +++ /dev/null @@ -1,11 +0,0 @@ -<===> input.sass -@mixin foo - @content; - -<===> error -Error: semicolons aren't allowed in the indented syntax. - , -2 | @content; - | ^ - ' - input.sass 2:11 root stylesheet diff --git a/spec/non_conformant/sass/semicolon/debug.hrx b/spec/non_conformant/sass/semicolon/debug.hrx deleted file mode 100644 index 31a08007bd..0000000000 --- a/spec/non_conformant/sass/semicolon/debug.hrx +++ /dev/null @@ -1,10 +0,0 @@ -<===> input.sass -@debug value; - -<===> error -Error: semicolons aren't allowed in the indented syntax. - , -1 | @debug value; - | ^ - ' - input.sass 1:13 root stylesheet diff --git a/spec/non_conformant/sass/semicolon/declaration.hrx b/spec/non_conformant/sass/semicolon/declaration.hrx deleted file mode 100644 index 90b30f0288..0000000000 --- a/spec/non_conformant/sass/semicolon/declaration.hrx +++ /dev/null @@ -1,11 +0,0 @@ -<===> input.sass -a - b: c; - -<===> error -Error: semicolons aren't allowed in the indented syntax. - , -2 | b: c; - | ^ - ' - input.sass 2:7 root stylesheet diff --git a/spec/non_conformant/sass/semicolon/error.hrx b/spec/non_conformant/sass/semicolon/error.hrx deleted file mode 100644 index 2e749aa658..0000000000 --- a/spec/non_conformant/sass/semicolon/error.hrx +++ /dev/null @@ -1,10 +0,0 @@ -<===> input.sass -@error value; - -<===> error -Error: semicolons aren't allowed in the indented syntax. - , -1 | @error value; - | ^ - ' - input.sass 1:13 root stylesheet diff --git a/spec/non_conformant/sass/semicolon/import.hrx b/spec/non_conformant/sass/semicolon/import.hrx deleted file mode 100644 index a0aa321e27..0000000000 --- a/spec/non_conformant/sass/semicolon/import.hrx +++ /dev/null @@ -1,10 +0,0 @@ -<===> input.sass -@import url("foo"); - -<===> error -Error: semicolons aren't allowed in the indented syntax. - , -1 | @import url("foo"); - | ^ - ' - input.sass 1:19 root stylesheet diff --git a/spec/non_conformant/sass/semicolon/include.hrx b/spec/non_conformant/sass/semicolon/include.hrx deleted file mode 100644 index cf02a7d7db..0000000000 --- a/spec/non_conformant/sass/semicolon/include.hrx +++ /dev/null @@ -1,10 +0,0 @@ -<===> input.sass -@include foo; - -<===> error -Error: semicolons aren't allowed in the indented syntax. - , -1 | @include foo; - | ^ - ' - input.sass 1:13 root stylesheet diff --git a/spec/non_conformant/sass/semicolon/return.hrx b/spec/non_conformant/sass/semicolon/return.hrx deleted file mode 100644 index bb78b5e689..0000000000 --- a/spec/non_conformant/sass/semicolon/return.hrx +++ /dev/null @@ -1,11 +0,0 @@ -<===> input.sass -@function foo() - @return value; - -<===> error -Error: semicolons aren't allowed in the indented syntax. - , -2 | @return value; - | ^ - ' - input.sass 2:16 root stylesheet diff --git a/spec/non_conformant/sass/semicolon/variable.hrx b/spec/non_conformant/sass/semicolon/variable.hrx deleted file mode 100644 index aa8c4451fa..0000000000 --- a/spec/non_conformant/sass/semicolon/variable.hrx +++ /dev/null @@ -1,10 +0,0 @@ -<===> input.sass -$var: value; - -<===> error -Error: semicolons aren't allowed in the indented syntax. - , -1 | $var: value; - | ^ - ' - input.sass 1:12 root stylesheet diff --git a/spec/non_conformant/sass/semicolon/warn.hrx b/spec/non_conformant/sass/semicolon/warn.hrx deleted file mode 100644 index 2e55a21fe0..0000000000 --- a/spec/non_conformant/sass/semicolon/warn.hrx +++ /dev/null @@ -1,10 +0,0 @@ -<===> input.sass -@warn value; - -<===> error -Error: semicolons aren't allowed in the indented syntax. - , -1 | @warn value; - | ^ - ' - input.sass 1:12 root stylesheet diff --git a/spec/operators/modulo.hrx b/spec/operators/modulo.hrx index 5fbdd79286..45b3f3436a 100644 --- a/spec/operators/modulo.hrx +++ b/spec/operators/modulo.hrx @@ -35,3 +35,18 @@ a {b: -1px % calc(infinity * 1px)} a { b: calc(NaN * 1px); } + +<===> +================================================================================ +<===> error/syntax/whitespace/newline/after_percent/input.sass +a + b: 1% + 1 + +<===> error/syntax/whitespace/newline/after_percent/error +Error: Expected identifier. + , +2 | b: 1% + | ^ + ' + input.sass 2:8 root stylesheet diff --git a/spec/operators/newlines.hrx b/spec/operators/newlines.hrx new file mode 100644 index 0000000000..9518486df7 --- /dev/null +++ b/spec/operators/newlines.hrx @@ -0,0 +1,75 @@ +<===> binary/after/input.sass +$a: b + +c +d + e: $a + +<===> binary/after/output.css +d { + e: bc; +} + +<===> +================================================================================ +<===> binary/before/input.sass +$a: b ++ c +d + e: $a + +<===> binary/before/output.css +d { + e: b; +} + +<===> binary/before/warning +WARNING: This selector doesn't have any properties and won't be rendered. + + , +2 | + c + | ^^^ + ' + input.sass 2:1 root stylesheet + +<===> +================================================================================ +<===> unary/after/input.sass +$a: not +b +c + d: $a + +<===> unary/after/output.css +c { + d: false; +} + +<===> +================================================================================ +<===> error/binary/before_indent/input.sass +$a: b + + c + +<===> error/binary/before_indent/error +Error: Nothing may be indented beneath a variable declaration. + , +2 | + c + | ^ + ' + input.sass 2:3 root stylesheet + +<===> +================================================================================ +<===> error/unary/before/input.sass +$a: +not c + +<===> error/unary/before/output.css + +<===> +================================================================================ +<===> error/unary/before_indent/input.sass +$a: + not c + +<===> error/unary/before_indent/output.css diff --git a/spec/parser/indentation.hrx b/spec/parser/indentation.hrx index 1378df4bac..5913faabe4 100644 --- a/spec/parser/indentation.hrx +++ b/spec/parser/indentation.hrx @@ -17,12 +17,48 @@ a e { <===> ================================================================================ -<===> error/mixed-syntax/block/input.sass +<===> multiline_indent_level/none/input.sass +a[ +b] + c: d; + +<===> multiline_indent_level/none/output.css +a[b] { + c: d; +} + +<===> +================================================================================ +<===> multiline_indent_level/same/input.sass +a[ + b] + c: d + +<===> multiline_indent_level/same/output.css +a[b] { + c: d; +} + +<===> +================================================================================ +<===> multiline_indent_level/more/input.sass +a[ + b] + c: d; + +<===> multiline_indent_level/more/output.css +a[b] { + c: d; +} + +<===> +================================================================================ +<===> error/mixed_syntax/block/input.sass a { b: c } -<===> error/mixed-syntax/block/error +<===> error/mixed_syntax/block/error Error: Expected newline. , 1 | a { @@ -32,14 +68,15 @@ Error: Expected newline. <===> ================================================================================ -<===> error/mixed-syntax/semicolon/input.sass +<===> error/semicolon_multiple_same_line/input.sass a - b: c; + b: c; d: e; -<===> error/mixed-syntax/semicolon/error -Error: semicolons aren't allowed in the indented syntax. +<===> error/semicolon_multiple_same_line/error +Error: multiple statements on one line are not supported in the indented syntax. , -2 | b: c; - | ^ +2 | b: c; d: e; + | ^ ' - input.sass 2:7 root stylesheet + input.sass 2:9 root stylesheet + diff --git a/spec/parser/interpolation.hrx b/spec/parser/interpolation.hrx new file mode 100644 index 0000000000..3c000c6271 --- /dev/null +++ b/spec/parser/interpolation.hrx @@ -0,0 +1,92 @@ +<===> whitespace/after_open/input.sass +a + b: #{ + c} + + +<===> whitespace/after_open/output.css +a { + b: c; +} + +<===> +================================================================================ +<===> whitespace/after_val/input.sass +a + b: #{c + } + + +<===> whitespace/after_val/output.css +a { + b: c; +} + +<===> +================================================================================ +<===> whitespace/between_vals/input.sass +a + b: #{c + d} + +<===> whitespace/between_vals/output.css +a { + b: c d; +} + +<===> +================================================================================ +<===> error/partial_bracket/scss/input.scss +[a#{"]:is(b"}) {c:d} + +<===> error/partial_bracket/scss/error +Error: expected "]". + , +1 | [a#{"]:is(b"}) {c:d} + | ^ + ' + input.scss 1:14 root stylesheet + +<===> +================================================================================ +<===> error/partial_bracket/sass/input.sass +[a#{"]:is(b"}) + c: d + +<===> error/partial_bracket/sass/error +Error: expected "]". + , +1 | [a#{"]:is(b"}) + | ^ + ' + input.sass 1:14 root stylesheet + +<===> +================================================================================ +<===> error/selector/unmatched_close_paren/input.sass +a:is(b)) + c: d + + +<===> error/selector/unmatched_close_paren/error +Error: Unexpected ")". + , +1 | a:is(b)) + | ^ + ' + input.sass 1:8 root stylesheet + +<===> +================================================================================ +<===> error/selector/unmatched_close_bracket/input.sass +a[b]] + c: d + + +<===> error/selector/unmatched_close_bracket/error +Error: Unexpected "]". + , +1 | a[b]] + | ^ + ' + input.sass 1:5 root stylesheet diff --git a/spec/parser/selector.hrx b/spec/parser/selector.hrx index 3b7f3ef7db..1fc11a6ee9 100644 --- a/spec/parser/selector.hrx +++ b/spec/parser/selector.hrx @@ -9,21 +9,6 @@ b: c; } -<===> -================================================================================ -<===> error/empty_placeholder/input.scss -% { - a: b; -} - -<===> error/empty_placeholder/error -Error: Expected identifier. - , -1 | % { - | ^ - ' - input.scss 1:2 root stylesheet - <===> ================================================================================ <===> inline/input.sass @@ -50,13 +35,85 @@ b { <===> ================================================================================ -<===> whitespace/input.sass +<===> newline/no_comma/input.sass +a +b + c: d + +<===> newline/no_comma/output.css +b { + c: d; +} + +<===> newline/no_comma/warning +WARNING: This selector doesn't have any properties and won't be rendered. + + , +1 | a + | ^ + ' + input.sass 1:1 root stylesheet + +<===> +================================================================================ +<===> newline/after_comma/input.sass +a, +b + c: d + +<===> newline/after_comma/output.css +a, +b { + c: d; +} + +<===> +================================================================================ +<===> newline/after_comma_indented/input.sass a, - b + b c: d -<===> whitespace/output.css +<===> newline/after_comma_indented/output.css a, b { c: d; } + +<===> +================================================================================ +<===> error/newline/before_comma/input.sass +a +,b + c: d + +<===> error/newline/before_comma/error +WARNING: This selector doesn't have any properties and won't be rendered. + + , +1 | a + | ^ + ' + input.sass 1:1 root stylesheet + +Error: expected selector. + , +1 | a + | ^ + ' + input.sass 1:2 root stylesheet + +<===> +================================================================================ +<===> error/empty_placeholder/input.scss +% { + a: b; +} + +<===> error/empty_placeholder/error +Error: Expected identifier. + , +1 | % { + | ^ + ' + input.scss 1:2 root stylesheet diff --git a/spec/values/lists/brackets.hrx b/spec/values/lists/brackets.hrx index 7834e943c8..47b1ec29cc 100644 --- a/spec/values/lists/brackets.hrx +++ b/spec/values/lists/brackets.hrx @@ -6,6 +6,78 @@ a { b: []; } +<===> +================================================================================ +<===> whitespace/empty/sass/input.sass +a + b: [ + ] + +<===> whitespace/empty/sass/output.css +a { + b: []; +} + +<===> +================================================================================ +<===> whitespace/single/after_lbracket/sass/input.sass +a + b: [ + c] + +<===> whitespace/single/after_lbracket/sass/output.css +a { + b: [c]; +} + +<===> +================================================================================ +<===> whitespace/single/after_val/sass/input.sass +a + b: [c + ] + +<===> whitespace/single/after_val/sass/output.css +a { + b: [c]; +} + +<===> +================================================================================ +<===> whitespace/multiple/after_lbracket/sass/input.sass +a + b: [ + c d] + +<===> whitespace/multiple/after_lbracket/sass/output.css +a { + b: [c d]; +} + +<===> +================================================================================ +<===> whitespace/multiple/after_val/sass/input.sass +a + b: [c + d] + +<===> whitespace/multiple/after_val/sass/output.css +a { + b: [c d]; +} + +<===> +================================================================================ +<===> whitespace/multiple/before_rbracket/sass/input.sass +a + b: [c d + ] + +<===> whitespace/multiple/before_rbracket/sass/output.css +a { + b: [c d]; +} + <===> ================================================================================ <===> single/input.scss diff --git a/spec/values/lists/sass.hrx b/spec/values/lists/sass.hrx index 0806f4d3c6..bacfaebd0b 100644 --- a/spec/values/lists/sass.hrx +++ b/spec/values/lists/sass.hrx @@ -20,69 +20,59 @@ a { <===> ================================================================================ -<===> inline/trailing-comma/input.sass +<===> inline/trailing_comma/input.sass a b: c, d, -<===> inline/trailing-comma/output.css +<===> inline/trailing_comma/output.css a { b: c, d; } <===> ================================================================================ -<===> error/paren/no-indent/input.sass +<===> paren/no_indent/input.sass a - value: ( -b, -c + b: ( +c, +d ) -<===> error/paren/no-indent/error -Error: expected ")". - , -2 | value: ( - | ^ - ' - input.sass 2:11 root stylesheet +<===> paren/no_indent/output.css +a { + b: c, d; +} <===> ================================================================================ -<===> error/paren/indented-under/input.sass +<===> paren/indented_under/input.sass a - value: ( - b, - c + b: ( + c, + d ) -<===> error/paren/indented-under/error -Error: expected ")". - , -2 | value: ( - | ^ - ' - input.sass 2:11 root stylesheet +<===> paren/indented_under/output.css +a { + b: c, d; +} <===> ================================================================================ -<===> error/paren/value-aligned/input.sass +<===> paren/value_aligned/input.sass a b: ( c d - e ) -<===> error/paren/value-aligned/error -Error: expected ")". - , -2 | b: ( c - | ^ - ' - input.sass 2:9 root stylesheet +<===> paren/value_aligned/output.css +a { + b: c d; +} <===> ================================================================================ -<===> error/paren/trailing-comma/input.sass +<===> paren/trailing_comma/input.sass a b: ( @@ -90,22 +80,63 @@ a d, ) -<===> error/paren/trailing-comma/error -Error: expected ")". +<===> paren/trailing_comma/output.css +a { + b: c, d; +} + +<===> +================================================================================ +<===> paren/whitespace/after_paren/input.sass +a + b: ( + c, d) + +<===> paren/whitespace/after_paren/output.css +a { + b: c, d; +} + +<===> +================================================================================ +<===> paren/whitespace/variable/input.sass +$a: (b, e + ) + +<===> paren/whitespace/variable/output.css + +<===> +================================================================================ +<===> paren/whitespace/variable_nested/input.sass +$a: (b c, e + ) + +<===> paren/whitespace/variable_nested/output.css + +<===> +================================================================================ +<===> error/paren/empty/whitespace/between/input.sass +a + b: ( + ) + +<===> error/paren/empty/whitespace/between/error +Error: () isn't a valid CSS value. , -3 | b: ( - | ^ +2 | b: ( + | ,------^ +3 | \ ) ' - input.sass 3:7 root stylesheet + input.sass 2:6 root stylesheet <===> ================================================================================ -<===> error/no-parens/no-trailing-comma/input.sass +<===> error/no_parens/no_trailing_comma/input.sass a b: c, d -<===> error/no-parens/no-trailing-comma/error +<===> error/no_parens/no_trailing_comma/error Error: expected ":". , 3 | d @@ -115,12 +146,12 @@ Error: expected ":". <===> ================================================================================ -<===> error/no-parens/trailing-comma/input.sass +<===> error/no_parens/trailing_comma/input.sass a b: c, d, -<===> error/no-parens/trailing-comma/error +<===> error/no_parens/trailing_comma/error Error: expected ":". , 3 | d, diff --git a/spec/values/maps/sass.hrx b/spec/values/maps/sass.hrx new file mode 100644 index 0000000000..992ddd5425 --- /dev/null +++ b/spec/values/maps/sass.hrx @@ -0,0 +1,76 @@ +<===> whitespace/none/input.sass +$a: (b: c, d: e) + +<===> whitespace/none/output.css + +<===> +================================================================================ +<===> whitespace/after_lparen/input.sass +$a: ( + b: c, d: e) + +<===> whitespace/after_lparen/output.css + +<===> +================================================================================ +<===> whitespace/after_first_key/input.sass +$a: (b + : c, d: e) + +<===> whitespace/after_first_key/output.css + +<===> +================================================================================ +<===> whitespace/after_first_colon/input.sass +$a: (b: + c, d: e) + +<===> whitespace/after_first_colon/output.css + +<===> +================================================================================ +<===> whitespace/after_first_value/input.sass +$a: (b: c + , d: e) + +<===> whitespace/after_first_value/output.css + +<===> +================================================================================ +<===> whitespace/between_values/input.sass +$a: (b: c + d, d: e) + +<===> whitespace/between_values/output.css + +<===> +================================================================================ +<===> whitespace/after_comma/input.sass +$a: (b: c, + d: e) + +<===> whitespace/after_comma/output.css + +<===> +================================================================================ +<===> whitespace/after_second_key/input.sass +$a: (b: c, d +: e) + +<===> whitespace/after_second_key/output.css + +<===> +================================================================================ +<===> whitespace/after_second_colon/input.sass +$a: (b: c, d: + e) + +<===> whitespace/after_second_colon/output.css + +<===> +================================================================================ +<===> whitespace/after_second_value/input.sass +$a: (b: c, d: e + ) + +<===> whitespace/after_second_value/output.css diff --git a/spec/variables.hrx b/spec/variables.hrx deleted file mode 100644 index f17dd75590..0000000000 --- a/spec/variables.hrx +++ /dev/null @@ -1,107 +0,0 @@ -<===> semi_global/in_local/double_nested/input.scss -// Regression test for sass/dart-sass#1250 -$a: global; -b { - @if true { - @if true { - $a: local; - } - } -} - -c {d: $a} - -<===> semi_global/in_local/double_nested/output.css -c { - d: global; -} - -<===> -================================================================================ -<===> double_flag/default/input.scss -$a: b !default !default; - -c {d: $a} - -<===> double_flag/default/output.css -c { - d: b; -} - -<===> double_flag/default/warning -DEPRECATION WARNING [duplicate-var-flags]: !default should only be written once for each variable. -This will be an error in Dart Sass 2.0.0. - - , -1 | $a: b !default !default; - | ^^^^^^^^ - ' - input.scss 1:16 root stylesheet - -<===> -================================================================================ -<===> double_flag/global/input.scss -$a: b; -c { - $a: d !global !global; - e: $a -} - -<===> double_flag/global/output.css -c { - e: d; -} - -<===> double_flag/global/warning -DEPRECATION WARNING [duplicate-var-flags]: !global should only be written once for each variable. -This will be an error in Dart Sass 2.0.0. - - , -3 | $a: d !global !global; - | ^^^^^^^ - ' - input.scss 3:17 root stylesheet - -<===> -================================================================================ -<===> comment/before_colon/loud/input.scss -$a /**/: b - -<===> comment/before_colon/loud/output.css - -<===> -================================================================================ -<===> comment/before_colon/silent/input.scss -$a // - : b - -<===> comment/before_colon/silent/output.css - -<===> -================================================================================ -<===> comment/after_colon/loud/input.scss -$a: /**/ b - -<===> comment/after_colon/loud/output.css - -<===> -================================================================================ -<===> comment/after_colon/silent/input.scss -$a: // - b - -<===> comment/after_colon/silent/output.css - -<===> -================================================================================ -<===> comment/after_value/loud/input.scss -$a: b /**/ - -<===> comment/after_value/loud/output.css - -<===> -================================================================================ -<===> comment/after_value/silent/input.scss -$a: b // - -<===> comment/after_value/silent/output.css diff --git a/spec/variables/comments.hrx b/spec/variables/comments.hrx new file mode 100644 index 0000000000..1fbc3cf47b --- /dev/null +++ b/spec/variables/comments.hrx @@ -0,0 +1,41 @@ +<===> before_colon/loud/input.scss +$a /**/: b + +<===> before_colon/loud/output.css + +<===> +================================================================================ +<===> before_colon/silent/input.scss +$a // + : b + +<===> before_colon/silent/output.css + +<===> +================================================================================ +<===> after_colon/loud/input.scss +$a: /**/ b + +<===> after_colon/loud/output.css + +<===> +================================================================================ +<===> after_colon/silent/input.scss +$a: // + b + +<===> after_colon/silent/output.css + +<===> +================================================================================ +<===> after_value/loud/input.scss +$a: b /**/ + +<===> after_value/loud/output.css + +<===> +================================================================================ +<===> after_value/silent/input.scss +$a: b // + +<===> after_value/silent/output.css diff --git a/spec/variables/double_flag.hrx b/spec/variables/double_flag.hrx new file mode 100644 index 0000000000..59cec6c857 --- /dev/null +++ b/spec/variables/double_flag.hrx @@ -0,0 +1,43 @@ +<===> default/input.scss +$a: b !default !default; + +c {d: $a} + +<===> default/output.css +c { + d: b; +} + +<===> default/warning +DEPRECATION WARNING [duplicate-var-flags]: !default should only be written once for each variable. +This will be an error in Dart Sass 2.0.0. + + , +1 | $a: b !default !default; + | ^^^^^^^^ + ' + input.scss 1:16 root stylesheet + +<===> +================================================================================ +<===> global/input.scss +$a: b; +c { + $a: d !global !global; + e: $a +} + +<===> global/output.css +c { + e: d; +} + +<===> global/warning +DEPRECATION WARNING [duplicate-var-flags]: !global should only be written once for each variable. +This will be an error in Dart Sass 2.0.0. + + , +3 | $a: d !global !global; + | ^^^^^^^ + ' + input.scss 3:17 root stylesheet diff --git a/spec/variables/semi_global.hrx b/spec/variables/semi_global.hrx new file mode 100644 index 0000000000..dc33ea689a --- /dev/null +++ b/spec/variables/semi_global.hrx @@ -0,0 +1,17 @@ +<===> in_local/double_nested/input.scss +// Regression test for sass/dart-sass#1250 +$a: global; +b { + @if true { + @if true { + $a: local; + } + } +} + +c {d: $a} + +<===> in_local/double_nested/output.css +c { + d: global; +} diff --git a/spec/variables/semicolon.hrx b/spec/variables/semicolon.hrx new file mode 100644 index 0000000000..fa74dafe16 --- /dev/null +++ b/spec/variables/semicolon.hrx @@ -0,0 +1,9 @@ +<===> sass/input.sass +$a: b; +c + d: $a + +<===> sass/output.css +c { + d: b; +} diff --git a/spec/variables/whitespace.hrx b/spec/variables/whitespace.hrx new file mode 100644 index 0000000000..788bfbbcf8 --- /dev/null +++ b/spec/variables/whitespace.hrx @@ -0,0 +1,118 @@ +<===> before_colon/scss/input.scss +$a + : b + +<===> before_colon/scss/output.css + +<===> +================================================================================ +<===> before_colon/sass/input.sass +$a + : b + +<===> before_colon/sass/output.css + +<===> +================================================================================ +<===> after_colon/scss/input.scss +$a: + b + +<===> after_colon/scss/output.css + +<===> +================================================================================ +<===> after_colon/sass/input.sass +$a: + b + +<===> after_colon/sass/output.css + +<===> +================================================================================ +<===> before_default/scss/input.scss +$a: b + !default; + +<===> before_default/scss/output.css + +<===> +================================================================================ +<===> between_double_default/scss/input.scss +$a: b !default + !default; + +<===> between_double_default/scss/output.css + +<===> between_double_default/scss/warning +DEPRECATION WARNING [duplicate-var-flags]: !default should only be written once for each variable. +This will be an error in Dart Sass 2.0.0. + + , +2 | !default; + | ^^^^^^^^ + ' + input.scss 2:3 root stylesheet + +<===> +================================================================================ +<===> before_global/scss/input.scss +$a: b + !global; + +<===> before_global/scss/output.css + +<===> before_global/scss/warning +DEPRECATION WARNING [new-global]: As of Dart Sass 2.0.0, !global assignments won't be able to declare new variables. + +Since this assignment is at the root of the stylesheet, the !global flag is +unnecessary and can safely be removed. + + , +1 | / $a: b +2 | | !global; + | '---------^ + ' + input.scss 1:1 root stylesheet + +<===> +================================================================================ +<===> error/before_default/sass/input.sass +$a: b + !default + +<===> error/before_default/sass/error +Error: Nothing may be indented beneath a variable declaration. + , +2 | !default + | ^ + ' + input.sass 2:3 root stylesheet + +<===> +================================================================================ +<===> error/between_double_default/sass/input.sass +$a: b !default + !default + +<===> error/between_double_default/sass/error +Error: Nothing may be indented beneath a variable declaration. + , +2 | !default + | ^ + ' + input.sass 2:3 root stylesheet + +<===> +================================================================================ +<===> error/before_global/sass/input.sass +$a: b + !global + +<===> error/before_global/sass/error +Error: Nothing may be indented beneath a variable declaration. + , +2 | !global + | ^ + ' + input.sass 2:3 root stylesheet