diff --git a/spec/core_functions/math/abs.hrx b/spec/core_functions/math/abs.hrx index cc9e2f868..faaf3ec47 100644 --- a/spec/core_functions/math/abs.hrx +++ b/spec/core_functions/math/abs.hrx @@ -1,5 +1,12 @@ +<===> options.yml +--- +:ignore_for: +- libsass + +<===> +================================================================================ <===> zero/input.scss -@use "sass:math" as math; +@use "sass:math"; a {b: math.abs(0)} <===> zero/output.css @@ -10,7 +17,7 @@ a { <===> ================================================================================ <===> positive/integer/input.scss -@use "sass:math" as math; +@use "sass:math"; a {b: math.abs(1)} <===> positive/integer/output.css @@ -21,7 +28,7 @@ a { <===> ================================================================================ <===> positive/decimal/input.scss -@use "sass:math" as math; +@use "sass:math"; a {b: math.abs(5.6)} <===> positive/decimal/output.css @@ -32,7 +39,7 @@ a { <===> ================================================================================ <===> negative/integer/input.scss -@use "sass:math" as math; +@use "sass:math"; a {b: math.abs(-17)} <===> negative/integer/output.css @@ -43,7 +50,7 @@ a { <===> ================================================================================ <===> negative/decimal/input.scss -@use "sass:math" as math; +@use "sass:math"; a {b: math.abs(-123.456)} <===> negative/decimal/output.css @@ -58,7 +65,7 @@ a { - sass/libsass#2887 <===> preserves_units/input.scss -@use "sass:math" as math; +@use "sass:math"; a {b: math.abs(-7px / 4em) * 1em} <===> preserves_units/output.css @@ -82,9 +89,8 @@ More info and automated migrator: https://sass-lang.com/d/slash-div <===> ================================================================================ <===> named/input.scss -@use "sass:math" as math; -$number: -3; -a {b: math.abs($number)} +@use "sass:math"; +a { b: math.abs($number: 3)} <===> named/output.css a { @@ -94,7 +100,7 @@ a { <===> ================================================================================ <===> error/type/input.scss -@use "sass:math" as math; +@use "sass:math"; a {b: math.abs(c)} <===> error/type/error @@ -116,7 +122,7 @@ Error: argument `$number` of `math.abs($number)` must be a number <===> ================================================================================ <===> error/too_few_args/input.scss -@use "sass:math" as math; +@use "sass:math"; a {b: math.abs()} <===> error/too_few_args/error @@ -141,7 +147,7 @@ Error: Function abs is missing argument $number. <===> ================================================================================ <===> error/too_many_args/input.scss -@use "sass:math" as math; +@use "sass:math"; a {b: math.abs(1, 2)} <===> error/too_many_args/error diff --git a/spec/core_functions/math/pow/arguments.hrx b/spec/core_functions/math/pow/arguments.hrx index b8efdfccd..39e542f50 100644 --- a/spec/core_functions/math/pow/arguments.hrx +++ b/spec/core_functions/math/pow/arguments.hrx @@ -42,7 +42,7 @@ Error: $exponent: "0" is not a number. a {b: math.pow(1px, 0)} <===> error/base_has_units/error -Error: Expected 1px to have no units. +Error: $base: Expected 1px to have no units. , 2 | a {b: math.pow(1px, 0)} | ^^^^^^^^^^^^^^^^ @@ -56,7 +56,7 @@ Error: Expected 1px to have no units. a {b: math.pow(0, 1px)} <===> error/exponent_has_units/error -Error: Expected 1px to have no units. +Error: $exponent: Expected 1px to have no units. , 2 | a {b: math.pow(0, 1px)} | ^^^^^^^^^^^^^^^^ diff --git a/spec/core_functions/math/round.hrx b/spec/core_functions/math/round.hrx index 157eca826..e448d16d1 100644 --- a/spec/core_functions/math/round.hrx +++ b/spec/core_functions/math/round.hrx @@ -1,3 +1,10 @@ +<===> options.yml +--- +:ignore_for: +- libsass + +<===> +================================================================================ <===> integer/input.scss @use "sass:math"; a {b: math.round(1)} diff --git a/spec/core_functions/math/sqrt.hrx b/spec/core_functions/math/sqrt.hrx index 9b635cd54..f6574c62c 100644 --- a/spec/core_functions/math/sqrt.hrx +++ b/spec/core_functions/math/sqrt.hrx @@ -112,7 +112,7 @@ Error: $number: "0" is not a number. a {b: math.sqrt(1px)} <===> error/units/error -Error: Expected 1px to have no units. +Error: $number: Expected 1px to have no units. , 2 | a {b: math.sqrt(1px)} | ^^^^^^^^^^^^^^ diff --git a/spec/values/calculation/abs.hrx b/spec/values/calculation/abs.hrx index b18e503e4..363cf5ab4 100644 --- a/spec/values/calculation/abs.hrx +++ b/spec/values/calculation/abs.hrx @@ -25,40 +25,117 @@ a { <===> ================================================================================ <===> positive/decimal/input.scss -a {b: abs(5.6)} +a {b: abs(-5.6px)} <===> positive/decimal/output.css a { - b: 5.6; + b: 5.6px; } <===> ================================================================================ -<===> negative/integer/input.scss -a {b: abs(-17)} +<===> operation/integer/input.scss +a {b: abs(17 * 5%)} -<===> negative/integer/output.css +<===> operation/integer/output.css a { - b: 17; + b: 85%; } +<===> operation/integer/warning +DEPRECATION WARNING: Passing percentage units to the global abs() function is deprecated. +In the future, this will emit a CSS abs() function to be resolved by the browser. + +To preserve current behavior: +math.abs(85%) +To emit a CSS abs() now: +abs(#{85%}) +More info: https://sass-lang.com/documentation/values/calculations#abs + , +1 | a {b: abs(17 * 5%)} + | ^^^^^^^^^^^^^^^^^^^ + ' + input.scss 1:1 root stylesheet + <===> ================================================================================ -<===> negative/decimal/input.scss -a {b: abs(-123.456)} +<===> operation/variable/input.scss +a { + --test: 5; + b: abs(1px + 2px - var(--test)) +} -<===> negative/decimal/output.css +<===> operation/variable/output.css a { - b: 123.456; + --test: 5; + b: abs(3px - var(--test)); } <===> ================================================================================ -<===> named/input.scss -$number: -3; -a {b: abs($number)} +<===> operation/incompatible_units/input.scss +a {b: abs(17px * 5%)} + +<===> operation/incompatible_units/error +Error: 85px*% isn't a valid CSS value. + , +1 | a {b: abs(17px * 5%)} + | ^^^^^^^^^^^^^^ + ' + input.scss 1:7 root stylesheet -<===> named/output.css +<===> +================================================================================ +<===> preserved/operation/incompatible_units/input.scss +a {b: abs(17px + 5%)} + +<===> preserved/operation/incompatible_units/output.css +a { + b: abs(17px + 5%); +} + +<===> +================================================================================ +<===> preserved/variable/input.scss +a { + --test: 5; + b: abs(var(--test)) +} + +<===> preserved/variable/output.css +a { + --test: 5; + b: abs(var(--test)); +} + +<===> +================================================================================ +<===> preserved/unknown_variable/input.scss +a {b: abs(test)} + +<===> preserved/unknown_variable/output.css +a { + b: abs(test); +} + +<===> +================================================================================ +<===> preserved/unquoted_string/input.scss +a { + b: abs(test); +} + +<===> preserved/unquoted_string/output.css +a { + b: abs(test); +} + +<===> +================================================================================ +<===> named_argument/input.scss +a {b: abs($number: -3)} + +<===> named_argument/output.css a { b: 3; } @@ -70,7 +147,7 @@ a {b: abs(-7px / 4em) * 1em} <===> preserves_units/output.css a { - b: 1.75em; + b: 1.75px; } <===> @@ -79,26 +156,33 @@ a { a {b: abs()} <===> error/too_few_args/error -Error: Expected number, variable, function, or calculation. - , +Error: Missing argument $number. + ,--> input.scss 1 | a {b: abs()} - | ^ + | ^^^^^ invocation + ' + ,--> sass:math +1 | @function abs($number) { + | ============ declaration ' - input.scss 1:11 root stylesheet + input.scss 1:7 root stylesheet <===> ================================================================================ <===> error/too_many_args/input.scss a {b: abs(1, 2)} - <===> error/too_many_args/error -Error: expected "+", "-", "*", "/", or ")". - , +Error: Only 1 argument allowed, but 2 were passed. + ,--> input.scss 1 | a {b: abs(1, 2)} - | ^ + | ^^^^^^^^^ invocation + ' + ,--> sass:math +1 | @function abs($number) { + | ============ declaration ' - input.scss 1:12 root stylesheet + input.scss 1:7 root stylesheet <===> ================================================================================ @@ -107,16 +191,18 @@ a {b: abs(-7.5%)} <===> abs_percentage_warning/output.css a { - b: 7.5; + b: 7.5%; } <===> abs_percentage_warning/warning -DEPRECATION WARNING: Passing percentage units to the global abs() function is deprecated In the future, this will emit a CSS abs() function to be resolved by the browser. +DEPRECATION WARNING: Passing percentage units to the global abs() function is deprecated. +In the future, this will emit a CSS abs() function to be resolved by the browser. + To preserve current behavior: math.abs(-7.5%) To emit a CSS abs() now: abs(#{-7.5%}) -More info: https://sass-lang.com/d/abs-percent +More info: https://sass-lang.com/documentation/values/calculations#abs , 1 | a {b: abs(-7.5%)} | ^^^^^^^^^^^^^^^^^ diff --git a/spec/values/calculation/acos.hrx b/spec/values/calculation/acos.hrx index a9c52d66a..f5aaf25a7 100644 --- a/spec/values/calculation/acos.hrx +++ b/spec/values/calculation/acos.hrx @@ -74,14 +74,67 @@ a { <===> ================================================================================ -<===> units/input.scss -a {b: acos(1px)} +<===> preserved/percent/input.scss +a {b: acos(3px - 1.5px + 5%)} -<===> units/output.css +<===> preserved/percent/output.css a { - b: 0deg; + b: acos(1.5px + 5%); +} + +<===> +================================================================================ +<===> preserved/operation/variable/input.scss +a { + --test: 5; + b: acos(3px - 1px + var(--test)); +} + +<===> preserved/operation/variable/output.css +a { + --test: 5; + b: acos(2px + var(--test)); } +<===> +================================================================================ +<===> preserved/variable/input.scss +a { + --test: 5; + b: acos(var(--test)); +} + +<===> preserved/variable/output.css +a { + --test: 5; + b: acos(var(--test)); +} + +<===> +================================================================================ +<===> preserved/unquoted_string/input.scss +a { + b: acos(test); +} + +<===> preserved/unquoted_string/output.css +a { + b: acos(test); +} + +<===> +================================================================================ +<===> units/input.scss +a {b: acos(1px)} + +<===> units/error +Error: $number: Expected 1px to have no units. + , +1 | a {b: acos(1px)} + | ^^^^^^^^^ + ' + input.scss 1:7 root stylesheet + <===> ================================================================================ <===> error/type/input.scss diff --git a/spec/values/calculation/asin.hrx b/spec/values/calculation/asin.hrx index 86bedf489..ad3321fa3 100644 --- a/spec/values/calculation/asin.hrx +++ b/spec/values/calculation/asin.hrx @@ -107,10 +107,13 @@ a { <===> units/input.scss a {b: asin(1px)} -<===> units/output.css -a { - b: 90deg; -} +<===> units/error +Error: $number: Expected 1px to have no units. + , +1 | a {b: asin(1px)} + | ^^^^^^^^^ + ' + input.scss 1:7 root stylesheet <===> ================================================================================ @@ -122,6 +125,56 @@ a { b: asin(1%); } +<===> +================================================================================ +<===> preserved/percent/input.scss +a {b: asin(3px - 1.5px + 5%)} + +<===> preserved/percent/output.css +a { + b: asin(1.5px + 5%); +} + +<===> +================================================================================ +<===> preserved/operation/variable/input.scss +a { + --test: 5; + b: asin(3px - 1px + var(--test)); +} + +<===> preserved/operation/variable/output.css +a { + --test: 5; + b: asin(2px + var(--test)); +} + +<===> +================================================================================ +<===> preserved/variable/input.scss +a { + --test: 5; + b: asin(var(--test)); +} + +<===> preserved/variable/output.css +a { + --test: 5; + b: asin(var(--test)); +} + +<===> +================================================================================ +<===> preserved/unquoted_string/input.scss +a { + b: asin(test); +} + +<===> preserved/unquoted_string/output.css +a { + b: asin(test); +} + <===> ================================================================================ <===> error/type/input.scss diff --git a/spec/values/calculation/atan.hrx b/spec/values/calculation/atan.hrx index b06b95cc9..5def26f8b 100644 --- a/spec/values/calculation/atan.hrx +++ b/spec/values/calculation/atan.hrx @@ -5,7 +5,7 @@ terseness' sake isn't tested explicitly. <===> ================================================================================ <===> negative_infinity/input.scss -@use "sass:math" as math; +@use "sass:math"; a {b: atan(math.div(-1, 0))} <===> negative_infinity/output.css @@ -76,7 +76,7 @@ a { <===> ================================================================================ <===> infinity/input.scss -@use "sass:math" as math; +@use "sass:math"; a {b: atan(math.div(1, 0))} <===> infinity/output.css @@ -89,9 +89,62 @@ a { <===> units/input.scss a {b: atan(1px)} -<===> units/output.css +<===> units/error +Error: $number: Expected 1px to have no units. + , +1 | a {b: atan(1px)} + | ^^^^^^^^^ + ' + input.scss 1:7 root stylesheet + +<===> +================================================================================ +<===> preserved/percent/input.scss +a {b: atan(3px - 1.5px + 5%)} + +<===> preserved/percent/output.css a { - b: 45deg; + b: atan(1.5px + 5%); +} + +<===> +================================================================================ +<===> preserved/operation/variable/input.scss +a { + --test: 5; + b: atan(3px - 1px + var(--test)); +} + +<===> preserved/operation/variable/output.css +a { + --test: 5; + b: atan(2px + var(--test)); +} + +<===> +================================================================================ +<===> preserved/variable/input.scss +a { + --test: 5; + b: atan(var(--test)); +} + +<===> preserved/variable/output.css +a { + --test: 5; + b: atan(var(--test)); +} + +<===> +================================================================================ +<===> preserved/unquoted_string/input.scss +a { + b: atan(test); +} + +<===> preserved/unquoted_string/output.css +a { + b: atan(test); } <===> diff --git a/spec/values/calculation/atan2.hrx b/spec/values/calculation/atan2.hrx index f7323ffb0..d12cb6b31 100644 --- a/spec/values/calculation/atan2.hrx +++ b/spec/values/calculation/atan2.hrx @@ -34,20 +34,55 @@ a { b: atan2(1%, 1cm); } +<===> +================================================================================ +<===> preserved/percent/input.scss +a {b: atan2(4px, 3px - 1.5px + 5%)} + +<===> preserved/percent/output.css +a { + b: atan2(4px, 1.5px + 5%); +} + +<===> +================================================================================ +<===> preserved/operation/variable/input.scss +a { + --test: 5; + b: atan2(3px - 1px + var(--test), 4px); +} + +<===> preserved/operation/variable/output.css +a { + --test: 5; + b: atan2(2px + var(--test), 4px); +} + <===> ================================================================================ <===> preserved/variable/input.scss a { - --two-args: 2, 3; - b: atan2(var(--two-args)); + --test: 5; + b: atan2(var(--test)); } <===> preserved/variable/output.css a { - --two-args: 2, 3; - b: atan2(var(--two-args)); + --test: 5; + b: atan2(var(--test)); +} + +<===> +================================================================================ +<===> preserved/unquoted_string/input.scss +a { + b: atan2(test); } +<===> preserved/unquoted_string/output.css +a { + b: atan2(test); +} <===> ================================================================================ @@ -168,3 +203,16 @@ Error: expected "+", "-", "*", "/", or ")". | ^ ' input.scss 1:17 root stylesheet + +<===> +================================================================================ +<===> error/syntax/quoted_string/input.scss +a {b: atan2("test")} + +<===> error/syntax/quoted_string/error +Error: Expected number, variable, function, or calculation. + , +1 | a {b: atan2("test")} + | ^ + ' + input.scss 1:13 root stylesheet diff --git a/spec/values/calculation/cos.hrx b/spec/values/calculation/cos.hrx index 1aa98ad9b..79219392f 100644 --- a/spec/values/calculation/cos.hrx +++ b/spec/values/calculation/cos.hrx @@ -5,7 +5,7 @@ terseness' sake isn't tested explicitly. <===> ================================================================================ <===> negative_infinity/input.scss -@use "sass:math" as math; +@use "sass:math"; a {b: cos(math.div(-1, 0))} <===> negative_infinity/output.css @@ -16,7 +16,7 @@ a { <===> ================================================================================ <===> infinity/input.scss -@use "sass:math" as math; +@use "sass:math"; a {b: cos(math.div(1, 0))} <===> infinity/output.css @@ -95,6 +95,56 @@ a { b: 0.5403023059; } +<===> +================================================================================ +<===> preserved/percent/input.scss +a {b: cos(3px - 1.5px + 5%)} + +<===> preserved/percent/output.css +a { + b: cos(1.5px + 5%); +} + +<===> +================================================================================ +<===> preserved/operation/variable/input.scss +a { + --test: 5; + b: cos(3px - 1px + var(--test)); +} + +<===> preserved/operation/variable/output.css +a { + --test: 5; + b: cos(2px + var(--test)); +} + +<===> +================================================================================ +<===> preserved/variable/input.scss +a { + --test: 5; + b: cos(var(--test)); +} + +<===> preserved/variable/output.css +a { + --test: 5; + b: cos(var(--test)); +} + +<===> +================================================================================ +<===> preserved/unquoted_string/input.scss +a { + b: cos(test); +} + +<===> preserved/unquoted_string/output.css +a { + b: cos(test); +} + <===> ================================================================================ <===> error/type/input.scss diff --git a/spec/values/calculation/exp.hrx b/spec/values/calculation/exp.hrx index 80e987578..5633606ec 100644 --- a/spec/values/calculation/exp.hrx +++ b/spec/values/calculation/exp.hrx @@ -79,44 +79,80 @@ a { <===> ================================================================================ -<===> preserved/operation/unitless/result_is_integer/input.scss +<===> operation/unitless/result_is_integer/input.scss a {b: exp(5)} -<===> preserved/operation/unitless/result_is_integer/output.css +<===> operation/unitless/result_is_integer/output.css a { b: 148.4131591026; } <===> ================================================================================ -<===> preserved/operation/unitless/result_is_long/input.scss +<===> operation/unitless/result_is_long/input.scss a {b: exp(1000.65)} -<===> preserved/operation/unitless/result_is_long/output.css +<===> operation/unitless/result_is_long/output.css a { b: calc(infinity); } <===> ================================================================================ -<===> preserved/operation/math_nested/negative/input.scss +<===> operation/math_nested/negative/input.scss a {b: calc(exp(5 * 8 - 100))} -<===> preserved/operation/math_nested/negative/output.css +<===> operation/math_nested/negative/output.css a { b: 0; } +<===> +================================================================================ +<===> preserved/percent/input.scss +a {b: exp(3px - 1.5px + 5%)} + +<===> preserved/percent/output.css +a { + b: exp(1.5px + 5%); +} + +<===> +================================================================================ +<===> preserved/operation/variable/input.scss +a { + --test: 5; + b: exp(3px - 1px + var(--test)); +} + +<===> preserved/operation/variable/output.css +a { + --test: 5; + b: exp(2px + var(--test)); +} + <===> ================================================================================ <===> preserved/variable/input.scss a { - --one-arg: 2; - b: exp(var(--one-arg)); + --test: 5; + b: exp(var(--test)); } <===> preserved/variable/output.css a { - --one-arg: 2; - b: exp(var(--one-arg)); + --test: 5; + b: exp(var(--test)); +} + +<===> +================================================================================ +<===> preserved/unquoted_string/input.scss +a { + b: exp(test); +} + +<===> preserved/unquoted_string/output.css +a { + b: exp(test); } diff --git a/spec/values/calculation/hypot.hrx b/spec/values/calculation/hypot.hrx index 605837070..74465f8fb 100644 --- a/spec/values/calculation/hypot.hrx +++ b/spec/values/calculation/hypot.hrx @@ -15,7 +15,7 @@ a { <===> ================================================================================ <===> compatible_units/input.scss -@use "sass:math" as math; +@use "sass:math"; a {b: hypot(3cm, 4mm * 10, 5q * 40, math.div(6in, 2.54), 7px * math.div(96, 2.54))} <===> compatible_units/output.css @@ -26,7 +26,7 @@ a { <===> ================================================================================ <===> infinity/first/input.scss -@use "sass:math" as math; +@use "sass:math"; a {b: hypot(math.div(1, 0), 1, 1)} <===> infinity/first/output.css @@ -37,7 +37,7 @@ a { <===> ================================================================================ <===> infinity/second/input.scss -@use "sass:math" as math; +@use "sass:math"; a {b: hypot(1, math.div(1, 0), 1)} <===> infinity/second/output.css @@ -48,7 +48,7 @@ a { <===> ================================================================================ <===> infinity/third/input.scss -@use "sass:math" as math; +@use "sass:math"; a {b: hypot(1, 1, math.div(1, 0))} <===> infinity/third/output.css @@ -59,7 +59,7 @@ a { <===> ================================================================================ <===> math/plus/input.scss -@use "sass:math" as math; +@use "sass:math"; a {b: hypot(10*3, 15, 70/2)} <===> math/plus/output.css @@ -70,7 +70,7 @@ a { <===> ================================================================================ <===> percentage/input.scss -@use "sass:math" as math; +@use "sass:math"; a {b: hypot(10%, 5%)} <===> percentage/output.css @@ -108,6 +108,42 @@ b { a: hypot(var(--example)); } +<===> +================================================================================ +<===> preserved/percent/input.scss +a {b: hypot(3px - 1.5px + 5%)} + +<===> preserved/percent/output.css +a { + b: hypot(1.5px + 5%); +} + +<===> +================================================================================ +<===> preserved/operation/variable/input.scss +a { + --test: 5; + b: hypot(3px - 1px + var(--test)); +} + +<===> preserved/operation/variable/output.css +a { + --test: 5; + b: hypot(2px + var(--test)); +} + +<===> +================================================================================ +<===> preserved/unquoted_string/input.scss +a { + b: hypot(test); +} + +<===> preserved/unquoted_string/output.css +a { + b: hypot(test); +} + <===> ================================================================================ <===> error/type/first/input.scss diff --git a/spec/values/calculation/log.hrx b/spec/values/calculation/log.hrx index bfb0251a8..d4be41555 100644 --- a/spec/values/calculation/log.hrx +++ b/spec/values/calculation/log.hrx @@ -45,7 +45,7 @@ a { <===> ================================================================================ <===> infinity/input.scss -@use "sass:math" as math; +@use "sass:math"; a {b: log(math.div(1, 0))} <===> infinity/output.css @@ -180,6 +180,29 @@ a { b: log(var(--two-args)); } +<===> +================================================================================ +<===> preserved/percent/input.scss +a {b: log(3px - 1.5px + 5%)} + +<===> preserved/percent/output.css +a { + b: log(1.5px + 5%); +} + +<===> +================================================================================ +<===> preserved/operation/variable/input.scss +a { + --test: 5; + b: log(3px - 1px + var(--test)); +} + +<===> preserved/operation/variable/output.css +a { + --test: 5; + b: log(2px + var(--test)); +} <===> ================================================================================ @@ -243,3 +266,16 @@ Error: expected "+", "-", "*", "/", or ")". | ^ ' input.scss 1:15 root stylesheet + +<===> +================================================================================ +<===> error/syntax/quoted_string/input.scss +a {b: log("test")} + +<===> error/syntax/quoted_string/error +Error: Expected number, variable, function, or calculation. + , +1 | a {b: log("test")} + | ^ + ' + input.scss 1:11 root stylesheet diff --git a/spec/values/calculation/min.hrx b/spec/values/calculation/min.hrx index c453129d7..acc4bc4ec 100644 --- a/spec/values/calculation/min.hrx +++ b/spec/values/calculation/min.hrx @@ -213,60 +213,60 @@ a { <===> ================================================================================ -<===> perserved/math/first/input.scss +<===> preserved/math/first/input.scss a {b: min(1% + 1px, 2px)} -<===> perserved/math/first/output.css +<===> preserved/math/first/output.css a { b: min(1% + 1px, 2px); } <===> ================================================================================ -<===> perserved/math/second/input.scss +<===> preserved/math/second/input.scss a {b: min(1px, 1% + 2px)} -<===> perserved/math/second/output.css +<===> preserved/math/second/output.css a { b: min(1px, 1% + 2px); } <===> ================================================================================ -<===> perserved/math/third/input.scss +<===> preserved/math/third/input.scss a {b: min(1px, 2px, 1% + 3px)} -<===> perserved/math/third/output.css +<===> preserved/math/third/output.css a { b: min(1px, 2px, 1% + 3px); } <===> ================================================================================ -<===> perserved/unit/first/input.scss +<===> preserved/unit/first/input.scss a {b: min(1%, 2px)} -<===> perserved/unit/first/output.css +<===> preserved/unit/first/output.css a { b: min(1%, 2px); } <===> ================================================================================ -<===> perserved/unit/second/input.scss +<===> preserved/unit/second/input.scss a {b: min(1px, 2%)} -<===> perserved/unit/second/output.css +<===> preserved/unit/second/output.css a { b: min(1px, 2%); } <===> ================================================================================ -<===> perserved/unit/third/input.scss +<===> preserved/unit/third/input.scss a {b: min(1px, 2px, 3%)} -<===> perserved/unit/third/output.css +<===> preserved/unit/third/output.css a { b: min(1px, 2px, 3%); } diff --git a/spec/values/calculation/mod.hrx b/spec/values/calculation/mod.hrx index 992486899..c0678fe9b 100644 --- a/spec/values/calculation/mod.hrx +++ b/spec/values/calculation/mod.hrx @@ -5,55 +5,55 @@ terseness' sake isn't tested explicitly. <===> ================================================================================ <===> error/syntax/no_arg/input.scss -a {b: calc(mod())} +a {b: mod()} <===> error/syntax/no_arg/error Error: Expected number, variable, function, or calculation. , -1 | a {b: calc(mod())} - | ^ +1 | a {b: mod()} + | ^ ' - input.scss 1:16 root stylesheet + input.scss 1:11 root stylesheet <===> ================================================================================ <===> error/syntax/missing_arg/input.scss -a {b: calc(mod(3))} +a {b: mod(3)} <===> error/syntax/missing_arg/error Error: 2 arguments required, but only 1 was passed. , -1 | a {b: calc(mod(3))} - | ^^^^^^ +1 | a {b: mod(3)} + | ^^^^^^ ' - input.scss 1:12 root stylesheet + input.scss 1:7 root stylesheet <===> ================================================================================ <===> error/syntax/many_args/input.scss -a {b: calc(mod(3, 2, 1))} +a {b: mod(3, 2, 1)} <===> error/syntax/many_args/error Error: expected "+", "-", "*", "/", or ")". , -1 | a {b: calc(mod(3, 2, 1))} - | ^ +1 | a {b: mod(3, 2, 1)} + | ^ ' - input.scss 1:20 root stylesheet + input.scss 1:15 root stylesheet <===> ================================================================================ <===> error/syntax/incompatible/input.scss -a {b: calc(mod(16px, 5))} +a {b: mod(16px, 5)} <===> error/syntax/incompatible/error Error: 16px and 5 are incompatible. , -1 | a {b: calc(mod(16px, 5))} - | ^^^^ 16px - | = 5 +1 | a {b: mod(16px, 5)} + | ^^^^ 16px + | = 5 ' - input.scss 1:16 root stylesheet + input.scss 1:11 root stylesheet <===> ================================================================================ @@ -71,29 +71,42 @@ Error: 1 and 16px are incompatible. <===> ================================================================================ <===> error/syntax/min_incompatible/input.scss -a {b: calc(mod(min(16, 9px), 6))} +a {b: mod(min(16, 9px), 6)} <===> error/syntax/min_incompatible/error Error: 9px and 6 are incompatible. , -1 | a {b: calc(mod(min(16, 9px), 6))} - | ^^^^^^^^^^^^ 9px - | = 6 +1 | a {b: mod(min(16, 9px), 6)} + | ^^^^^^^^^^^^ 9px + | = 6 ' - input.scss 1:16 root stylesheet + input.scss 1:11 root stylesheet <===> ================================================================================ <===> error/syntax/invalid_arg/input.scss -a {b: calc(mod($))} +a {b: mod($)} <===> error/syntax/invalid_arg/error Error: Expected identifier. , -1 | a {b: calc(mod($))} - | ^ +1 | a {b: mod($)} + | ^ + ' + input.scss 1:12 root stylesheet + +<===> +================================================================================ +<===> error/syntax/quoted_string/input.scss +a {b: mod("test")} + +<===> error/syntax/quoted_string/error +Error: Expected number, variable, function, or calculation. + , +1 | a {b: mod("test")} + | ^ ' - input.scss 1:17 root stylesheet + input.scss 1:11 root stylesheet <===> ================================================================================ @@ -111,112 +124,112 @@ Error: Number 1px*px isn't compatible with CSS calculations. <===> ================================================================================ <===> error/unit/input.scss -a {b: calc(mod(5%, 3%))} +a {b: mod(5%, 3%)} <===> error/unit/output.css a { - b: mod(5%, 3%); + b: 2%; } <===> ================================================================================ -<===> preserved/operation/unitless/positive_args/input.scss +<===> operation/unitless/positive_args/input.scss a {b: mod(7, 3)} -<===> preserved/operation/unitless/positive_args/output.css +<===> operation/unitless/positive_args/output.css a { b: 1; } <===> ================================================================================ -<===> preserved/operation/unitless/y_negative/input.scss +<===> operation/unitless/y_negative/input.scss a {b: mod(7, -3)} -<===> preserved/operation/unitless/y_negative/output.css +<===> operation/unitless/y_negative/output.css a { b: -2; } <===> ================================================================================ -<===> preserved/operation/unitless/x_negative/input.scss +<===> operation/unitless/x_negative/input.scss a {b: mod(-7, 3)} -<===> preserved/operation/unitless/x_negative/output.css +<===> operation/unitless/x_negative/output.css a { b: 2; } <===> ================================================================================ -<===> preserved/operation/unitless/negative_args/input.scss +<===> operation/unitless/negative_args/input.scss a {b: mod(-7, -3)} -<===> preserved/operation/unitless/negative_args/output.css +<===> operation/unitless/negative_args/output.css a { b: -1; } <===> ================================================================================ -<===> preserved/operation/y_zero/plus/input.scss +<===> operation/y_zero/plus/input.scss a {b: mod(6, 0)} -<===> preserved/operation/y_zero/plus/output.css +<===> operation/y_zero/plus/output.css a { b: calc(NaN); } <===> ================================================================================ -<===> preserved/operation/x_zero/plus/input.scss +<===> operation/x_zero/plus/input.scss a {b: mod(0, 6)} -<===> preserved/operation/x_zero/plus/output.css +<===> operation/x_zero/plus/output.css a { b: 0; } <===> ================================================================================ -<===> preserved/operation/zeros/plus/input.scss +<===> operation/zeros/plus/input.scss a {b: mod(0, 0)} -<===> preserved/operation/zeros/plus/output.css +<===> operation/zeros/plus/output.css a { b: calc(NaN); } <===> ================================================================================ -<===> preserved/operation/y_infinity/plus/input.scss -@use "sass:math" as math; +<===> operation/y_infinity/plus/input.scss +@use "sass:math"; a {b: mod(math.div(1, 0), 10)} -<===> preserved/operation/y_infinity/plus/output.css +<===> operation/y_infinity/plus/output.css a { b: calc(NaN); } <===> ================================================================================ -<===> preserved/operation/x_infinity/plus/input.scss -@use "sass:math" as math; +<===> operation/x_infinity/plus/input.scss +@use "sass:math"; a {b: mod(10, math.div(1, 0))} -<===> preserved/operation/x_infinity/plus/output.css +<===> operation/x_infinity/plus/output.css a { b: 10; } <===> ================================================================================ -<===> preserved/operation/x_infinity/negative/input.scss -@use "sass:math" as math; +<===> operation/x_infinity/negative/input.scss +@use "sass:math"; a {b: mod(10, -infinity)} -<===> preserved/operation/x_infinity/negative/output.css +<===> operation/x_infinity/negative/output.css a { b: calc(NaN); } @@ -234,3 +247,27 @@ a { --two-args: 2, 3; b: mod(var(--two-args)); } + +<===> +================================================================================ +<===> preserved/percent/input.scss +a {b: mod(4px, 3px - 1.5px + 5%)} + +<===> preserved/percent/output.css +a { + b: mod(4px, 1.5px + 5%); +} + +<===> +================================================================================ +<===> preserved/operation/variable/input.scss +a { + --test: 5; + b: mod(3px - 1px + var(--test), 4px); +} + +<===> preserved/operation/variable/output.css +a { + --test: 5; + b: mod(2px + var(--test), 4px); +} diff --git a/spec/values/calculation/pow.hrx b/spec/values/calculation/pow.hrx index 54f97d884..9619b8f04 100644 --- a/spec/values/calculation/pow.hrx +++ b/spec/values/calculation/pow.hrx @@ -5,55 +5,68 @@ terseness' sake isn't tested explicitly. <===> ================================================================================ <===> error/syntax/no_arg/input.scss -a {b: calc(pow())} +a {b: pow()} <===> error/syntax/no_arg/error Error: Expected number, variable, function, or calculation. , -1 | a {b: calc(pow())} - | ^ +1 | a {b: pow()} + | ^ ' - input.scss 1:16 root stylesheet + input.scss 1:11 root stylesheet <===> ================================================================================ <===> error/syntax/missing_arg/input.scss -a {b: calc(pow(3))} +a {b: pow(3)} <===> error/syntax/missing_arg/error Error: 2 arguments required, but only 1 was passed. , -1 | a {b: calc(pow(3))} - | ^^^^^^ +1 | a {b: pow(3)} + | ^^^^^^ ' - input.scss 1:12 root stylesheet + input.scss 1:7 root stylesheet + +<===> +================================================================================ +<===> error/syntax/quoted_string/input.scss +a {b: pow("test")} + +<===> error/syntax/quoted_string/error +Error: Expected number, variable, function, or calculation. + , +1 | a {b: pow("test")} + | ^ + ' + input.scss 1:11 root stylesheet <===> ================================================================================ <===> error/syntax/many_args/input.scss -a {b: calc(pow(3, 2, 1))} +a {b: pow(3, 2, 1)} <===> error/syntax/many_args/error Error: expected "+", "-", "*", "/", or ")". , -1 | a {b: calc(pow(3, 2, 1))} - | ^ +1 | a {b: pow(3, 2, 1)} + | ^ ' - input.scss 1:20 root stylesheet + input.scss 1:15 root stylesheet <===> ================================================================================ <===> error/syntax/incompatible/input.scss -a {b: calc(pow(16px, 5))} +a {b: pow(16px, 5)} <===> error/syntax/incompatible/error Error: 16px and 5 are incompatible. , -1 | a {b: calc(pow(16px, 5))} - | ^^^^ 16px - | = 5 +1 | a {b: pow(16px, 5)} + | ^^^^ 16px + | = 5 ' - input.scss 1:16 root stylesheet + input.scss 1:11 root stylesheet <===> ================================================================================ @@ -71,29 +84,29 @@ Error: 1 and 16px are incompatible. <===> ================================================================================ <===> error/syntax/min_incompatible/input.scss -a {b: calc(pow(min(16, 9px), 6))} +a {b: pow(min(16, 9px), 6)} <===> error/syntax/min_incompatible/error Error: 9px and 6 are incompatible. , -1 | a {b: calc(pow(min(16, 9px), 6))} - | ^^^^^^^^^^^^ 9px - | = 6 +1 | a {b: pow(min(16, 9px), 6)} + | ^^^^^^^^^^^^ 9px + | = 6 ' - input.scss 1:16 root stylesheet + input.scss 1:11 root stylesheet <===> ================================================================================ <===> error/syntax/invalid_arg/input.scss -a {b: calc(pow($))} +a {b: pow($)} <===> error/syntax/invalid_arg/error Error: Expected identifier. , -1 | a {b: calc(pow($))} - | ^ +1 | a {b: pow($)} + | ^ ' - input.scss 1:17 root stylesheet + input.scss 1:12 root stylesheet <===> ================================================================================ @@ -111,7 +124,7 @@ Error: Number 1px*px isn't compatible with CSS calculations. <===> ================================================================================ <===> error/unit/input.scss -a {b: calc(pow(5%, 3%))} +a {b: pow(5%, 3%)} <===> error/unit/output.css a { @@ -120,60 +133,60 @@ a { <===> ================================================================================ -<===> preserved/operation/unitless/result_is_integer/input.scss +<===> operation/unitless/result_is_integer/input.scss a {b: pow(2, 3)} -<===> preserved/operation/unitless/result_is_integer/output.css +<===> operation/unitless/result_is_integer/output.css a { b: 8; } <===> ================================================================================ -<===> preserved/operation/unitless/result_is_long/input.scss +<===> operation/unitless/result_is_long/input.scss a {b: pow(10, 10)} -<===> preserved/operation/unitless/result_is_long/output.css +<===> operation/unitless/result_is_long/output.css a { b: 10000000000; } <===> ================================================================================ -<===> preserved/operation/math_nested/minus/input.scss -a {b: calc(pow(3 - 1, 2))} +<===> operation/math_nested/minus/input.scss +a {b: pow(3 - 1, 2)} -<===> preserved/operation/math_nested/minus/output.css +<===> operation/math_nested/minus/output.css a { b: 4; } <===> ================================================================================ -<===> preserved/operation/math/plus/input.scss +<===> operation/math/plus/input.scss a {b: pow(10 + 6, 0)} -<===> preserved/operation/math/plus/output.css +<===> operation/math/plus/output.css a { b: 1; } <===> ================================================================================ -<===> preserved/operation/math/max/input.scss +<===> operation/math/max/input.scss a {b: pow(max(2, 9), 2)} -<===> preserved/operation/math/max/output.css +<===> operation/math/max/output.css a { b: 81; } <===> ================================================================================ -<===> preserved/operation/math/min/input.scss +<===> operation/math/min/input.scss a {b: pow(min(2, 9), 5)} -<===> preserved/operation/math/min/output.css +<===> operation/math/min/output.css a { b: 32; } @@ -191,3 +204,39 @@ a { --two-args: 2, 3; b: pow(var(--two-args)); } + +<===> +================================================================================ +<===> preserved/unquoted_string/input.scss +a { + b: pow(test); +} + +<===> preserved/unquoted_string/output.css +a { + b: pow(test); +} + +<===> +================================================================================ +<===> preserved/percent/input.scss +a {b: pow(4px, 3px - 1.5px + 5%)} + +<===> preserved/percent/output.css +a { + b: pow(4px, 1.5px + 5%); +} + +<===> +================================================================================ +<===> preserved/operation/variable/input.scss +a { + --test: 5; + b: pow(3px - 1px + var(--test), 4px); +} + +<===> preserved/operation/variable/output.css +a { + --test: 5; + b: pow(2px + var(--test), 4px); +} diff --git a/spec/values/calculation/rem.hrx b/spec/values/calculation/rem.hrx index 080f91b79..fa28599c2 100644 --- a/spec/values/calculation/rem.hrx +++ b/spec/values/calculation/rem.hrx @@ -5,55 +5,55 @@ terseness' sake isn't tested explicitly. <===> ================================================================================ <===> error/syntax/no_arg/input.scss -a {b: calc(rem())} +a {b: rem()} <===> error/syntax/no_arg/error Error: Expected number, variable, function, or calculation. , -1 | a {b: calc(rem())} - | ^ +1 | a {b: rem()} + | ^ ' - input.scss 1:16 root stylesheet + input.scss 1:11 root stylesheet <===> ================================================================================ <===> error/syntax/missing_arg/input.scss -a {b: calc(rem(3))} +a {b: rem(3)} <===> error/syntax/missing_arg/error Error: 2 arguments required, but only 1 was passed. , -1 | a {b: calc(rem(3))} - | ^^^^^^ +1 | a {b: rem(3)} + | ^^^^^^ ' - input.scss 1:12 root stylesheet + input.scss 1:7 root stylesheet <===> ================================================================================ <===> error/syntax/many_args/input.scss -a {b: calc(rem(3, 2, 1))} +a {b: rem(3, 2, 1)} <===> error/syntax/many_args/error Error: expected "+", "-", "*", "/", or ")". , -1 | a {b: calc(rem(3, 2, 1))} - | ^ +1 | a {b: rem(3, 2, 1)} + | ^ ' - input.scss 1:20 root stylesheet + input.scss 1:15 root stylesheet <===> ================================================================================ <===> error/syntax/incompatible/input.scss -a {b: calc(rem(16px, 5))} +a {b: rem(16px, 5)} <===> error/syntax/incompatible/error Error: 16px and 5 are incompatible. , -1 | a {b: calc(rem(16px, 5))} - | ^^^^ 16px - | = 5 +1 | a {b: rem(16px, 5)} + | ^^^^ 16px + | = 5 ' - input.scss 1:16 root stylesheet + input.scss 1:11 root stylesheet <===> ================================================================================ @@ -71,29 +71,42 @@ Error: 1 and 16px are incompatible. <===> ================================================================================ <===> error/syntax/min_incompatible/input.scss -a {b: calc(rem(min(16, 9px), 6))} +a {b: rem(min(16, 9px), 6)} <===> error/syntax/min_incompatible/error Error: 9px and 6 are incompatible. , -1 | a {b: calc(rem(min(16, 9px), 6))} - | ^^^^^^^^^^^^ 9px - | = 6 +1 | a {b: rem(min(16, 9px), 6)} + | ^^^^^^^^^^^^ 9px + | = 6 ' - input.scss 1:16 root stylesheet + input.scss 1:11 root stylesheet <===> ================================================================================ <===> error/syntax/invalid_arg/input.scss -a {b: calc(rem($))} +a {b: rem($)} <===> error/syntax/invalid_arg/error Error: Expected identifier. , -1 | a {b: calc(rem($))} - | ^ +1 | a {b: rem($)} + | ^ + ' + input.scss 1:12 root stylesheet + +<===> +================================================================================ +<===> error/syntax/quoted_string/input.scss +a {b: rem("test")} + +<===> error/syntax/quoted_string/error +Error: Expected number, variable, function, or calculation. + , +1 | a {b: rem("test")} + | ^ ' - input.scss 1:17 root stylesheet + input.scss 1:11 root stylesheet <===> ================================================================================ @@ -110,123 +123,123 @@ Error: Number 1px*px isn't compatible with CSS calculations. <===> ================================================================================ -<===> error/unit/input.scss -a {b: calc(rem(5%, 3%))} +<===> percentage/unit/input.scss +a {b: rem(5%, 3%)} -<===> error/unit/output.css +<===> percentage/unit/output.css a { - b: rem(5%, 3%); + b: 2%; } <===> ================================================================================ -<===> preserved/unitless/positive_args/input.scss +<===> unitless/positive_args/input.scss a {b: rem(7, 3)} -<===> preserved/unitless/positive_args/output.css +<===> unitless/positive_args/output.css a { b: 1; } <===> ================================================================================ -<===> preserved/unitless/y_negative/input.scss +<===> unitless/y_negative/input.scss a {b: rem(7, -3)} -<===> preserved/unitless/y_negative/output.css +<===> unitless/y_negative/output.css a { b: -9; } <===> ================================================================================ -<===> preserved/unitless/x_negative/input.scss +<===> unitless/x_negative/input.scss a {b: rem(-7, 3)} -<===> preserved/unitless/x_negative/output.css +<===> unitless/x_negative/output.css a { b: 9; } <===> ================================================================================ -<===> preserved/unitless/negative_args/input.scss +<===> unitless/negative_args/input.scss a {b: rem(-7, -3)} -<===> preserved/unitless/negative_args/output.css +<===> unitless/negative_args/output.css a { b: -1; } <===> ================================================================================ -<===> preserved/negative_zero/input.scss -@use "sass:math" as math; +<===> negative_zero/input.scss +@use "sass:math"; a {b: math.div(1, rem(-7, 7))} -<===> preserved/negative_zero/output.css +<===> negative_zero/output.css a { b: calc(-infinity); } <===> ================================================================================ -<===> preserved/positive_zero/input.scss -@use "sass:math" as math; +<===> positive_zero/input.scss +@use "sass:math"; a {b: math.div(1, rem(7, 7))} -<===> preserved/positive_zero/output.css +<===> positive_zero/output.css a { b: calc(infinity); } <===> ================================================================================ -<===> preserved/y_zero/plus/input.scss +<===> y_zero/plus/input.scss a {b: rem(6, 0)} -<===> preserved/y_zero/plus/output.css +<===> y_zero/plus/output.css a { b: calc(NaN); } <===> ================================================================================ -<===> preserved/x_zero/plus/input.scss +<===> x_zero/plus/input.scss a {b: rem(0, 6)} -<===> preserved/x_zero/plus/output.css +<===> x_zero/plus/output.css a { b: 0; } <===> ================================================================================ -<===> preserved/zeros/plus/input.scss +<===> zeros/plus/input.scss a {b: rem(0, 0)} -<===> preserved/zeros/plus/output.css +<===> zeros/plus/output.css a { b: calc(NaN); } <===> ================================================================================ -<===> preserved/y_infinity/plus/input.scss -@use "sass:math" as math; +<===> y_infinity/plus/input.scss +@use "sass:math"; a {b: rem(math.div(1, 0), 10)} -<===> preserved/y_infinity/plus/output.css +<===> y_infinity/plus/output.css a { b: calc(NaN); } <===> ================================================================================ -<===> preserved/x_infinity/plus/input.scss +<===> x_infinity/plus/input.scss a {b: rem(10, infinity)} -<===> preserved/x_infinity/plus/output.css +<===> x_infinity/plus/output.css a { b: 10; } @@ -244,3 +257,39 @@ a { --two-args: 2, 3; b: rem(var(--two-args)); } + +<===> +================================================================================ +<===> preserved/unquoted_string/input.scss +a { + b: rem(test); +} + +<===> preserved/unquoted_string/output.css +a { + b: rem(test); +} + +<===> +================================================================================ +<===> preserved/percent/input.scss +a {b: rem(4px, 3px - 1.5px + 5%)} + +<===> preserved/percent/output.css +a { + b: rem(4px, 1.5px + 5%); +} + +<===> +================================================================================ +<===> preserved/operation/variable/input.scss +a { + --test: 5; + b: rem(3px - 1px + var(--test), 4px); +} + +<===> preserved/operation/variable/output.css +a { + --test: 5; + b: rem(2px + var(--test), 4px); +} diff --git a/spec/values/calculation/round.hrx b/spec/values/calculation/round.hrx index 3aa38b324..cdbe303ec 100644 --- a/spec/values/calculation/round.hrx +++ b/spec/values/calculation/round.hrx @@ -59,16 +59,6 @@ Error: 3px must be either nearest, up, down or to-zero. ' input.scss 1:7 root stylesheet -<===> -================================================================================ -<===> perserved/unknown_variable/number/input.scss -a {b: round(test)} - -<===> perserved/unknown_variable/number/output.css -a { - b: round(test); -} - <===> ================================================================================ <===> error/variable/number_and_step/input.scss @@ -84,256 +74,328 @@ Error: 4px must be either nearest, up, down or to-zero. <===> ================================================================================ -<===> perserved/unknown_variable/two_args/input.scss +<===> preserved/unquoted_string/number/input.scss +a {b: round(test)} + +<===> preserved/unquoted_string/number/output.css +a { + b: round(test); +} + +<===> +================================================================================ +<===> preserved/unquoted_string/two_args/input.scss a {b: round(test, nearest)} -<===> perserved/unknown_variable/two_args/output.css +<===> preserved/unquoted_string/two_args/output.css a { b: round(test, nearest); } <===> ================================================================================ -<===> perserved/unknown_variable/one_arg/input.scss +<===> preserved/unquoted_string/one_arg/input.scss a {b: round(test, 5)} -<===> perserved/unknown_variable/one_arg/output.css +<===> preserved/unquoted_string/one_arg/output.css a { b: round(test, 5); } <===> ================================================================================ -<===> perserved/unknown_variable/step/input.scss +<===> preserved/unquoted_string/step/input.scss a {b: round(4px, nearest)} -<===> perserved/unknown_variable/step/output.css +<===> preserved/unquoted_string/step/output.css a { b: round(4px, nearest); } <===> ================================================================================ -<===> preserved/step/zero/input.scss +<===> preserved/operation/two_args/math/input.scss +a {b: round(3.4px + 10%, 1px + 4px)} + +<===> preserved/operation/two_args/math/output.css +a { + b: round(3.4px + 10%, 5px); +} + +<===> +================================================================================ +<===> preserved/operation/nearest/math/input.scss +a { + --test: 3; + b: round(nearest, 3.8px - 1px + var(--test), 1.1px + 4px)} + +<===> preserved/operation/nearest/math/output.css +a { + --test: 3; + b: round(nearest, 2.8px + var(--test), 5.1px); +} + +<===> +================================================================================ +<===> step/zero/input.scss a {b: round(5px, 0px)} -<===> preserved/step/zero/output.css +<===> step/zero/output.css a { b: calc(NaN * 1px); } <===> ================================================================================ -<===> preserved/step/infinity/input.scss -@use "sass:math" as math; +<===> step/infinity/input.scss +@use "sass:math"; a {b: round(-0, infinity)} -<===> preserved/step/infinity/output.css +<===> step/infinity/output.css a { b: 0; } <===> ================================================================================ -<===> preserved/step/number/input.scss +<===> step/number/input.scss a {b: round(5px, 5px)} -<===> preserved/step/number/output.css +<===> step/number/output.css a { b: 5px; } <===> ================================================================================ -<===> preserved/number/infinity/input.scss -@use "sass:math" as math; +<===> step/unitless/input.scss +a {b: round(5, 5)} + +<===> step/unitless/output.css +a { + b: 5; +} + +<===> +================================================================================ +<===> step/compatible_units/input.scss +a {b: round(100px, 2cm)} + +<===> step/compatible_units/output.css +a { + b: 75.5905511811px; +} + +<===> +================================================================================ +<===> number/infinity/input.scss +@use "sass:math"; a {b: round(infinity, 5)} -<===> preserved/number/infinity/output.css +<===> number/infinity/output.css a { b: calc(infinity); } <===> ================================================================================ -<===> preserved/up/negative_zero/input.scss -@use "sass:math" as math; +<===> up/negative_zero/input.scss +@use "sass:math"; a {b: math.div(1, round(up, -10, infinity))} -<===> preserved/up/negative_zero/output.css +<===> up/negative_zero/output.css a { b: calc(-infinity); } <===> ================================================================================ -<===> preserved/nearest/negative_zero/input.scss -@use "sass:math" as math; +<===> nearest/negative_zero/input.scss +@use "sass:math"; a {b: math.div(1, round(nearest, -10, infinity))} -<===> preserved/nearest/negative_zero/output.css +<===> nearest/negative_zero/output.css a { b: calc(-infinity); } <===> ================================================================================ -<===> preserved/down/negative_zero/input.scss -@use "sass:math" as math; +<===> down/negative_zero/input.scss +@use "sass:math"; a {b: math.div(1, round(down, -0, infinity))} -<===> preserved/down/negative_zero/output.css +<===> down/negative_zero/output.css a { b: calc(-infinity); } <===> ================================================================================ -<===> preserved/operation/positive/input.scss -@use "sass:math" as math; +<===> operation/positive/input.scss a {b: round(up, 10, infinity)} -<===> preserved/operation/positive/output.css +<===> operation/positive/output.css a { b: calc(infinity); } <===> ================================================================================ -<===> preserved/operation/negative/input.scss -@use "sass:math" as math; +<===> operation/negative/input.scss +@use "sass:math"; a {b: round(down, -10, infinity)} -<===> preserved/operation/negative/output.css +<===> operation/negative/output.css a { b: calc(-infinity); } <===> ================================================================================ -<===> preserved/operation/one_arg/simplify/input.scss +<===> operation/one_arg/simplify/input.scss a {b: round(3.8px + 4px)} -<===> preserved/operation/one_arg/simplify/output.css +<===> operation/one_arg/simplify/output.css a { b: 8px; } <===> ================================================================================ -<===> preserved/operation/two_args/simplify/input.scss +<===> operation/two_args/simplify/input.scss $c: 10px; a {b: round(3.8px + 4px, $c)} -<===> preserved/operation/two_args/simplify/output.css +<===> operation/two_args/simplify/output.css a { b: 10px; } <===> ================================================================================ -<===> preserved/operation/two_args/math/input.scss -a {b: round(3.4px + 10%, 1px + 4px)} - -<===> preserved/operation/two_args/math/output.css -a { - b: round(3.4px + 10%, 5px); -} - -<===> -================================================================================ -<===> preserved/operation/nearest/math/input.scss -a {b: round(nearest, 3.8px + 10%, 1.1px + 4px)} - -<===> preserved/operation/nearest/math/output.css -a { - b: round(nearest, 3.8px + 10%, 5.1px); -} - -<===> -================================================================================ -<===> preserved/operation/nearest/simplify/input.scss +<===> operation/nearest/simplify/input.scss a {b: round(nearest, 115px + 2px, 21px + 4px)} -<===> preserved/operation/nearest/simplify/output.css +<===> operation/nearest/simplify/output.css a { b: 125px; } <===> ================================================================================ -<===> preserved/operation/up/input.scss +<===> operation/up/input.scss a {b: round(up, 101px, 25px)} -<===> preserved/operation/up/output.css +<===> operation/up/output.css a { b: 125px; } <===> ================================================================================ -<===> preserved/operation/down/input.scss +<===> operation/down/input.scss a {b: round(down, 122px, 25px)} -<===> preserved/operation/down/output.css +<===> operation/down/output.css a { b: 100px; } <===> ================================================================================ -<===> preserved/operation/to-zero/positive/input.scss +<===> operation/to-zero/positive/input.scss a {b: round(to-zero, 120px, 25px)} -<===> preserved/operation/to-zero/positive/output.css +<===> operation/to-zero/positive/output.css a { b: 100px; } <===> ================================================================================ -<===> preserved/operation/to-zero/negative/input.scss +<===> operation/to-zero/negative/input.scss a {b: round(to-zero, -120px, 25px)} -<===> preserved/operation/to-zero/negative/output.css +<===> operation/to-zero/negative/output.css a { b: -100px; } <===> ================================================================================ -<===> preserved/infinity/input.scss -@use "sass:math" as math; +<===> nan/simplify/input.scss +a {b: round(calc(NaN), calc(NaN))} + +<===> nan/simplify/output.css +a { + b: calc(NaN); +} + +<===> +================================================================================ +<===> infinity/input.scss +@use "sass:math"; a {b: round(up, infinity, infinity)} -<===> preserved/infinity/output.css +<===> infinity/output.css a { b: calc(NaN); } <===> ================================================================================ -<===> preserved/variable/one_arg/input.scss -$a: 12.1; -c {d: round($a)} +<===> variable/one_arg/input.scss +c {d: round($number: 12.1)} -<===> preserved/variable/one_arg/output.css +<===> variable/one_arg/output.css c { d: 12; } <===> ================================================================================ -<===> variables/input.scss +<===> unknown_variable/one_arg/input.scss a { + --example: 5; b: round(var(--example)); - c: round(up, var(--example)); - d: round(up, 8px, var(--example)); } -<===> variables/output.css +<===> unknown_variable/one_arg/output.css a { + --example: 5; b: round(var(--example)); +} + +<===> +================================================================================ +<===> unknown_variable/two_args/second_arg/input.scss +a { c: round(up, var(--example)); +} +<===> unknown_variable/two_args/second_arg/output.css +a { + c: round(up, var(--example)); +} + +<===> +================================================================================ +<===> unknown_variable/three_args/first_arg/input.scss +a { + e: round(var(--example), 8px, 9px); +} +<===> unknown_variable/three_args/first_arg/output.css +a { + e: round(var(--example), 8px, 9px); +} + +<===> +================================================================================ +<===> unknown_variable/three_args/third_arg/input.scss +a { + d: round(up, 8px, var(--example)); +} +<===> unknown_variable/three_args/third_arg/output.css +a { d: round(up, 8px, var(--example)); } diff --git a/spec/values/calculation/sign.hrx b/spec/values/calculation/sign.hrx index 04cf30a81..0ae6039f4 100644 --- a/spec/values/calculation/sign.hrx +++ b/spec/values/calculation/sign.hrx @@ -5,28 +5,28 @@ terseness' sake isn't tested explicitly. <===> ================================================================================ <===> error/syntax/no_arg/input.scss -a {b: calc(sign())} +a {b: sign()} <===> error/syntax/no_arg/error Error: Expected number, variable, function, or calculation. , -1 | a {b: calc(sign())} - | ^ +1 | a {b: sign()} + | ^ ' - input.scss 1:17 root stylesheet + input.scss 1:12 root stylesheet <===> ================================================================================ <===> error/syntax/many_args/input.scss -a {b: calc(sign(3, 2))} +a {b: sign(3, 2)} <===> error/syntax/many_args/error Error: expected "+", "-", "*", "/", or ")". , -1 | a {b: calc(sign(3, 2))} - | ^ +1 | a {b: sign(3, 2)} + | ^ ' - input.scss 1:18 root stylesheet + input.scss 1:13 root stylesheet <===> ================================================================================ @@ -44,15 +44,15 @@ Error: 1 and 16px are incompatible. <===> ================================================================================ <===> error/syntax/invalid_arg/input.scss -a {b: calc(sign($))} +a {b: sign($)} <===> error/syntax/invalid_arg/error Error: Expected identifier. , -1 | a {b: calc(sign($))} - | ^ +1 | a {b: sign($)} + | ^ ' - input.scss 1:18 root stylesheet + input.scss 1:13 root stylesheet <===> ================================================================================ @@ -67,7 +67,7 @@ a { <===> ================================================================================ <===> error/unit/input.scss -a {b: calc(sign(5%))} +a {b: sign(5%)} <===> error/unit/output.css a { @@ -76,50 +76,50 @@ a { <===> ================================================================================ -<===> preserved/operation/unit/positive/input.scss +<===> operation/unit/positive/input.scss a {b: sign(5px)} -<===> preserved/operation/unit/positive/output.css +<===> operation/unit/positive/output.css a { b: 1; } <===> ================================================================================ -<===> preserved/operation/unitless/negative/input.scss +<===> operation/unitless/negative/input.scss a {b: sign(-1000.65)} -<===> preserved/operation/unitless/negative/output.css +<===> operation/unitless/negative/output.css a { b: -1; } <===> ================================================================================ -<===> preserved/operation/zero/positive/input.scss -a {b: sign(0)} +<===> operation/zero/positive/input.scss +a {b: sign(0px)} -<===> preserved/operation/zero/positive/output.css +<===> operation/zero/positive/output.css a { b: 0; } <===> ================================================================================ -<===> preserved/operation/zero/negative/input.scss +<===> operation/zero/negative/input.scss a {b: sign(-0)} -<===> preserved/operation/zero/negative/output.css +<===> operation/zero/negative/output.css a { b: 0; } <===> ================================================================================ -<===> preserved/operation/nan/input.scss +<===> operation/nan/input.scss a {b: sign(NaN)} -<===> preserved/operation/nan/output.css +<===> operation/nan/output.css a { b: calc(NaN); } @@ -137,3 +137,39 @@ a { --one-arg: 2; b: sign(var(--one-arg)); } + +<===> +================================================================================ +<===> preserved/unquoted_string/input.scss +a { + b: sign(test); +} + +<===> preserved/unquoted_string/output.css +a { + b: sign(test); +} + +<===> +================================================================================ +<===> preserved/percent/input.scss +a {b: sign(3px - 1.5px + 5%)} + +<===> preserved/percent/output.css +a { + b: sign(1.5px + 5%); +} + +<===> +================================================================================ +<===> preserved/operation/variable/input.scss +a { + --test: 5; + b: sign(3px - 1px + var(--test)); +} + +<===> preserved/operation/variable/output.css +a { + --test: 5; + b: sign(2px + var(--test)); +} diff --git a/spec/values/calculation/sin.hrx b/spec/values/calculation/sin.hrx index 5a4452207..593ecd07d 100644 --- a/spec/values/calculation/sin.hrx +++ b/spec/values/calculation/sin.hrx @@ -5,7 +5,7 @@ terseness' sake isn't tested explicitly. <===> ================================================================================ <===> negative_infinity/input.scss -@use "sass:math" as math; +@use "sass:math"; a {b: sin(math.div(-1, 0))} <===> negative_infinity/output.css @@ -16,7 +16,7 @@ a { <===> ================================================================================ <===> infinity/input.scss -@use "sass:math" as math; +@use "sass:math"; a {b: sin(math.div(1, 0))} <===> infinity/output.css @@ -135,6 +135,44 @@ a { b: 0.8414709848; } +<===> +================================================================================ +<===> preserved/percent/input.scss +a {b: sin(3px - 1.5px + 5%)} + +<===> preserved/percent/output.css +a { + b: sin(1.5px + 5%); +} + +<===> +================================================================================ +<===> preserved/operation/variable/input.scss +a { + --test: 5; + b: sin(3px - 1px + var(--test)); +} + +<===> preserved/operation/variable/output.css +a { + --test: 5; + b: sin(2px + var(--test)); +} + +<===> +================================================================================ +<===> preserved/variable/input.scss +a { + --test: 5; + b: sin(var(--test)); +} + +<===> preserved/variable/output.css +a { + --test: 5; + b: sin(var(--test)); +} + <===> ================================================================================ <===> error/type/input.scss diff --git a/spec/values/calculation/sqrt.hrx b/spec/values/calculation/sqrt.hrx index 496ae2c99..099360a6c 100644 --- a/spec/values/calculation/sqrt.hrx +++ b/spec/values/calculation/sqrt.hrx @@ -5,108 +5,108 @@ terseness' sake isn't tested explicitly. <===> ================================================================================ <===> error/syntax/no_arg/input.scss -a {b: calc(sqrt())} +a {b: sqrt()} <===> error/syntax/no_arg/error Error: Expected number, variable, function, or calculation. , -1 | a {b: calc(sqrt())} - | ^ +1 | a {b: sqrt()} + | ^ ' - input.scss 1:17 root stylesheet + input.scss 1:12 root stylesheet <===> ================================================================================ <===> error/syntax/operation_no_units/input.scss -a {b: calc(sqrt(1 + 16px))} +a {b: sqrt(1 + 16px)} <===> error/syntax/operation_no_units/error Error: 1 and 16px are incompatible. , -1 | a {b: calc(sqrt(1 + 16px))} - | ^^^^^^^^ +1 | a {b: sqrt(1 + 16px)} + | ^^^^^^^^ ' - input.scss 1:17 root stylesheet + input.scss 1:12 root stylesheet <===> ================================================================================ <===> error/syntax/invalid_arg/input.scss -a {b: calc(sqrt($))} +a {b: sqrt($)} <===> error/syntax/invalid_arg/error Error: Expected identifier. , -1 | a {b: calc(sqrt($))} - | ^ +1 | a {b: sqrt($)} + | ^ ' - input.scss 1:18 root stylesheet + input.scss 1:13 root stylesheet <===> ================================================================================ -<===> preserved/operation/unitless/result_is_integer/input.scss +<===> operation/unitless/result_is_integer/input.scss a {b: sqrt(16)} -<===> preserved/operation/unitless/result_is_integer/output.css +<===> operation/unitless/result_is_integer/output.css a { b: 4; } <===> ================================================================================ -<===> preserved/operation/unitless/result_is_float/input.scss +<===> operation/unitless/result_is_float/input.scss a {b: sqrt(2)} -<===> preserved/operation/unitless/result_is_float/output.css +<===> operation/unitless/result_is_float/output.css a { b: 1.4142135624; } <===> ================================================================================ -<===> preserved/operation/unitless/negative/input.scss +<===> operation/unitless/negative/input.scss a {b: sqrt(-9)} -<===> preserved/operation/unitless/negative/output.css +<===> operation/unitless/negative/output.css a { b: calc(NaN); } <===> ================================================================================ -<===> preserved/operation/math_nested/minus/input.scss +<===> operation/math_nested/minus/input.scss a {b: calc(sqrt(10 - 1))} -<===> preserved/operation/math_nested/minus/output.css +<===> operation/math_nested/minus/output.css a { b: 3; } <===> ================================================================================ -<===> preserved/operation/math/plus/input.scss +<===> operation/math/plus/input.scss a {b: sqrt(10 + 6)} -<===> preserved/operation/math/plus/output.css +<===> operation/math/plus/output.css a { b: 4; } <===> ================================================================================ -<===> preserved/operation/math/max/input.scss +<===> operation/math/max/input.scss a {b: sqrt(max(2, 9))} -<===> preserved/operation/math/max/output.css +<===> operation/math/max/output.css a { b: 3; } <===> ================================================================================ -<===> preserved/operation/math/min/input.scss +<===> operation/math/min/input.scss a {b: sqrt(min(16, 9))} -<===> preserved/operation/math/min/output.css +<===> operation/math/min/output.css a { b: 3; } @@ -121,13 +121,51 @@ a { b: sqrt(5%); } +<===> +================================================================================ +<===> preserved/percent/input.scss +a {b: sqrt(3px - 1.5px + 5%)} + +<===> preserved/percent/output.css +a { + b: sqrt(1.5px + 5%); +} + +<===> +================================================================================ +<===> preserved/operation/variable/input.scss +a { + --test: 5; + b: sqrt(3px - 1px + var(--test)); +} + +<===> preserved/operation/variable/output.css +a { + --test: 5; + b: sqrt(2px + var(--test)); +} + +<===> +================================================================================ +<===> preserved/variable/input.scss +a { + --test: 5; + b: sqrt(var(--test)); +} + +<===> preserved/variable/output.css +a { + --test: 5; + b: sqrt(var(--test)); +} + <===> ================================================================================ <===> syntax/units/input.scss a {b: calc(sqrt(16px))} <===> syntax/units/error -Error: Expected 16px to have no units. +Error: $number: Expected 16px to have no units. , 1 | a {b: calc(sqrt(16px))} | ^^^^^^^^^^ @@ -140,7 +178,7 @@ Error: Expected 16px to have no units. a {b: calc(sqrt(min(16, 9px)))} <===> syntax/min_units/error -Error: Expected 9px to have no units. +Error: $number: Expected 9px to have no units. , 1 | a {b: calc(sqrt(min(16, 9px)))} | ^^^^^^^^^^^^^^^^^^ diff --git a/spec/values/calculation/tan.hrx b/spec/values/calculation/tan.hrx index 47b2f04be..868690ab3 100644 --- a/spec/values/calculation/tan.hrx +++ b/spec/values/calculation/tan.hrx @@ -5,7 +5,7 @@ terseness' sake isn't tested explicitly. <===> ================================================================================ <===> negative_infinity/input.scss -@use "sass:math" as math; +@use "sass:math"; a {b: tan(math.div(-1, 0))} <===> negative_infinity/output.css @@ -16,7 +16,7 @@ a { <===> ================================================================================ <===> infinity/input.scss -@use "sass:math" as math; +@use "sass:math"; a {b: tan(math.div(1, 0))} <===> infinity/output.css @@ -27,7 +27,7 @@ a { <===> ================================================================================ <===> negative_asymptote/radian/input.scss -@use "sass:math" as math; +@use "sass:math"; a {b: tan(-0.5rad * math.$pi)} <===> negative_asymptote/radian/output.css @@ -38,7 +38,7 @@ a { <===> ================================================================================ <===> asymptote/radian/input.scss -@use "sass:math" as math; +@use "sass:math"; a {b: tan(0.5rad * math.$pi)} <===> asymptote/radian/output.css @@ -157,6 +157,56 @@ a { b: 1.5574077247; } +<===> +================================================================================ +<===> preserved/percent/input.scss +a {b: tan(3px - 1.5px + 5%)} + +<===> preserved/percent/output.css +a { + b: tan(1.5px + 5%); +} + +<===> +================================================================================ +<===> preserved/operation/variable/input.scss +a { + --test: 5; + b: tan(3px - 1px + var(--test)); +} + +<===> preserved/operation/variable/output.css +a { + --test: 5; + b: tan(2px + var(--test)); +} + +<===> +================================================================================ +<===> preserved/variable/input.scss +a { + --test: 5; + b: tan(var(--test)); +} + +<===> preserved/variable/output.css +a { + --test: 5; + b: tan(var(--test)); +} + +<===> +================================================================================ +<===> preserved/unquoted_string/input.scss +a { + b: tan(test); +} + +<===> preserved/unquoted_string/output.css +a { + b: tan(test); +} + <===> ================================================================================ <===> error/type/input.scss