diff --git a/spec/css/function.hrx b/spec/css/function.hrx new file mode 100644 index 000000000..02c1b6c4e --- /dev/null +++ b/spec/css/function.hrx @@ -0,0 +1,309 @@ +<===> lowercase/parameter/input.scss +@function --a(--b ) {result: c} + +<===> lowercase/parameter/output.css +@function --a(--b ) { + result: c; +} + +<===> +================================================================================ +<===> lowercase/returns/input.scss +@function --a() returns {result: b} + +<===> lowercase/returns/output.css +@function --a() returns { + result: b; +} + +<===> +================================================================================ +<===> lowercase/interpolation/input.scss +@function --#{a}() {result: b} + +<===> lowercase/interpolation/output.css +@function --a() { + result: b; +} + +<===> +================================================================================ +<===> lowercase/result/sass_script/input.scss +@function --a() { + result: $b; +} + +<===> lowercase/result/sass_script/output.css +@function --a() { + result: $b; +} + +<===> +================================================================================ +<===> lowercase/result/characters/input.scss +@function --a() { + result: {}#&%^*; +} + +<===> lowercase/result/characters/output.css +@function --a() { + result: {}#&%^*; +} + +<===> +================================================================================ +<===> lowercase/result/interpolation/input.scss +@function --a() { + result: #{1 + 1}; +} + +<===> lowercase/result/interpolation/output.css +@function --a() { + result: 2; +} + +<===> +================================================================================ +<===> uppercase/result/sass_script/input.scss +@FUNCTION --a() { + result: $b; +} + +<===> uppercase/result/sass_script/output.css +@FUNCTION --a() { + result: $b; +} + +<===> +================================================================================ +<===> uppercase/result/characters/input.scss +@FUNCTION --a() { + result: {}#&%^*; +} + +<===> uppercase/result/characters/output.css +@FUNCTION --a() { + result: {}#&%^*; +} + +<===> +================================================================================ +<===> uppercase/result/interpolation/input.scss +@FUNCTION --a() { + result: #{1 + 1}; +} + +<===> uppercase/result/interpolation/output.css +@FUNCTION --a() { + result: 2; +} + +<===> +================================================================================ +<===> uppercase/result/nesting/input.scss +@function --a() { + RESULT: {b: c}; +} + +<===> uppercase/result/nesting/output.css +@function --a() { + RESULT: {b: c}; +} + +<===> +================================================================================ +<===> interpolated/result/sass_script/input.scss +@#{function} --a() { + result: 1 + 1; +} + +<===> interpolated/result/sass_script/output.css +@function --a() { + result: 2; +} + +<===> +================================================================================ +<===> interpolated/result/nested/input.sass +@function --a() + #{result}: + b: c + +<===> interpolated/result/nested/output.css +@function --a() { + result-b: c; +} + +<===> +================================================================================ +<===> result/uppercase/sass_script/input.scss +@function --a() { + RESULT: $b; +} + +<===> result/uppercase/sass_script/output.css +@function --a() { + RESULT: $b; +} + +<===> +================================================================================ +<===> result/uppercase/characters/input.scss +@function --a() { + RESULT: {}#&%^*; +} + +<===> result/uppercase/characters/output.css +@function --a() { + RESULT: {}#&%^*; +} + +<===> +================================================================================ +<===> result/uppercase/interpolation/input.scss +@function --a() { + RESULT: #{1 + 1}; +} + +<===> result/uppercase/interpolation/output.css +@function --a() { + RESULT: 2; +} + +<===> +================================================================================ +<===> result/interpolated/sass_script/input.scss +@function --a() { + #{result}: 1 + 1; +} + +<===> result/interpolated/sass_script/output.css +@function --a() { + result: 2; +} + +<===> +================================================================================ +<===> result/interpolated/nested/input.sass +@function --a() + #{result}: + b: c + +<===> result/interpolated/nested/output.css +@function --a() { + result-b: c; +} + +<===> +================================================================================ +<===> result/style_rule/sass_script/input.scss +.a { + result: 1 + 1; +} + +<===> result/style_rule/sass_script/output.css +.a { + result: 2; +} + +<===> +================================================================================ +<===> result/style_rule/interpolation/input.scss +.a { + result: #{1 + 1}; +} + +<===> result/style_rule/interpolation/output.css +.a { + result: 2; +} + +<===> +================================================================================ +<===> error/lowercase/result/nested/input.sass +@function --a() + result: + b: c + +<===> error/lowercase/result/nested/error +Error: Nothing may be indented beneath a @function result. + , +3 | b: c + | ^ + ' + input.sass 3:5 root stylesheet + +<===> +================================================================================ +<===> error/uppercase/result/nested/input.sass +@FUNCTION --a() + result: + b: c + +<===> error/uppercase/result/nested/error +Error: Nothing may be indented beneath a @function result. + , +3 | b: c + | ^ + ' + input.sass 3:5 root stylesheet + +<===> +================================================================================ +<===> error/interpolated/result/characters/input.scss +@#{function} --a() { + result: {}#&%^*; +} + +<===> error/interpolated/result/characters/error +Error: expected "{". + , +2 | result: {}#&%^*; + | ^ + ' + input.scss 2:18 root stylesheet + +<===> +================================================================================ +<===> error/result/uppercase/nested/input.sass +@function --a() + RESULT: + b: c + +<===> error/result/uppercase/nested/error +Error: Nothing may be indented beneath a @function result. + , +3 | b: c + | ^ + ' + input.sass 3:5 root stylesheet + +<===> +================================================================================ +<===> error/result/interpolated/characters/input.scss +@function --a() { + #{result}: {}#&%^*; +} + +<===> error/result/interpolated/characters/error +Error: expected "{". + , +2 | #{result}: {}#&%^*; + | ^ + ' + input.scss 2:21 root stylesheet + +<===> +================================================================================ +<===> error/result/style_rule/characters/input.scss +.a { + result: {}#&%^*; +} + +<===> error/result/style_rule/characters/error +Error: expected "{". + , +2 | result: {}#&%^*; + | ^ + ' + input.scss 2:18 root stylesheet diff --git a/spec/css/plain/function.hrx b/spec/css/plain/function.hrx new file mode 100644 index 000000000..67a4977f3 --- /dev/null +++ b/spec/css/plain/function.hrx @@ -0,0 +1,113 @@ +<===> lowercase/parameter/input.scss +@use "plain"; + +<===> lowercase/parameter/plain.css +@function --a(--b ) {result: c} + +<===> lowercase/parameter/output.css +@function --a(--b ) { + result: c; +} + +<===> +================================================================================ +<===> lowercase/returns/input.scss +@use "plain"; + +<===> lowercase/returns/plain.css +@function --a() returns {result: b} + +<===> lowercase/returns/output.css +@function --a() returns { + result: b; +} + +<===> +================================================================================ +<===> lowercase/result/sass_script/input.scss +@use "plain"; + +<===> lowercase/result/sass_script/plain.css +@function --a() { + result: $b; +} + +<===> lowercase/result/sass_script/output.css +@function --a() { + result: $b; +} + +<===> +================================================================================ +<===> lowercase/result/characters/input.scss +@use "plain"; + +<===> lowercase/result/characters/plain.css +@function --a() { + result: {}#&%^*; +} + +<===> lowercase/result/characters/output.css +@function --a() { + result: {}#&%^*; +} + +<===> +================================================================================ +<===> uppercase/result/sass_script/input.scss +@use "plain"; + +<===> uppercase/result/sass_script/plain.css +@FUNCTION --a() { + result: $b; +} + +<===> uppercase/result/sass_script/output.css +@FUNCTION --a() { + result: $b; +} + +<===> +================================================================================ +<===> uppercase/result/characters/input.scss +@use "plain"; + +<===> uppercase/result/characters/plain.css +@FUNCTION --a() { + result: {}#&%^*; +} + +<===> uppercase/result/characters/output.css +@FUNCTION --a() { + result: {}#&%^*; +} + +<===> +================================================================================ +<===> result/uppercase/sass_script/input.scss +@use "plain"; + +<===> result/uppercase/sass_script/plain.css +@function --a() { + RESULT: $b; +} + +<===> result/uppercase/sass_script/output.css +@function --a() { + RESULT: $b; +} + +<===> +================================================================================ +<===> result/uppercase/characters/input.scss +@use "plain"; + +<===> result/uppercase/characters/plain.css +@function --a() { + RESULT: {}#&%^*; +} + +<===> result/uppercase/characters/output.css +@function --a() { + RESULT: {}#&%^*; +} diff --git a/spec/css/propset.hrx b/spec/css/propset.hrx index ad6b30661..6394fe5ad 100644 --- a/spec/css/propset.hrx +++ b/spec/css/propset.hrx @@ -115,7 +115,7 @@ a { b: { --d: e } } Error: Declarations whose names begin with "--" may not be nested. , 1 | a { b: { --d: e } } - | ^^^^^^^ + | ^^^ ' input.scss 1:10 root stylesheet @@ -128,7 +128,7 @@ a { b: { --d: {e: f} } } Error: Declarations whose names begin with "--" may not be nested. , 1 | a { b: { --d: {e: f} } } - | ^^^^^^^^^^^ + | ^^^ ' input.scss 1:10 root stylesheet @@ -141,6 +141,6 @@ a { b: { --d: e {--f: g} } } Error: Declarations whose names begin with "--" may not be nested. , 1 | a { b: { --d: e {--f: g} } } - | ^^^^^^^^^^^^^^^ + | ^^^ ' input.scss 1:10 root stylesheet diff --git a/spec/css/style_rule.hrx b/spec/css/style_rule.hrx index dde147f33..0e920f7d2 100644 --- a/spec/css/style_rule.hrx +++ b/spec/css/style_rule.hrx @@ -254,6 +254,20 @@ a { b: c; } +<===> +================================================================================ +<===> declaration/result/input.scss +a { + // Outside of a plain CSS `@function`, `result` is parsed like any other + // declaration. + result: 1 + 1; +} + +<===> declaration/result/output.css +a { + result: 2; +} + <===> ================================================================================ <===> sass/declaration/semicolon/input.sass diff --git a/spec/directives/function/name.hrx b/spec/directives/function/name.hrx index d44aabf10..d2126fbc2 100644 --- a/spec/directives/function/name.hrx +++ b/spec/directives/function/name.hrx @@ -1,45 +1,12 @@ -<===> custom_ident/define/input.scss -@function --a() {@return 1} -b {c: --a()} - -<===> custom_ident/define/output.css -b { - c: 1; -} - -<===> custom_ident/define/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 - - , -1 | @function --a() {@return 1} - | ^^^ - ' - input.scss 1:11 root stylesheet - -<===> -================================================================================ <===> custom_ident/call/input.scss @function __a() {@return 1} b {c: --a()} <===> custom_ident/call/output.css b { - c: 1; + c: --a(); } -<===> 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 - <===> ================================================================================ <===> double_underscore/input.scss diff --git a/spec/directives/mixin/custom_ident_include.hrx b/spec/directives/mixin/custom_ident_include.hrx index 9672eaca1..ca0ef84b1 100644 --- a/spec/directives/mixin/custom_ident_include.hrx +++ b/spec/directives/mixin/custom_ident_include.hrx @@ -2,18 +2,12 @@ @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. +<===> error +Error: Sass @mixin names beginning with -- are forbidden 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 + input.scss 2:13 root stylesheet diff --git a/spec/directives/mixin/custom_ident_name.hrx b/spec/directives/mixin/custom_ident_name.hrx deleted file mode 100644 index 9a49d6d32..000000000 --- a/spec/directives/mixin/custom_ident_name.hrx +++ /dev/null @@ -1,19 +0,0 @@ -<===> 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