From 7c34cc9a4318285c642327a1e64a5e4ee81b0446 Mon Sep 17 00:00:00 2001 From: Pamela Lozano De La Garza Date: Mon, 17 Jul 2023 17:27:20 -0700 Subject: [PATCH] Restructure tests --- spec/values/calculation/abs.hrx | 107 +---- spec/values/calculation/acos.hrx | 108 ++--- spec/values/calculation/asin.hrx | 139 ++----- spec/values/calculation/atan.hrx | 130 ++---- spec/values/calculation/atan2.hrx | 185 ++++----- spec/values/calculation/cos.hrx | 141 ++----- spec/values/calculation/exp.hrx | 198 ++++------ spec/values/calculation/hypot.hrx | 285 ++++--------- spec/values/calculation/log.hrx | 248 ++++-------- spec/values/calculation/mod.hrx | 367 ++++++++--------- spec/values/calculation/pow.hrx | 328 ++++++--------- spec/values/calculation/rem.hrx | 373 ++++++++---------- .../values/calculation/round/one_argument.hrx | 166 ++++---- .../calculation/round/three_arguments.hrx | 10 +- .../calculation/round/two_arguments.hrx | 4 +- spec/values/calculation/sign.hrx | 185 ++++----- spec/values/calculation/sin.hrx | 159 +++----- spec/values/calculation/sqrt.hrx | 166 +++----- spec/values/calculation/tan.hrx | 143 ++----- 19 files changed, 1195 insertions(+), 2247 deletions(-) diff --git a/spec/values/calculation/abs.hrx b/spec/values/calculation/abs.hrx index 4688f42c5..f7caf2cc3 100644 --- a/spec/values/calculation/abs.hrx +++ b/spec/values/calculation/abs.hrx @@ -14,36 +14,34 @@ a { <===> ================================================================================ -<===> positive/integer/input.scss +<===> positive/input.scss a {b: abs(1)} -<===> positive/integer/output.css +<===> positive/output.css a { b: 1; } <===> ================================================================================ -<===> negative/decimal/input.scss -a {b: abs(-5.6px)} +<===> negative/input.scss +a {b: abs(-5.6)} -<===> negative/decimal/output.css +<===> negative/output.css a { - b: 5.6px; + b: 5.6; } <===> ================================================================================ -<===> operation/variable/input.scss +<===> operation/simplification/input.scss a { - --test: 5; - b: abs(1px + 2px - var(--test)) + b: abs(1px + 2px - var(--c)) } -<===> operation/variable/output.css +<===> operation/simplification/output.css a { - --test: 5; - b: abs(3px - var(--test)); + b: abs(3px - var(--c)); } <===> @@ -56,77 +54,6 @@ a { b: 1.75px; } -<===> -================================================================================ -<===> 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 - -<===> -================================================================================ -<===> operation/integer/input.scss -a {b: abs(17 * 5%)} - -<===> operation/integer/output.css -a { - 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/d/abs-percent - , -1 | a {b: abs(17 * 5%)} - | ^^^^^^^^^^^^^^^^^^^ - ' - input.scss 1:1 root stylesheet - -<===> -================================================================================ -<===> preserved/operation/percentage/input.scss -a {b: abs(17px + 5%)} - -<===> preserved/operation/percentage/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/unquoted_string/input.scss -a { - b: abs(test); -} - -<===> preserved/unquoted_string/output.css -a { - b: abs(test); -} - <===> ================================================================================ <===> named_argument/input.scss @@ -183,16 +110,16 @@ More info and automated migrator: https://sass-lang.com/d/slash-div <===> ================================================================================ -<===> error/incompatible_units/input.scss -a {b: abs(17px + 4deg)} +<===> error/named_argument/variable/input.scss +a {b: abs($number: var(--c))} -<===> error/incompatible_units/error -Error: 17px and 4deg are incompatible. +<===> error/named_argument/variable/error +Error: $number: var(--c) is not a number. , -1 | a {b: abs(17px + 4deg)} - | ^^^^^^^^^^^ +1 | a {b: abs($number: var(--c))} + | ^^^^^^^^^^^^^^^^^^^^^^ ' - input.scss 1:11 root stylesheet + input.scss 1:7 root stylesheet <===> ================================================================================ diff --git a/spec/values/calculation/acos.hrx b/spec/values/calculation/acos.hrx index 888ef9b8b..72d81fbf8 100644 --- a/spec/values/calculation/acos.hrx +++ b/spec/values/calculation/acos.hrx @@ -14,24 +14,25 @@ a { <===> ================================================================================ -<===> negative_decimal/input.scss -a {b: acos(-0.5)} +<===> negative_one/input.scss +a {b: acos(-1)} -<===> negative_decimal/output.css +<===> negative_one/output.css a { - b: 120deg; + b: 180deg; } <===> ================================================================================ -<===> decimal/input.scss -a {b: acos(0.5)} +<===> zero/input.scss +a {b: acos(0)} -<===> decimal/output.css +<===> zero/output.css a { - b: 60deg; + b: 90deg; } + <===> ================================================================================ <===> one/input.scss @@ -42,16 +43,6 @@ a { b: 0deg; } -<===> -================================================================================ -<===> one_fuzzy/input.scss -a {b: acos(1.000000000001)} - -<===> one_fuzzy/output.css -a { - b: calc(NaN * 1deg); -} - <===> ================================================================================ <===> greater_than_one/input.scss @@ -64,53 +55,28 @@ a { <===> ================================================================================ -<===> preserved/percent/input.scss -a {b: acos(3px - 1.5px + 5%)} - -<===> preserved/percent/output.css -a { - b: acos(1.5px + 5%); -} - -<===> -================================================================================ -<===> preserved/operation/variable/input.scss +<===> operation/simplification/input.scss a { - --test: 5; - b: acos(3px - 1px + var(--test)); + b: acos(3px - 1px + var(--c)); } -<===> preserved/operation/variable/output.css +<===> operation/simplification/output.css a { - --test: 5; - b: acos(2px + var(--test)); + b: acos(2px + var(--c)); } <===> ================================================================================ -<===> 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); -} +<===> error/percentage/input.scss +a {b: acos(1%)} -<===> preserved/unquoted_string/output.css -a { - b: acos(test); -} +<===> error/percentage/error +Error: Expected 1% to have no units. + , +1 | a {b: acos(1%)} + | ^^^^^^^^ + ' + input.scss 1:7 root stylesheet <===> ================================================================================ @@ -125,19 +91,6 @@ Error: Expected 1px to have no units. ' input.scss 1:7 root stylesheet -<===> -================================================================================ -<===> error/percent/input.scss -a {b: acos(1%)} - -<===> error/percent/error -Error: Expected 1% to have no units. - , -1 | a {b: acos(1%)} - | ^^^^^^^^ - ' - input.scss 1:7 root stylesheet - <===> ================================================================================ <===> error/type/input.scss @@ -153,10 +106,10 @@ Error: Expected number, variable, function, or calculation. <===> ================================================================================ -<===> error/zero_args/input.scss +<===> error/too_few_args/input.scss a {b: acos()} -<===> error/zero_args/error +<===> error/too_few_args/error Error: Expected number, variable, function, or calculation. , 1 | a {b: acos()} @@ -189,3 +142,16 @@ Error: Expected identifier. | ^ ' input.scss 1:13 root stylesheet + +<===> +================================================================================ +<===> error/mod/input.scss +a {b: acos(7 % 3)} + +<===> error/mod/error +Error: expected "+", "-", "*", "/", or ")". + , +1 | a {b: acos(7 % 3)} + | ^ + ' + input.scss 1:14 root stylesheet diff --git a/spec/values/calculation/asin.hrx b/spec/values/calculation/asin.hrx index 2b384dcb9..0897c44b6 100644 --- a/spec/values/calculation/asin.hrx +++ b/spec/values/calculation/asin.hrx @@ -14,32 +14,12 @@ a { <===> ================================================================================ -<===> negative_decimal/input.scss -a {b: asin(-0.5)} +<===> negative_one/input.scss +a {b: asin(-1)} -<===> negative_decimal/output.css +<===> negative_one/output.css a { - b: -30deg; -} - -<===> -================================================================================ -<===> negative_zero/input.scss -a {b: asin(-0.0)} - -<===> negative_zero/output.css -a { - b: 0deg; -} - -<===> -================================================================================ -<===> negative_zero_fuzzy/input.scss -a {b: asin(-0.000000000001)} - -<===> negative_zero_fuzzy/output.css -a { - b: -0.0000000001deg; + b: -90deg; } <===> @@ -52,26 +32,6 @@ a { b: 0deg; } -<===> -================================================================================ -<===> zero_fuzzy/input.scss -a {b: asin(0.000000000001)} - -<===> zero_fuzzy/output.css -a { - b: 0.0000000001deg; -} - -<===> -================================================================================ -<===> decimal/input.scss -a {b: asin(0.5)} - -<===> decimal/output.css -a { - b: 30deg; -} - <===> ================================================================================ <===> one/input.scss @@ -82,16 +42,6 @@ a { b: 90deg; } -<===> -================================================================================ -<===> one_fuzzy/input.scss -a {b: asin(1.000000000001)} - -<===> one_fuzzy/output.css -a { - b: calc(NaN * 1deg); -} - <===> ================================================================================ <===> greater_than_one/input.scss @@ -104,53 +54,28 @@ a { <===> ================================================================================ -<===> 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 +<===> operation/simplification/input.scss a { - --test: 5; - b: asin(3px - 1px + var(--test)); + b: asin(3px - 1px + var(--c)); } -<===> preserved/operation/variable/output.css +<===> operation/simplification/output.css a { - --test: 5; - b: asin(2px + var(--test)); + b: asin(2px + var(--c)); } <===> ================================================================================ -<===> 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); -} +<===> error/percentage/input.scss +a {b: asin(1%)} -<===> preserved/unquoted_string/output.css -a { - b: asin(test); -} +<===> error/percentage/error +Error: Expected 1% to have no units. + , +1 | a {b: asin(1%)} + | ^^^^^^^^ + ' + input.scss 1:7 root stylesheet <===> ================================================================================ @@ -165,19 +90,6 @@ Error: Expected 1px to have no units. ' input.scss 1:7 root stylesheet -<===> -================================================================================ -<===> error/percent/input.scss -a {b: asin(1%)} - -<===> error/percent/error -Error: Expected 1% to have no units. - , -1 | a {b: asin(1%)} - | ^^^^^^^^ - ' - input.scss 1:7 root stylesheet - <===> ================================================================================ <===> error/type/input.scss @@ -193,10 +105,10 @@ Error: Expected number, variable, function, or calculation. <===> ================================================================================ -<===> error/zero_args/input.scss +<===> error/too_few_args/input.scss a {b: asin()} -<===> error/zero_args/error +<===> error/too_few_args/error Error: Expected number, variable, function, or calculation. , 1 | a {b: asin()} @@ -229,3 +141,16 @@ Error: Expected identifier. | ^ ' input.scss 1:13 root stylesheet + +<===> +================================================================================ +<===> error/mod/input.scss +a {b: asin(7 % 3)} + +<===> error/mod/error +Error: expected "+", "-", "*", "/", or ")". + , +1 | a {b: asin(7 % 3)} + | ^ + ' + input.scss 1:14 root stylesheet diff --git a/spec/values/calculation/atan.hrx b/spec/values/calculation/atan.hrx index 3d7b97011..e8fe1a1a0 100644 --- a/spec/values/calculation/atan.hrx +++ b/spec/values/calculation/atan.hrx @@ -5,44 +5,13 @@ terseness' sake isn't tested explicitly. <===> ================================================================================ <===> negative_infinity/input.scss -@use "sass:math"; -a {b: atan(math.div(-1, 0))} +a {b: atan(-infinity)} <===> negative_infinity/output.css a { b: -90deg; } -<===> -================================================================================ -<===> negative/input.scss -a {b: atan(-1)} - -<===> negative/output.css -a { - b: -45deg; -} - -<===> -================================================================================ -<===> negative_zero/input.scss -a {b: atan(-0.0)} - -<===> negative_zero/output.css -a { - b: 0deg; -} - -<===> -================================================================================ -<===> negative_zero_fuzzy/input.scss -a {b: atan(-0.000000000001)} - -<===> negative_zero_fuzzy/output.css -a { - b: -0.0000000001deg; -} - <===> ================================================================================ <===> zero/input.scss @@ -55,20 +24,10 @@ a { <===> ================================================================================ -<===> zero_fuzzy/input.scss -a {b: atan(0.000000000001)} - -<===> zero_fuzzy/output.css -a { - b: 0.0000000001deg; -} - -<===> -================================================================================ -<===> positive/input.scss +<===> one/input.scss a {b: atan(1)} -<===> positive/output.css +<===> one/output.css a { b: 45deg; } @@ -76,8 +35,7 @@ a { <===> ================================================================================ <===> infinity/input.scss -@use "sass:math"; -a {b: atan(math.div(1, 0))} +a {b: atan(infinity)} <===> infinity/output.css a { @@ -86,53 +44,28 @@ a { <===> ================================================================================ -<===> preserved/percent/input.scss -a {b: atan(3px - 1.5px + 5%)} - -<===> preserved/percent/output.css +<===> operation/simplification/input.scss a { - b: atan(1.5px + 5%); + b: atan(3px - 1px + var(--c)); } -<===> -================================================================================ -<===> preserved/operation/variable/input.scss -a { - --test: 5; - b: atan(3px - 1px + var(--test)); -} - -<===> preserved/operation/variable/output.css +<===> operation/simplification/output.css a { - --test: 5; - b: atan(2px + var(--test)); + b: atan(2px + var(--c)); } <===> ================================================================================ -<===> 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); -} +<===> error/percentage/input.scss +a {b: atan(1%)} -<===> preserved/unquoted_string/output.css -a { - b: atan(test); -} +<===> error/percentage/error +Error: Expected 1% to have no units. + , +1 | a {b: atan(1%)} + | ^^^^^^^^ + ' + input.scss 1:7 root stylesheet <===> ================================================================================ @@ -147,19 +80,6 @@ Error: Expected 1px to have no units. ' input.scss 1:7 root stylesheet -<===> -================================================================================ -<===> error/percent/input.scss -a {b: atan(1%)} - -<===> error/percent/error -Error: Expected 1% to have no units. - , -1 | a {b: atan(1%)} - | ^^^^^^^^ - ' - input.scss 1:7 root stylesheet - <===> ================================================================================ <===> error/type/input.scss @@ -175,10 +95,10 @@ Error: Expected number, variable, function, or calculation. <===> ================================================================================ -<===> error/zero_args/input.scss +<===> error/too_few_args/input.scss a {b: atan()} -<===> error/zero_args/error +<===> error/too_few_args/error Error: Expected number, variable, function, or calculation. , 1 | a {b: atan()} @@ -199,3 +119,15 @@ Error: expected "+", "-", "*", "/", or ")". ' input.scss 1:13 root stylesheet +<===> +================================================================================ +<===> error/mod/input.scss +a {b: atan(7 % 3)} + +<===> error/mod/error +Error: expected "+", "-", "*", "/", or ")". + , +1 | a {b: atan(7 % 3)} + | ^ + ' + input.scss 1:14 root stylesheet diff --git a/spec/values/calculation/atan2.hrx b/spec/values/calculation/atan2.hrx index 4709b074f..652891a6d 100644 --- a/spec/values/calculation/atan2.hrx +++ b/spec/values/calculation/atan2.hrx @@ -4,149 +4,98 @@ terseness' sake isn't tested explicitly. <===> ================================================================================ -<===> unitless/input.scss +<===> units/none/input.scss a {b: atan2(1, -10)} -<===> unitless/output.css +<===> units/none/output.css a { b: 174.2894068625deg; } <===> ================================================================================ -<===> compatible_units/input.scss +<===> units/compatible/input.scss a {b: atan2(1cm, -10mm)} -<===> compatible_units/output.css +<===> units/compatible/output.css a { b: 135deg; } <===> ================================================================================ -<===> operation/math/input.scss -a {b: atan2(10 + 6, 8 - 1)} +<===> units/real_and_unknown/input.scss +a {b: atan2(1px, 10%)} -<===> operation/math/output.css +<===> units/real_and_unknown/output.css a { - b: 66.3706222693deg; + b: atan2(1px, 10%); } <===> ================================================================================ -<===> operation/nested_function/input.scss -a {b: atan2(max(2mm, 9mm), min(1cm, 3cm))} - -<===> operation/nested_function/output.css -a { - b: 41.9872124958deg; -} - -<===> -================================================================================ -<===> operation/percent/input.scss -a {b: atan2(4px, 3px - 1.5px + 5%)} - -<===> operation/percent/output.css +<===> units/unknown/input.scss a { - b: atan2(4px, 1.5px + 5%); + b: atan2(1%, 2%); } -<===> -================================================================================ -<===> percent/input.scss -a {b: atan2(1%, 1cm)} - -<===> percent/output.css +<===> units/unknown/output.css a { - b: atan2(1%, 1cm); + b: atan2(1%, 2%); } <===> ================================================================================ -<===> preserved/operation/variable/input.scss +<===> units/fake/input.scss a { - --test: 5; - b: atan2(3px - 1px + var(--test), 4px); + b: atan2(1foo, 2bar); } -<===> preserved/operation/variable/output.css +<===> units/fake/output.css a { - --test: 5; - b: atan2(2px + var(--test), 4px); + b: atan2(1foo, 2bar); } <===> ================================================================================ -<===> preserved/variable/input.scss +<===> units/real_and_fake/input.scss a { - --test: 5; - b: atan2(var(--test)); + b: atan2(1px, 2bar); } -<===> preserved/variable/output.css +<===> units/real_and_fake/output.css a { - --test: 5; - b: atan2(var(--test)); + b: atan2(1px, 2bar); } <===> ================================================================================ -<===> preserved/unquoted_string/input.scss -a { - b: atan2(test); -} +<===> operation/nested_function/input.scss +a {b: atan2(max(2mm, 9mm), min(1cm, 3cm))} -<===> preserved/unquoted_string/output.css +<===> operation/nested_function/output.css a { - b: atan2(test); + b: 41.9872124958deg; } <===> ================================================================================ -<===> preserved/unknown_units/input.scss +<===> operation/simplification/input.scss a { - b: atan2(1foo, 2bar); + b: atan2(3px - 1px + var(--c), 4px + 10px); } -<===> preserved/unknown_units/output.css +<===> operation/simplification/output.css a { - b: atan2(1foo, 2bar); + b: atan2(2px + var(--c), 14px); } <===> ================================================================================ -<===> error/variables/input.scss -a {b: atan2($y: 1, $x: -1)} - -<===> error/variables/error -Error: expected "+", "-", "*", "/", ",", or ")". - , -1 | a {b: atan2($y: 1, $x: -1)} - | ^ - ' - input.scss 1:15 root stylesheet - -<===> -================================================================================ -<===> error/incompatible_units/input.scss -a {b: atan2(1px, 1deg)} - -<===> error/incompatible_units/error -Error: 1px and 1deg are incompatible. - , -1 | a {b: atan2(1px, 1deg)} - | ^^^ 1px - | ==== 1deg - ' - input.scss 1:13 root stylesheet - -<===> -================================================================================ -<===> error/unitless_y/input.scss +<===> error/units/unitless_and_unit/input.scss a {b: atan2(1, 1px)} -<===> error/unitless_y/error +<===> error/units/unitless_and_unit/error Error: 1 and 1px are incompatible. , 1 | a {b: atan2(1, 1px)} @@ -157,56 +106,43 @@ Error: 1 and 1px are incompatible. <===> ================================================================================ -<===> error/operation/incompatible_units/input.scss -a {b: atan2(10 + 6, 8px - 1cm)} +<===> error/units/known_incompatible/input.scss +a {b: atan2(1deg, 1px)} -<===> error/operation/incompatible_units/error -Error: 16 and -29.7952755906px are incompatible. +<===> error/units/known_incompatible/error +Error: 1deg and 1px are incompatible. , -1 | a {b: atan2(10 + 6, 8px - 1cm)} - | ^^^^^^ 16 - | ========= -29.7952755906px +1 | a {b: atan2(1deg, 1px)} + | ^^^^ 1deg + | === 1px ' input.scss 1:13 root stylesheet <===> ================================================================================ -<===> error/one_arg/input.scss -a {b: atan2(0)} - -<===> error/one_arg/error -Error: 2 arguments required, but only 1 was passed. - , -1 | a {b: atan2(0)} - | ^^^^^^^^ - ' - input.scss 1:7 root stylesheet - -<===> -================================================================================ -<===> error/syntax/quoted_string/input.scss -a {b: atan2("0")} +<===> error/units/complex_and_unknown/input.scss +a {b: atan2(1px*2px, 10%)} -<===> error/syntax/quoted_string/error -Error: Expected number, variable, function, or calculation. +<===> error/units/complex_and_unknown/error +Error: Number 2px*px isn't compatible with CSS calculations. , -1 | a {b: atan2("0")} - | ^ +1 | a {b: atan2(1px*2px, 10%)} + | ^^^^^^^ ' input.scss 1:13 root stylesheet <===> ================================================================================ <===> error/syntax/invalid_arg/input.scss -a {b: atan2($)} +a {b: atan2($c, $)} <===> error/syntax/invalid_arg/error Error: Expected identifier. , -1 | a {b: atan2($)} - | ^ +1 | a {b: atan2($c, $)} + | ^ ' - input.scss 1:14 root stylesheet + input.scss 1:18 root stylesheet <===> ================================================================================ @@ -236,16 +172,16 @@ Error: Expected number, variable, function, or calculation. <===> ================================================================================ -<===> error/zero_args/input.scss -a {b: atan2()} +<===> error/too_few_args/input.scss +a {b: atan2(0)} -<===> error/zero_args/error -Error: Expected number, variable, function, or calculation. +<===> error/too_few_args/error +Error: 2 arguments required, but only 1 was passed. , -1 | a {b: atan2()} - | ^ +1 | a {b: atan2(0)} + | ^^^^^^^^ ' - input.scss 1:13 root stylesheet + input.scss 1:7 root stylesheet <===> ================================================================================ @@ -259,3 +195,16 @@ Error: expected "+", "-", "*", "/", or ")". | ^ ' input.scss 1:17 root stylesheet + +<===> +================================================================================ +<===> error/mod/input.scss +a {b: atan2(7 % 3, $x)} + +<===> error/mod/error +Error: expected "+", "-", "*", "/", ",", or ")". + , +1 | a {b: atan2(7 % 3, $x)} + | ^ + ' + input.scss 1:15 root stylesheet diff --git a/spec/values/calculation/cos.hrx b/spec/values/calculation/cos.hrx index f8427b3e7..691e6ae93 100644 --- a/spec/values/calculation/cos.hrx +++ b/spec/values/calculation/cos.hrx @@ -2,28 +2,6 @@ Most of the same behavior tested for `calc()` applies to `cos()`, but for terseness' sake isn't tested explicitly. -<===> -================================================================================ -<===> negative_infinity/input.scss -@use "sass:math"; -a {b: cos(math.div(-1, 0))} - -<===> negative_infinity/output.css -a { - b: calc(NaN); -} - -<===> -================================================================================ -<===> infinity/input.scss -@use "sass:math"; -a {b: cos(math.div(1, 0))} - -<===> infinity/output.css -a { - b: calc(NaN); -} - <===> ================================================================================ <===> deg/input.scss @@ -66,113 +44,58 @@ a { <===> ================================================================================ -<===> less_than_negative_one/input.scss -a {b: cos(-2)} - -<===> less_than_negative_one/output.css -a { - b: -0.4161468365; -} - -<===> -================================================================================ -<===> negative_decimal/input.scss -a {b: cos(-0.5)} - -<===> negative_decimal/output.css -a { - b: 0.8775825619; -} - -<===> -================================================================================ -<===> decimal/input.scss -a {b: cos(0.5)} - -<===> decimal/output.css -a { - b: 0.8775825619; -} - -<===> -================================================================================ -<===> unitless/input.scss -a {b: cos(1)} - -<===> unitless/output.css -a { - b: 0.5403023059; -} - -<===> -================================================================================ -<===> one_fuzzy/input.scss -a {b: cos(1.000000000001)} +<===> negative_infinity/input.scss +a {b: cos(-infinity)} -<===> one_fuzzy/output.css +<===> negative_infinity/output.css a { - b: 0.5403023059; + b: calc(NaN); } <===> ================================================================================ -<===> greater_than_one/input.scss -a {b: cos(2)} +<===> zero/input.scss +a {b: cos(0)} -<===> greater_than_one/output.css +<===> zero/output.css a { - b: -0.4161468365; + b: 1; } <===> ================================================================================ -<===> preserved/percent/input.scss -a {b: cos(3px - 1.5px + 5%)} +<===> infinity/input.scss +a {b: cos(infinity)} -<===> preserved/percent/output.css +<===> infinity/output.css a { - b: cos(1.5px + 5%); + b: calc(NaN); } <===> ================================================================================ <===> preserved/operation/variable/input.scss a { - --test: 5; - b: cos(3px - 1px + var(--test)); + b: cos(3px - 1px + var(--c)); } <===> 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)); + b: cos(2px + var(--c)); } <===> ================================================================================ -<===> preserved/unquoted_string/input.scss -a { - b: cos(test); -} +<===> error/percentage/input.scss +a {b: cos(1%)} -<===> preserved/unquoted_string/output.css -a { - b: cos(test); -} +<===> error/percentage/error +Error: $number: Expected 1% to have an angle unit (deg, grad, rad, turn). + , +1 | a {b: cos(1%)} + | ^^^^^^^ + ' + input.scss 1:7 root stylesheet <===> ================================================================================ @@ -202,10 +125,10 @@ Error: Expected number, variable, function, or calculation. <===> ================================================================================ -<===> error/zero_args/input.scss +<===> error/too_few_args/input.scss a {b: cos()} -<===> error/zero_args/error +<===> error/too_few_args/error Error: Expected number, variable, function, or calculation. , 1 | a {b: cos()} @@ -241,13 +164,13 @@ Error: Expected identifier. <===> ================================================================================ -<===> percent/input.scss -a {b: cos(1%)} +<===> error/mod/input.scss +a {b: cos(7 % 3)} -<===> percent/error -Error: $number: Expected 1% to have an angle unit (deg, grad, rad, turn). +<===> error/mod/error +Error: expected "+", "-", "*", "/", or ")". , -1 | a {b: cos(1%)} - | ^^^^^^^ +1 | a {b: cos(7 % 3)} + | ^ ' - input.scss 1:7 root stylesheet + input.scss 1:13 root stylesheet diff --git a/spec/values/calculation/exp.hrx b/spec/values/calculation/exp.hrx index ffa1f94fc..bee49f75f 100644 --- a/spec/values/calculation/exp.hrx +++ b/spec/values/calculation/exp.hrx @@ -4,172 +4,144 @@ terseness' sake isn't tested explicitly. <===> ================================================================================ -<===> error/syntax/no_arg/input.scss -a {b: calc(exp())} +<===> zero/input.scss +a {b: exp(0)} -<===> error/syntax/no_arg/error -Error: Expected number, variable, function, or calculation. - , -1 | a {b: calc(exp())} - | ^ - ' - input.scss 1:16 root stylesheet +<===> zero/output.css +a { + b: 1; +} <===> ================================================================================ -<===> error/syntax/many_args/input.scss -a {b: calc(exp(3, 2))} +<===> positive/input.scss +a {b: exp(5)} -<===> error/syntax/many_args/error -Error: expected "+", "-", "*", "/", or ")". - , -1 | a {b: calc(exp(3, 2))} - | ^ - ' - input.scss 1:17 root stylesheet +<===> positive/output.css +a { + b: 148.4131591026; +} <===> ================================================================================ -<===> error/syntax/operation_incompatible/input.scss -a {b: exp(1 + 16px)} +<===> negative/input.scss +a {b: exp(-10.5)} -<===> error/syntax/operation_incompatible/error -Error: 1 and 16px are incompatible. - , -1 | a {b: exp(1 + 16px)} - | ^^^^^^^^ - ' - input.scss 1:11 root stylesheet +<===> negative/output.css +a { + b: 0.0000275364; +} <===> ================================================================================ -<===> error/syntax/invalid_arg/input.scss -a {b: calc(exp($))} +<===> result_is_infinity/input.scss +a {b: exp(1000.65)} -<===> error/syntax/invalid_arg/error -Error: Expected identifier. - , -1 | a {b: calc(exp($))} - | ^ - ' - input.scss 1:17 root stylesheet +<===> result_is_infinity/output.css +a { + b: calc(infinity); +} <===> ================================================================================ -<===> error/complex_unit/input.scss -a {b: exp(1px*1px)} +<===> operation/simplification/input.scss +a { + b: exp(1px + 2px - var(--c)) +} -<===> error/complex_unit/error -Error: Number 1px*px isn't compatible with CSS calculations. - , -1 | a {b: exp(1px*1px)} - | ^^^^^^^ - ' - input.scss 1:11 root stylesheet +<===> operation/simplification/output.css +a { + b: exp(3px - var(--c)); +} <===> ================================================================================ <===> error/percentage/input.scss -a {b: exp(5%)} +a {b: exp(1%)} <===> error/percentage/error -Error: Expected 5% to have no units. +Error: Expected 1% to have no units. , -1 | a {b: exp(5%)} +1 | a {b: exp(1%)} | ^^^^^^^ ' input.scss 1:7 root stylesheet <===> ================================================================================ -<===> error/unit/input.scss -a {b: exp(5px)} +<===> error/units/input.scss +a {b: exp(1px)} -<===> error/unit/error -Error: Expected 5px to have no units. +<===> error/units/error +Error: Expected 1px to have no units. , -1 | a {b: exp(5px)} +1 | a {b: exp(1px)} | ^^^^^^^^ ' input.scss 1:7 root stylesheet - -<===> -================================================================================ -<===> operation/unitless/result_is_integer/input.scss -a {b: exp(5)} - -<===> operation/unitless/result_is_integer/output.css -a { - b: 148.4131591026; -} - <===> ================================================================================ -<===> operation/unitless/result_is_long/input.scss -a {b: exp(1000.65)} +<===> error/type/input.scss +a {b: exp("0")} -<===> operation/unitless/result_is_long/output.css -a { - b: calc(infinity); -} +<===> error/type/error +Error: Expected number, variable, function, or calculation. + , +1 | a {b: exp("0")} + | ^ + ' + input.scss 1:11 root stylesheet <===> ================================================================================ -<===> operation/math_nested/negative/input.scss -a {b: calc(exp(5 * 8 - 100))} +<===> error/too_few_args/input.scss +a {b: exp()} -<===> operation/math_nested/negative/output.css -a { - b: 0; -} +<===> error/too_few_args/error +Error: Expected number, variable, function, or calculation. + , +1 | a {b: exp()} + | ^ + ' + input.scss 1:11 root stylesheet <===> ================================================================================ -<===> preserved/percent/input.scss -a {b: exp(3px - 1.5px + 5%)} +<===> error/too_many_args/input.scss +a {b: exp(0, 0)} -<===> preserved/percent/output.css -a { - b: exp(1.5px + 5%); -} +<===> error/too_many_args/error +Error: expected "+", "-", "*", "/", or ")". + , +1 | a {b: exp(0, 0)} + | ^ + ' + input.scss 1:12 root stylesheet <===> ================================================================================ -<===> preserved/operation/variable/input.scss -a { - --test: 5; - b: exp(3px - 1px + var(--test)); -} +<===> error/syntax/invalid_arg/input.scss +a {b: exp($)} -<===> preserved/operation/variable/output.css -a { - --test: 5; - b: exp(2px + var(--test)); -} +<===> error/syntax/invalid_arg/error +Error: Expected identifier. + , +1 | a {b: exp($)} + | ^ + ' + input.scss 1:12 root stylesheet <===> ================================================================================ -<===> preserved/variable/input.scss -a { - --test: 5; - b: exp(var(--test)); -} +<===> error/mod/input.scss +a {b: exp(7 % 3)} -<===> preserved/variable/output.css -a { - --test: 5; - b: exp(var(--test)); -} - -<===> -================================================================================ -<===> preserved/unquoted_string/input.scss -a { - b: exp(test); -} +<===> error/mod/error +Error: expected "+", "-", "*", "/", or ")". + , +1 | a {b: exp(7 % 3)} + | ^ + ' + input.scss 1:13 root stylesheet -<===> preserved/unquoted_string/output.css -a { - b: exp(test); -} diff --git a/spec/values/calculation/hypot.hrx b/spec/values/calculation/hypot.hrx index 0a51b2f8d..4807ac6b1 100644 --- a/spec/values/calculation/hypot.hrx +++ b/spec/values/calculation/hypot.hrx @@ -4,155 +4,121 @@ terseness' sake isn't tested explicitly. <===> ================================================================================ -<===> unitless/input.scss +<===> units/none/input.scss a {b: hypot(3, 4, 5, 6, 7)} -<===> unitless/output.css +<===> units/none/output.css a { b: 11.6189500386; } <===> ================================================================================ -<===> variable/input.scss -$number: 3; -a {b: hypot(3 + 10, 4, 5, 6, 7)} +<===> units/compatible/input.scss +a {b: hypot(13cm, 4mm, 5q, 6in, 7px)} -<===> variable/output.css +<===> units/compatible/output.css a { - b: 17.1755640373; + b: 20.0366545892cm; } <===> ================================================================================ -<===> compatible_units/input.scss -@use "sass:math"; -a {b: hypot(3cm, 4mm * 10, 5q * 40, math.div(6in, 2.54), 7px * math.div(96, 2.54))} +<===> units/real_and_unknown/input.scss +a {b: hypot(13cm, 4%)} -<===> compatible_units/output.css +<===> units/real_and_unknown/output.css a { - b: 11.6189500386cm; + b: hypot(13cm, 4%); } <===> ================================================================================ -<===> infinity/first/input.scss -@use "sass:math"; -a {b: hypot(math.div(1, 0), 1, 1)} - -<===> infinity/first/output.css +<===> units/unknown/input.scss a { - b: calc(infinity); + b: hypot(1%, 2%); } -<===> -================================================================================ -<===> infinity/second/input.scss -@use "sass:math"; -a {b: hypot(1, math.div(1, 0), 1)} - -<===> infinity/second/output.css +<===> units/unknown/output.css a { - b: calc(infinity); + b: hypot(1%, 2%); } <===> ================================================================================ -<===> infinity/third/input.scss -@use "sass:math"; -a {b: hypot(1, 1, math.div(1, 0))} +<===> units/fake/input.scss +a { + b: hypot(1foo, 2bar); +} -<===> infinity/third/output.css +<===> units/fake/output.css a { - b: calc(infinity); + b: hypot(1foo, 2bar); } <===> ================================================================================ -<===> math/plus/input.scss -@use "sass:math"; -a {b: hypot(10*3, 15, 70/2)} +<===> units/real_and_fake/input.scss +a { + b: hypot(1px, 2bar); +} -<===> math/plus/output.css +<===> units/real_and_fake/output.css a { - b: 48.4767985742; + b: hypot(1px, 2bar); } <===> ================================================================================ -<===> percentage/input.scss +<===> simplification/input.scss @use "sass:math"; -a {b: hypot(10%, 5%)} +a {b: hypot(3 + 2, 4 * 10, 5 * 40, math.div(6, 2.54), 7 * math.div(96, 2.54))} -<===> percentage/output.css +<===> simplification/output.css a { - b: hypot(10%, 5%); + b: 334.1051331579; } <===> ================================================================================ -<===> preserved/variable/two_args/input.scss -b { ---x: 4px ---y: 6px; -a: hypot(var(--x), var(--y)); -} +<===> infinity/first/input.scss +a {b: hypot(infinity, 1, 1)} -<===> preserved/variable/two_args/output.css -b { - --x: 4px - --y: 6px; - a: hypot(var(--x), var(--y)); +<===> infinity/first/output.css +a { + b: calc(infinity); } <===> ================================================================================ -<===> preserved/variable/one_arg/input.scss -b { ---example: 4px, 6px; -a: hypot(var(--example)); -} +<===> infinity/second/input.scss +a {b: hypot(1, infinity, 1)} -<===> preserved/variable/one_arg/output.css -b { - --example: 4px, 6px; - a: hypot(var(--example)); +<===> infinity/second/output.css +a { + b: calc(infinity); } <===> ================================================================================ -<===> preserved/percent/input.scss -a {b: hypot(3px - 1.5px + 5%)} +<===> percentage/input.scss +a {b: hypot(10%, 5%)} -<===> preserved/percent/output.css +<===> percentage/output.css a { - b: hypot(1.5px + 5%); + b: hypot(10%, 5%); } <===> ================================================================================ <===> preserved/operation/variable/input.scss a { - --test: 5; - b: hypot(3px - 1px + var(--test)); + b: hypot(3px - 1px + var(--c)); } <===> 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); + b: hypot(2px + var(--c)); } <===> @@ -167,45 +133,6 @@ a { b: hypot(1foo, 2bar); } -<===> -================================================================================ -<===> error/type/first/input.scss -a {b: hypot("0", 1px, 1px)} - -<===> error/type/first/error -Error: Expected number, variable, function, or calculation. - , -1 | a {b: hypot("0", 1px, 1px)} - | ^ - ' - input.scss 1:13 root stylesheet - -<===> -================================================================================ -<===> error/type/second/input.scss -a {b: hypot(1px, "0", 1px)} - -<===> error/type/second/error -Error: Expected number, variable, function, or calculation. - , -1 | a {b: hypot(1px, "0", 1px)} - | ^ - ' - input.scss 1:18 root stylesheet - -<===> -================================================================================ -<===> error/type/third/input.scss -a {b: hypot(1px, 1px, "0")} - -<===> error/type/third/error -Error: Expected number, variable, function, or calculation. - , -1 | a {b: hypot(1px, 1px, "0")} - | ^ - ' - input.scss 1:23 root stylesheet - <===> ================================================================================ <===> error/incompatible_units/first_and_second/input.scss @@ -223,14 +150,14 @@ Error: 1deg and 1px are incompatible. <===> ================================================================================ <===> error/incompatible_units/first_and_third/input.scss -a {b: hypot(1deg, 1turn, 1px)} +a {b: hypot(1deg, 1turn, 1)} <===> error/incompatible_units/first_and_third/error -Error: 1deg and 1px are incompatible. +Error: 1deg and 1 are incompatible. , -1 | a {b: hypot(1deg, 1turn, 1px)} +1 | a {b: hypot(1deg, 1turn, 1)} | ^^^^ 1deg - | === 1px + | = 1 ' input.scss 1:13 root stylesheet @@ -250,111 +177,65 @@ Error: 1turn and 1px are incompatible. <===> ================================================================================ -<===> error/incompatible_units/all/input.scss -a {b: hypot(1turn, 1px, 1s)} - -<===> error/incompatible_units/all/error -Error: 1turn and 1px are incompatible. - , -1 | a {b: hypot(1turn, 1px, 1s)} - | ^^^^^ 1turn - | === 1px - ' - input.scss 1:13 root stylesheet - -<===> -================================================================================ -<===> error/some_unitless/first/input.scss -a {b: hypot(0, 1px, 2px)} - -<===> error/some_unitless/first/error -Error: 0 and 1px are incompatible. - , -1 | a {b: hypot(0, 1px, 2px)} - | ^ 0 - | === 1px - ' - input.scss 1:13 root stylesheet - -<===> -================================================================================ -<===> error/some_unitless/second/input.scss -a {b: hypot(0px, 1, 2px)} - -<===> error/some_unitless/second/error -Error: 0px and 1 are incompatible. - , -1 | a {b: hypot(0px, 1, 2px)} - | ^^^ 0px - | = 1 - ' - input.scss 1:13 root stylesheet - -<===> -================================================================================ -<===> error/some_unitless/third/input.scss -a {b: hypot(0px, 1px, 2)} +<===> error/type/first/input.scss +a {b: hypot("0", 1px, 1px)} -<===> error/some_unitless/third/error -Error: 0px and 2 are incompatible. +<===> error/type/first/error +Error: Expected number, variable, function, or calculation. , -1 | a {b: hypot(0px, 1px, 2)} - | ^^^ 0px - | = 2 +1 | a {b: hypot("0", 1px, 1px)} + | ^ ' input.scss 1:13 root stylesheet <===> ================================================================================ -<===> error/some_unitless/first_and_second/input.scss -a {b: hypot(0, 1, 2px)} +<===> error/type/second/input.scss +a {b: hypot(1px, "0", 1px)} -<===> error/some_unitless/first_and_second/error -Error: 0 and 2px are incompatible. +<===> error/type/second/error +Error: Expected number, variable, function, or calculation. , -1 | a {b: hypot(0, 1, 2px)} - | ^ 0 - | === 2px +1 | a {b: hypot(1px, "0", 1px)} + | ^ ' - input.scss 1:13 root stylesheet + input.scss 1:18 root stylesheet <===> ================================================================================ -<===> error/some_unitless/first_and_third/input.scss -a {b: hypot(0, 1px, 2)} +<===> error/zero_args/input.scss +a {b: hypot()} -<===> error/some_unitless/first_and_third/error -Error: 0 and 1px are incompatible. +<===> error/zero_args/error +Error: Expected number, variable, function, or calculation. , -1 | a {b: hypot(0, 1px, 2)} - | ^ 0 - | === 1px +1 | a {b: hypot()} + | ^ ' input.scss 1:13 root stylesheet <===> ================================================================================ -<===> error/some_unitless/second_and_third/input.scss -a {b: hypot(0px, 1, 2)} +<===> error/syntax/invalid_arg/input.scss +a {b: hypot($c, $, $e)} -<===> error/some_unitless/second_and_third/error -Error: 0px and 1 are incompatible. +<===> error/syntax/invalid_arg/error +Error: Expected identifier. , -1 | a {b: hypot(0px, 1, 2)} - | ^^^ 0px - | = 1 +1 | a {b: hypot($c, $, $e)} + | ^ ' - input.scss 1:13 root stylesheet + input.scss 1:18 root stylesheet <===> ================================================================================ -<===> error/zero_args/input.scss -a {b: hypot()} +<===> error/mod/input.scss +a {b: hypot(7 % 3, $x)} -<===> error/zero_args/error -Error: Expected number, variable, function, or calculation. +<===> error/mod/error +Error: expected "+", "-", "*", "/", ",", or ")". , -1 | a {b: hypot()} - | ^ +1 | a {b: hypot(7 % 3, $x)} + | ^ ' - input.scss 1:13 root stylesheet + input.scss 1:15 root stylesheet diff --git a/spec/values/calculation/log.hrx b/spec/values/calculation/log.hrx index bc1e86948..85652cd14 100644 --- a/spec/values/calculation/log.hrx +++ b/spec/values/calculation/log.hrx @@ -22,16 +22,6 @@ a { b: calc(-infinity); } -<===> -================================================================================ -<===> zero_fuzzy/input.scss -a {b: log(0.000000000001)} - -<===> zero_fuzzy/output.css -a { - b: -27.6310211159; -} - <===> ================================================================================ <===> positive/input.scss @@ -45,24 +35,13 @@ a { <===> ================================================================================ <===> infinity/input.scss -@use "sass:math"; -a {b: log(math.div(1, 0))} +a {b: log(infinity)} <===> infinity/output.css a { b: calc(infinity); } -<===> -================================================================================ -<===> base/null/input.scss -a {b: log(2)} - -<===> base/null/output.css -a { - b: 0.6931471806; -} - <===> ================================================================================ <===> base/negative/input.scss @@ -83,16 +62,6 @@ a { b: 0; } -<===> -================================================================================ -<===> base/zero_fuzzy/input.scss -a {b: log(2, 0.000000000001)} - -<===> base/zero_fuzzy/output.css -a { - b: -0.025085833; -} - <===> ================================================================================ <===> base/between_zero_and_one/input.scss @@ -113,16 +82,6 @@ a { b: calc(infinity); } -<===> -================================================================================ -<===> base/one_fuzzy/input.scss -a {b: log(2, 1.000000000001)} - -<===> base/one_fuzzy/output.css -a { - b: 693085564849.9645; -} - <===> ================================================================================ <===> base/positive/input.scss @@ -135,100 +94,51 @@ a { <===> ================================================================================ -<===> base/unknown_variable/input.scss -a {b: log(2, test)} - -<===> base/unknown_variable/output.css -a { - b: log(2, test); -} - -<===> -================================================================================ -<===> base/calculation/input.scss -a {b: log(2px, 3px + 10px)} - -<===> base/calculation/error -Error: Expected 2px to have no units. - , -1 | a {b: log(2px, 3px + 10px)} - | ^^^^^^^^^^^^^^^^^^^^ - ' - input.scss 1:7 root stylesheet - -<===> -================================================================================ -<===> preserved/variable/input.scss -a { - --two-args: 2, 3; - b: log(var(--two-args)); -} +<===> base/variable/input.scss +a {b: log(2, var(--c))} -<===> preserved/variable/output.css +<===> base/variable/output.css a { - --two-args: 2, 3; - b: log(var(--two-args)); + b: log(2, var(--c)); } <===> ================================================================================ -<===> preserved/percent/input.scss -a {b: log(3px - 1.5px + 5%)} - -<===> preserved/percent/output.css +<===> operation/simplification/input.scss a { - b: log(1.5px + 5%); + b: log(3px - 1px + var(--c)); } -<===> -================================================================================ -<===> preserved/operation/variable/input.scss +<===> operation/simplification/output.css a { - --test: 5; - b: log(3px - 1px + var(--test)); -} - -<===> preserved/operation/variable/output.css -a { - --test: 5; - b: log(2px + var(--test)); -} - -<===> -================================================================================ -<===> named_arg/number/input.scss -$number: 2; -a {b: log($number)} - -<===> named_arg/number/output.css -a { - b: 0.6931471806; + b: log(2px + var(--c)); } <===> ================================================================================ -<===> named_args/number_with_base/input.scss -$number: 2; -$base: 10; -a {b: log($number, $base)} +<===> error/percentage/input.scss +a {b: log(1%)} -<===> named_args/number_with_base/output.css -a { - b: 0.3010299957; -} +<===> error/percentage/error +Error: Expected 1% to have no units. + , +1 | a {b: log(1%)} + | ^^^^^^^ + ' + input.scss 1:7 root stylesheet <===> ================================================================================ -<===> error/type/input.scss -a {b: log("0")} +<===> error/number_has_units/input.scss +a {b: log(3px)} -<===> error/type/error -Error: Expected number, variable, function, or calculation. +<===> error/number_has_units/error +Error: Expected 3px to have no units. , -1 | a {b: log("0")} - | ^ +1 | a {b: log(3px)} + | ^^^^^^^^ ' - input.scss 1:11 root stylesheet + input.scss 1:7 root stylesheet <===> ================================================================================ @@ -246,107 +156,105 @@ Error: 1 and 1px are incompatible. <===> ================================================================================ -<===> error/zero_args/input.scss -a {b: log()} +<===> error/units/known_incompatible/input.scss +a {b: log(1deg, 1px)} -<===> error/zero_args/error -Error: Expected number, variable, function, or calculation. +<===> error/units/known_incompatible/error +Error: 1deg and 1px are incompatible. , -1 | a {b: log()} - | ^ +1 | a {b: log(1deg, 1px)} + | ^^^^ 1deg + | === 1px ' input.scss 1:11 root stylesheet <===> ================================================================================ -<===> error/too_many_args/input.scss -a {b: log(0, 0, 0)} +<===> error/units/complex_and_unknown/input.scss +a {b: log(1px*2px, 10%)} -<===> error/too_many_args/error -Error: expected "+", "-", "*", "/", or ")". +<===> error/units/complex_and_unknown/error +Error: Number 2px*px isn't compatible with CSS calculations. , -1 | a {b: log(0, 0, 0)} - | ^ +1 | a {b: log(1px*2px, 10%)} + | ^^^^^^^ ' - input.scss 1:15 root stylesheet + input.scss 1:11 root stylesheet <===> ================================================================================ -<===> error/syntax/quoted_string/input.scss -a {b: log("test")} +<===> error/number_type/input.scss +a {b: log("0")} -<===> error/syntax/quoted_string/error +<===> error/number_type/error Error: Expected number, variable, function, or calculation. , -1 | a {b: log("test")} +1 | a {b: log("0")} | ^ ' input.scss 1:11 root stylesheet <===> ================================================================================ -<===> error/unit/percentage/input.scss -a {b: log(5%, 3%)} +<===> error/base_type/input.scss +a {b: log(0, "0")} -<===> error/unit/percentage/error -Error: Expected 5% to have no units. +<===> error/base_type/error +Error: Expected number, variable, function, or calculation. , -1 | a {b: log(5%, 3%)} - | ^^^^^^^^^^^ +1 | a {b: log(0, "0")} + | ^ ' - input.scss 1:7 root stylesheet + input.scss 1:14 root stylesheet <===> ================================================================================ -<===> error/compatible_units/input.scss -a {b: log(10px, 10px)} +<===> error/too_few_args/input.scss +a {b: log()} -<===> error/compatible_units/error -Error: Expected 10px to have no units. +<===> error/too_few_args/error +Error: Expected number, variable, function, or calculation. , -1 | a {b: log(10px, 10px)} - | ^^^^^^^^^^^^^^^ +1 | a {b: log()} + | ^ ' - input.scss 1:7 root stylesheet + input.scss 1:11 root stylesheet <===> ================================================================================ -<===> error/unknown_units/input.scss -a { - b: log(1foo, 2bar); -} +<===> error/too_many_args/input.scss +a {b: log(0, 0, 0)} -<===> error/unknown_units/error -Error: Expected 1foo to have no units. +<===> error/too_many_args/error +Error: expected "+", "-", "*", "/", or ")". , -2 | b: log(1foo, 2bar); - | ^^^^^^^^^^^^^^^ +1 | a {b: log(0, 0, 0)} + | ^ ' - input.scss 2:6 root stylesheet + input.scss 1:15 root stylesheet <===> ================================================================================ -<===> error/incompatible_units/input.scss -a {b: log(7em, -3deg)} +<===> error/syntax/invalid_arg/input.scss +a {b: log($, $c)} -<===> error/incompatible_units/error -Error: 7em and -3deg are incompatible. +<===> error/syntax/invalid_arg/error +Error: Expected identifier. , -1 | a {b: log(7em, -3deg)} - | ^^^ 7em - | ===== -3deg +1 | a {b: log($, $c)} + | ^ ' - input.scss 1:11 root stylesheet + input.scss 1:12 root stylesheet <===> ================================================================================ -<===> single_number/units/input.scss -a {b: log(3px)} +<===> error/mod/input.scss +a {b: log(7 % 3)} -<===> single_number/units/error -Error: Expected 3px to have no units. +<===> error/mod/error +Error: expected "+", "-", "*", "/", ",", or ")". , -1 | a {b: log(3px)} - | ^^^^^^^^ +1 | a {b: log(7 % 3)} + | ^ ' - input.scss 1:7 root stylesheet + input.scss 1:13 root stylesheet diff --git a/spec/values/calculation/mod.hrx b/spec/values/calculation/mod.hrx index 0348ca374..490aab3b7 100644 --- a/spec/values/calculation/mod.hrx +++ b/spec/values/calculation/mod.hrx @@ -4,317 +4,266 @@ terseness' sake isn't tested explicitly. <===> ================================================================================ -<===> error/syntax/no_arg/input.scss -a {b: mod()} - -<===> error/syntax/no_arg/error -Error: Expected number, variable, function, or calculation. - , -1 | a {b: mod()} - | ^ - ' - input.scss 1:11 root stylesheet - -<===> -================================================================================ -<===> error/syntax/missing_arg/input.scss -a {b: mod(3)} - -<===> error/syntax/missing_arg/error -Error: 2 arguments required, but only 1 was passed. - , -1 | a {b: mod(3)} - | ^^^^^^ - ' - input.scss 1:7 root stylesheet - -<===> -================================================================================ -<===> error/syntax/many_args/input.scss -a {b: mod(3, 2, 1)} - -<===> error/syntax/many_args/error -Error: expected "+", "-", "*", "/", or ")". - , -1 | a {b: mod(3, 2, 1)} - | ^ - ' - input.scss 1:15 root stylesheet - -<===> -================================================================================ -<===> error/syntax/incompatible/input.scss -a {b: mod(16px, 5)} - -<===> error/syntax/incompatible/error -Error: 16px and 5 are incompatible. - , -1 | a {b: mod(16px, 5)} - | ^^^^ 16px - | = 5 - ' - input.scss 1:11 root stylesheet - -<===> -================================================================================ -<===> error/syntax/operation_incompatible/input.scss -a {b: mod(1 + 16px, 2)} - -<===> error/syntax/operation_incompatible/error -Error: 1 and 16px are incompatible. - , -1 | a {b: mod(1 + 16px, 2)} - | ^^^^^^^^ - ' - input.scss 1:11 root stylesheet - -<===> -================================================================================ -<===> error/syntax/min_incompatible/input.scss -a {b: mod(min(16, 9px), 6)} +<===> units/none/input.scss +a {b: mod(7, 3)} -<===> error/syntax/min_incompatible/error -Error: 9px and 6 are incompatible. - , -1 | a {b: mod(min(16, 9px), 6)} - | ^^^^^^^^^^^^ 9px - | = 6 - ' - input.scss 1:11 root stylesheet +<===> units/none/output.css +a { + b: 1; +} <===> ================================================================================ -<===> error/syntax/invalid_arg/input.scss -a {b: mod($)} +<===> units/compatible/input.scss +a {b: mod(5px, 3px)} -<===> error/syntax/invalid_arg/error -Error: Expected identifier. - , -1 | a {b: mod($)} - | ^ - ' - input.scss 1:12 root stylesheet +<===> units/compatible/output.css +a { + b: 2px; +} <===> ================================================================================ -<===> error/syntax/quoted_string/input.scss -a {b: mod("test")} +<===> units/real_and_unknown/input.scss +a {b: mod(5px, 3%)} -<===> error/syntax/quoted_string/error -Error: Expected number, variable, function, or calculation. - , -1 | a {b: mod("test")} - | ^ - ' - input.scss 1:11 root stylesheet +<===> units/real_and_unknown/output.css +a { + b: mod(5px, 3%); +} <===> ================================================================================ -<===> error/syntax/one_arg/input.scss -a {b: mod(4)} +<===> units/unknown/input.scss +a { + b: mod(1%, 2%); +} -<===> error/syntax/one_arg/error -Error: 2 arguments required, but only 1 was passed. - , -1 | a {b: mod(4)} - | ^^^^^^ - ' - input.scss 1:7 root stylesheet +<===> units/unknown/output.css +a { + b: 1%; +} <===> ================================================================================ -<===> error/complex_unit/input.scss -a {b: mod(1px*1px, 2)} +<===> units/fake/input.scss +a { + b: mod(1foo, 2bar); +} -<===> error/complex_unit/error -Error: Number 1px*px isn't compatible with CSS calculations. - , -1 | a {b: mod(1px*1px, 2)} - | ^^^^^^^ - ' - input.scss 1:11 root stylesheet +<===> units/fake/output.css +a { + b: mod(1foo, 2bar); +} <===> ================================================================================ -<===> error/incompatible_units/input.scss -a {b: mod(7em, -3deg)} +<===> units/real_and_fake/input.scss +a { + b: mod(1px, 2bar); +} -<===> error/incompatible_units/error -Error: 7em and -3deg are incompatible. - , -1 | a {b: mod(7em, -3deg)} - | ^^^ 7em - | ===== -3deg - ' - input.scss 1:11 root stylesheet +<===> units/real_and_fake/output.css +a { + b: mod(1px, 2bar); +} <===> ================================================================================ -<===> error/unit/input.scss -a {b: mod(5%, 3%)} +<===> y_zero/input.scss +a {b: mod(6, 0)} -<===> error/unit/output.css +<===> y_zero/output.css a { - b: 2%; + b: calc(NaN); } <===> ================================================================================ -<===> operation/unitless/positive_args/input.scss -a {b: mod(7, 3)} +<===> x_zero/input.scss +a {b: mod(0, 6)} -<===> operation/unitless/positive_args/output.css +<===> x_zero/output.css a { - b: 1; + b: 0; } <===> ================================================================================ -<===> operation/unitless/y_negative/input.scss -a {b: mod(7px, -3px)} +<===> zeros/input.scss +a {b: mod(0, 0)} -<===> operation/unitless/y_negative/output.css +<===> zeros/output.css a { - b: -2px; + b: calc(NaN); } <===> ================================================================================ -<===> operation/unitless/x_negative/input.scss -a {b: mod(-7, 3)} +<===> operation/y_infinity/positive/input.scss +a {b: mod(infinity, 10)} -<===> operation/unitless/x_negative/output.css +<===> operation/y_infinity/positive/output.css a { - b: 2; + b: calc(NaN); } <===> ================================================================================ -<===> operation/unitless/negative_args/input.scss -a {b: mod(-7, -3)} +<===> operation/x_infinity/positive/input.scss +a {b: mod(-10, infinity)} -<===> operation/unitless/negative_args/output.css +<===> operation/x_infinity/positive/output.css a { - b: -1; + b: calc(NaN); } <===> ================================================================================ -<===> operation/y_zero/plus/input.scss -a {b: mod(6, 0)} +<===> operation/x_infinity/negative/input.scss +a {b: mod(10, -infinity)} -<===> operation/y_zero/plus/output.css +<===> operation/x_infinity/negative/output.css a { b: calc(NaN); } <===> ================================================================================ -<===> operation/x_zero/plus/input.scss -a {b: mod(0, 6)} +<===> operation/simplification/input.scss +a { + b: mod(3px - 1px + var(--c), 4px + 10px); +} -<===> operation/x_zero/plus/output.css +<===> operation/simplification/output.css a { - b: 0; + b: mod(2px + var(--c), 14px); } <===> ================================================================================ -<===> operation/zeros/plus/input.scss -a {b: mod(0, 0)} +<===> positive_zero/input.scss +@use "sass:math"; +a {b: math.div(1, mod(7, 7))} -<===> operation/zeros/plus/output.css +<===> positive_zero/output.css a { - b: calc(NaN); + b: calc(infinity); } <===> ================================================================================ -<===> operation/y_infinity/plus/input.scss +<===> negative_zero/input.scss @use "sass:math"; -a {b: mod(math.div(1, 0), 10)} +a {b: math.div(1, mod(-7, 7))} -<===> operation/y_infinity/plus/output.css +<===> negative_zero/output.css a { - b: calc(NaN); + b: calc(infinity); } <===> ================================================================================ -<===> operation/x_infinity/plus/input.scss -a {b: mod(10, infinity)} +<===> error/units/unit_and_unitless/input.scss +a {b: mod(16px, 5)} -<===> operation/x_infinity/plus/output.css -a { - b: 10; -} +<===> error/units/unit_and_unitless/error +Error: 16px and 5 are incompatible. + , +1 | a {b: mod(16px, 5)} + | ^^^^ 16px + | = 5 + ' + input.scss 1:11 root stylesheet <===> ================================================================================ -<===> operation/x_infinity/negative/input.scss -a {b: mod(10, -infinity)} +<===> error/units/incompatible/input.scss +a {b: mod(16px, 5deg)} -<===> operation/x_infinity/negative/output.css -a { - b: calc(NaN); -} +<===> error/units/incompatible/error +Error: 16px and 5deg are incompatible. + , +1 | a {b: mod(16px, 5deg)} + | ^^^^ 16px + | ==== 5deg + ' + input.scss 1:11 root stylesheet <===> ================================================================================ -<===> operation/x_infinity/positive/input.scss -a {b: mod(-10, infinity)} +<===> error/too_few_args/input.scss +a {b: mod(3)} -<===> operation/x_infinity/positive/output.css -a { - b: calc(NaN); -} +<===> error/too_few_args/error +Error: 2 arguments required, but only 1 was passed. + , +1 | a {b: mod(3)} + | ^^^^^^ + ' + input.scss 1:7 root stylesheet <===> ================================================================================ -<===> preserved/unknown_units/input.scss -a { - b: mod(1foo, 2bar); -} +<===> error/syntax/invalid_arg/input.scss +a {b: mod($c, $)} -<===> preserved/unknown_units/output.css -a { - b: mod(1foo, 2bar); -} +<===> error/syntax/invalid_arg/error +Error: Expected identifier. + , +1 | a {b: mod($c, $)} + | ^ + ' + input.scss 1:16 root stylesheet <===> ================================================================================ -<===> preserved/variable/input.scss -a { - --two-args: 2, 3; - b: mod(var(--two-args)); -} +<===> error/modulus_type/input.scss +a {b: mod(0, "0")} -<===> preserved/variable/output.css -a { - --two-args: 2, 3; - b: mod(var(--two-args)); -} +<===> error/modulus_type/error +Error: Expected number, variable, function, or calculation. + , +1 | a {b: mod(0, "0")} + | ^ + ' + input.scss 1:14 root stylesheet <===> ================================================================================ -<===> preserved/percent/input.scss -a {b: mod(4px, 3px - 1.5px + 5%)} +<===> error/dividend_type/input.scss +a {b: mod("0", 0)} -<===> preserved/percent/output.css -a { - b: mod(4px, 1.5px + 5%); -} +<===> error/dividend_type/error +Error: Expected number, variable, function, or calculation. + , +1 | a {b: mod("0", 0)} + | ^ + ' + input.scss 1:11 root stylesheet <===> ================================================================================ -<===> preserved/operation/variable/input.scss -a { - --test: 5; - b: mod(3px - 1px + var(--test), 4px); -} +<===> error/too_many_args/input.scss +a {b: mod(3, 2, 1)} -<===> preserved/operation/variable/output.css -a { - --test: 5; - b: mod(2px + var(--test), 4px); -} +<===> error/too_many_args/error +Error: expected "+", "-", "*", "/", or ")". + , +1 | a {b: mod(3, 2, 1)} + | ^ + ' + input.scss 1:15 root stylesheet + +<===> +================================================================================ +<===> error/mod/input.scss +a {b: mod(7 % 3, $x)} + +<===> error/mod/error +Error: expected "+", "-", "*", "/", ",", or ")". + , +1 | a {b: mod(7 % 3, $x)} + | ^ + ' + input.scss 1:13 root stylesheet diff --git a/spec/values/calculation/pow.hrx b/spec/values/calculation/pow.hrx index 4f0c93f59..3ee6a3599 100644 --- a/spec/values/calculation/pow.hrx +++ b/spec/values/calculation/pow.hrx @@ -4,169 +4,108 @@ terseness' sake isn't tested explicitly. <===> ================================================================================ -<===> error/syntax/no_arg/input.scss -a {b: pow()} - -<===> error/syntax/no_arg/error -Error: Expected number, variable, function, or calculation. - , -1 | a {b: pow()} - | ^ - ' - input.scss 1:11 root stylesheet - -<===> -================================================================================ -<===> error/syntax/missing_arg/input.scss -a {b: pow(3)} - -<===> error/syntax/missing_arg/error -Error: 2 arguments required, but only 1 was passed. - , -1 | a {b: pow(3)} - | ^^^^^^ - ' - input.scss 1:7 root stylesheet - -<===> -================================================================================ -<===> error/syntax/quoted_string/input.scss -a {b: pow("test")} +<===> positive/input.scss +a {b: pow(10, 10)} -<===> error/syntax/quoted_string/error -Error: Expected number, variable, function, or calculation. - , -1 | a {b: pow("test")} - | ^ - ' - input.scss 1:11 root stylesheet +<===> positive/output.css +a { + b: 10000000000; +} <===> ================================================================================ -<===> error/syntax/many_args/input.scss -a {b: pow(3, 2, 1)} +<===> base/negative/input.scss +a {b: pow(-10, 10)} -<===> error/syntax/many_args/error -Error: expected "+", "-", "*", "/", or ")". - , -1 | a {b: pow(3, 2, 1)} - | ^ - ' - input.scss 1:15 root stylesheet +<===> base/negative/output.css +a { + b: 10000000000; +} <===> ================================================================================ -<===> error/syntax/incompatible/input.scss -a {b: pow(16px, 5)} +<===> exponent/negative/input.scss +a {b: pow(10, -10)} -<===> error/syntax/incompatible/error -Error: 16px and 5 are incompatible. - , -1 | a {b: pow(16px, 5)} - | ^^^^ 16px - | = 5 - ' - input.scss 1:11 root stylesheet +<===> exponent/negative/output.css +a { + b: 0.0000000001; +} <===> ================================================================================ -<===> error/syntax/operation_incompatible/input.scss -a {b: pow(1 + 16px, 2)} +<===> zeros/input.scss +a {b: pow(0, 0)} -<===> error/syntax/operation_incompatible/error -Error: 1 and 16px are incompatible. - , -1 | a {b: pow(1 + 16px, 2)} - | ^^^^^^^^ - ' - input.scss 1:11 root stylesheet +<===> zeros/output.css +a { + b: 1; +} <===> ================================================================================ -<===> error/syntax/min_incompatible/input.scss -a {b: pow(min(16, 9px), 6)} +<===> operation/y_infinity/positive/input.scss +a {b: pow(infinity, 10)} -<===> error/syntax/min_incompatible/error -Error: 9px and 6 are incompatible. - , -1 | a {b: pow(min(16, 9px), 6)} - | ^^^^^^^^^^^^ 9px - | = 6 - ' - input.scss 1:11 root stylesheet +<===> operation/y_infinity/positive/output.css +a { + b: calc(infinity); +} <===> ================================================================================ -<===> error/syntax/invalid_arg/input.scss -a {b: pow($)} +<===> operation/x_infinity/positive/input.scss +a {b: pow(10, infinity)} -<===> error/syntax/invalid_arg/error -Error: Expected identifier. - , -1 | a {b: pow($)} - | ^ - ' - input.scss 1:12 root stylesheet +<===> operation/x_infinity/positive/output.css +a { + b: calc(infinity); +} <===> ================================================================================ -<===> error/syntax/one_arg/input.scss -a {b: pow(4)} +<===> operation/simplification/input.scss +a {b: pow(3px - 1px + var(--c), 4px + 10px)} -<===> error/syntax/one_arg/error -Error: 2 arguments required, but only 1 was passed. - , -1 | a {b: pow(4)} - | ^^^^^^ - ' - input.scss 1:7 root stylesheet +<===> operation/simplification/output.css +a { + b: pow(2px + var(--c), 14px); +} <===> ================================================================================ -<===> error/complex_unit/input.scss -a {b: pow(1px*1px, 2)} +<===> error/units/unknown_and_unitless/input.scss +a {b: pow(10%, 10)} -<===> error/complex_unit/error -Error: Number 1px*px isn't compatible with CSS calculations. +<===> error/units/unknown_and_unitless/error +Error: 10% and 10 are incompatible. , -1 | a {b: pow(1px*1px, 2)} - | ^^^^^^^ +1 | a {b: pow(10%, 10)} + | ^^^ 10% + | == 10 ' input.scss 1:11 root stylesheet <===> ================================================================================ -<===> error/with_units/input.scss -a {b: pow(4deg, 10em)} +<===> error/units/unit_and_unitless/input.scss +a {b: pow(10px, 10)} -<===> error/with_units/error -Error: 4deg and 10em are incompatible. +<===> error/units/unit_and_unitless/error +Error: 10px and 10 are incompatible. , -1 | a {b: pow(4deg, 10em)} - | ^^^^ 4deg - | ==== 10em +1 | a {b: pow(10px, 10)} + | ^^^^ 10px + | == 10 ' input.scss 1:11 root stylesheet <===> ================================================================================ -<===> percentage/unit/input.scss -a {b: pow(5%, 3%)} - -<===> percentage/unit/error -Error: Expected 5% to have no units. - , -1 | a {b: pow(5%, 3%)} - | ^^^^^^^^^^^ - ' - input.scss 1:7 root stylesheet - -<===> -================================================================================ -<===> operation/compatible_units/input.scss +<===> error/units/compatible/input.scss a {b: pow(10px, 10px)} -<===> operation/compatible_units/error +<===> error/units/compatible/error Error: Expected 10px to have no units. , 1 | a {b: pow(10px, 10px)} @@ -176,125 +115,78 @@ Error: Expected 10px to have no units. <===> ================================================================================ -<===> operation/unitless/result_is_integer/input.scss -a {b: pow(2, 3)} - -<===> operation/unitless/result_is_integer/output.css -a { - b: 8; -} - -<===> -================================================================================ -<===> operation/unitless/result_is_long/input.scss -a {b: pow(10, 10)} - -<===> operation/unitless/result_is_long/output.css -a { - b: 10000000000; -} - -<===> -================================================================================ -<===> operation/math_nested/minus/input.scss -a {b: pow(3 - 1, 2)} - -<===> operation/math_nested/minus/output.css -a { - b: 4; -} - -<===> -================================================================================ -<===> operation/math/plus/input.scss -a {b: pow(10 + 6, 0)} - -<===> operation/math/plus/output.css -a { - b: 1; -} - -<===> -================================================================================ -<===> operation/math/max/input.scss -a {b: pow(max(2, 9), 2)} +<===> error/syntax/invalid_arg/input.scss +a {b: pow($c, $)} -<===> operation/math/max/output.css -a { - b: 81; -} +<===> error/syntax/invalid_arg/error +Error: Expected identifier. + , +1 | a {b: pow($c, $)} + | ^ + ' + input.scss 1:16 root stylesheet <===> ================================================================================ -<===> operation/math/min/input.scss -a {b: pow(min(2, 9), 5)} +<===> error/base_type/input.scss +a {b: pow(0, "0")} -<===> operation/math/min/output.css -a { - b: 32; -} - -<===> -================================================================================ -<===> preserved/unknown_units/input.scss -a { - b: pow(1foo, 2bar); -} - -<===> preserved/unknown_units/error -Error: Expected 1foo to have no units. +<===> error/base_type/error +Error: Expected number, variable, function, or calculation. , -2 | b: pow(1foo, 2bar); - | ^^^^^^^^^^^^^^^ +1 | a {b: pow(0, "0")} + | ^ ' - input.scss 2:6 root stylesheet + input.scss 1:14 root stylesheet <===> ================================================================================ -<===> preserved/variable/input.scss -a { - --two-args: 2, 3; - b: pow(var(--two-args)); -} +<===> error/exponent_type/input.scss +a {b: pow("0", 0)} -<===> preserved/variable/output.css -a { - --two-args: 2, 3; - b: pow(var(--two-args)); -} +<===> error/exponent_type/error +Error: Expected number, variable, function, or calculation. + , +1 | a {b: pow("0", 0)} + | ^ + ' + input.scss 1:11 root stylesheet <===> ================================================================================ -<===> preserved/unquoted_string/input.scss -a { - b: pow(test); -} +<===> error/too_few_args/input.scss +a {b: pow(3)} -<===> preserved/unquoted_string/output.css -a { - b: pow(test); -} +<===> error/too_few_args/error +Error: 2 arguments required, but only 1 was passed. + , +1 | a {b: pow(3)} + | ^^^^^^ + ' + input.scss 1:7 root stylesheet <===> ================================================================================ -<===> preserved/percent/input.scss -a {b: pow(4px, 3px - 1.5px + 5%)} +<===> error/too_many_args/input.scss +a {b: pow(3, 2, 1)} -<===> preserved/percent/output.css -a { - b: pow(4px, 1.5px + 5%); -} +<===> error/too_many_args/error +Error: expected "+", "-", "*", "/", or ")". + , +1 | a {b: pow(3, 2, 1)} + | ^ + ' + input.scss 1:15 root stylesheet <===> ================================================================================ -<===> preserved/operation/variable/input.scss -a { - --test: 5; - b: pow(3px - 1px + var(--test), 4px); -} +<===> error/mod/input.scss +a {b: pow(7 % 3, $x)} -<===> preserved/operation/variable/output.css -a { - --test: 5; - b: pow(2px + var(--test), 4px); -} +<===> error/mod/error +Error: expected "+", "-", "*", "/", ",", or ")". + , +1 | a {b: pow(7 % 3, $x)} + | ^ + ' + input.scss 1:13 root stylesheet diff --git a/spec/values/calculation/rem.hrx b/spec/values/calculation/rem.hrx index 6d7838802..da27c28e7 100644 --- a/spec/values/calculation/rem.hrx +++ b/spec/values/calculation/rem.hrx @@ -4,331 +4,266 @@ terseness' sake isn't tested explicitly. <===> ================================================================================ -<===> error/syntax/no_arg/input.scss -a {b: rem()} - -<===> error/syntax/no_arg/error -Error: Expected number, variable, function, or calculation. - , -1 | a {b: rem()} - | ^ - ' - input.scss 1:11 root stylesheet - -<===> -================================================================================ -<===> error/syntax/missing_arg/input.scss -a {b: rem(3)} - -<===> error/syntax/missing_arg/error -Error: 2 arguments required, but only 1 was passed. - , -1 | a {b: rem(3)} - | ^^^^^^ - ' - input.scss 1:7 root stylesheet - -<===> -================================================================================ -<===> error/syntax/many_args/input.scss -a {b: rem(3, 2, 1)} - -<===> error/syntax/many_args/error -Error: expected "+", "-", "*", "/", or ")". - , -1 | a {b: rem(3, 2, 1)} - | ^ - ' - input.scss 1:15 root stylesheet - -<===> -================================================================================ -<===> error/syntax/incompatible/input.scss -a {b: rem(16px, 5)} - -<===> error/syntax/incompatible/error -Error: 16px and 5 are incompatible. - , -1 | a {b: rem(16px, 5)} - | ^^^^ 16px - | = 5 - ' - input.scss 1:11 root stylesheet - -<===> -================================================================================ -<===> error/syntax/operation_incompatible/input.scss -a {b: rem(1 + 16px, 2)} - -<===> error/syntax/operation_incompatible/error -Error: 1 and 16px are incompatible. - , -1 | a {b: rem(1 + 16px, 2)} - | ^^^^^^^^ - ' - input.scss 1:11 root stylesheet - -<===> -================================================================================ -<===> error/syntax/min_incompatible/input.scss -a {b: rem(min(16, 9px), 6)} +<===> units/none/input.scss +a {b: rem(7, 3)} -<===> error/syntax/min_incompatible/error -Error: 9px and 6 are incompatible. - , -1 | a {b: rem(min(16, 9px), 6)} - | ^^^^^^^^^^^^ 9px - | = 6 - ' - input.scss 1:11 root stylesheet +<===> units/none/output.css +a { + b: 1; +} <===> ================================================================================ -<===> error/syntax/invalid_arg/input.scss -a {b: rem($)} +<===> units/compatible/input.scss +a {b: rem(5px, 3px)} -<===> error/syntax/invalid_arg/error -Error: Expected identifier. - , -1 | a {b: rem($)} - | ^ - ' - input.scss 1:12 root stylesheet +<===> units/compatible/output.css +a { + b: 2px; +} <===> ================================================================================ -<===> error/syntax/quoted_string/input.scss -a {b: rem("test")} +<===> units/real_and_unknown/input.scss +a {b: rem(5px, 3%)} -<===> error/syntax/quoted_string/error -Error: Expected number, variable, function, or calculation. - , -1 | a {b: rem("test")} - | ^ - ' - input.scss 1:11 root stylesheet +<===> units/real_and_unknown/output.css +a { + b: rem(5px, 3%); +} <===> ================================================================================ -<===> error/syntax/one_arg/input.scss -a {b: rem(4)} +<===> units/unknown/input.scss +a { + b: rem(1%, 2%); +} -<===> error/syntax/one_arg/error -Error: 2 arguments required, but only 1 was passed. - , -1 | a {b: rem(4)} - | ^^^^^^ - ' - input.scss 1:7 root stylesheet +<===> units/unknown/output.css +a { + b: 1%; +} <===> ================================================================================ -<===> error/complex_unit/input.scss -a {b: rem(1px*1px, 2)} +<===> units/fake/input.scss +a { + b: rem(1foo, 2bar); +} -<===> error/complex_unit/error -Error: Number 1px*px isn't compatible with CSS calculations. - , -1 | a {b: rem(1px*1px, 2)} - | ^^^^^^^ - ' - input.scss 1:11 root stylesheet +<===> units/fake/output.css +a { + b: rem(1foo, 2bar); +} <===> ================================================================================ -<===> error/incompatible_units/input.scss -a {b: rem(7em, -3deg)} +<===> units/real_and_fake/input.scss +a { + b: rem(1px, 2bar); +} -<===> error/incompatible_units/error -Error: 7em and -3deg are incompatible. - , -1 | a {b: rem(7em, -3deg)} - | ^^^ 7em - | ===== -3deg - ' - input.scss 1:11 root stylesheet +<===> units/real_and_fake/output.css +a { + b: rem(1px, 2bar); +} <===> ================================================================================ -<===> percentage/unit/input.scss -a {b: rem(5%, 3%)} +<===> y_zero/input.scss +a {b: rem(6, 0)} -<===> percentage/unit/output.css +<===> y_zero/output.css a { - b: 2%; + b: calc(NaN); } <===> ================================================================================ -<===> unitless/positive_args/input.scss -a {b: rem(7, 3)} +<===> x_zero/input.scss +a {b: rem(0, 6)} -<===> unitless/positive_args/output.css +<===> x_zero/output.css a { - b: 1; + b: 0; } <===> ================================================================================ -<===> unitless/y_negative/input.scss -a {b: rem(7px, -3px)} +<===> zeros/input.scss +a {b: rem(0, 0)} -<===> unitless/y_negative/output.css +<===> zeros/output.css a { - b: -9px; + b: calc(NaN); } <===> ================================================================================ -<===> unitless/x_negative/input.scss -a {b: rem(-7, 3)} +<===> operation/y_infinity/positive/input.scss +a {b: rem(infinity, 10)} -<===> unitless/x_negative/output.css +<===> operation/y_infinity/positive/output.css a { - b: 9; + b: calc(NaN); } <===> ================================================================================ -<===> unitless/negative_args/input.scss -a {b: rem(-7, -3)} +<===> operation/x_infinity/positive/input.scss +a {b: rem(-10, infinity)} -<===> unitless/negative_args/output.css +<===> operation/x_infinity/positive/output.css a { - b: -1; + b: -10; } <===> ================================================================================ -<===> negative_zero/input.scss -@use "sass:math"; -a {b: math.div(1, rem(-7, 7))} +<===> operation/x_infinity/negative/input.scss +a {b: rem(10, -infinity)} -<===> negative_zero/output.css +<===> operation/x_infinity/negative/output.css a { - b: calc(-infinity); + b: 10; } <===> ================================================================================ -<===> preserved/unknown_units/input.scss +<===> operation/simplification/input.scss a { - b: rem(1foo, 2bar); + b: rem(3px - 1px + var(--c), 4px + 10px); } -<===> preserved/unknown_units/output.css +<===> operation/simplification/output.css a { - b: rem(1foo, 2bar); + b: rem(2px + var(--c), 14px); } <===> ================================================================================ -<===> preserved/variable/input.scss -a { - --two-args: 2, 3; - b: rem(var(--two-args)); -} +<===> positive_zero/input.scss +@use "sass:math"; +a {b: math.div(1, rem(7, 7))} -<===> preserved/variable/output.css +<===> positive_zero/output.css a { - --two-args: 2, 3; - b: rem(var(--two-args)); + b: calc(infinity); } <===> ================================================================================ -<===> preserved/unquoted_string/input.scss -a { - b: rem(test); -} +<===> negative_zero/input.scss +@use "sass:math"; +a {b: math.div(1, rem(-7, 7))} -<===> preserved/unquoted_string/output.css +<===> negative_zero/output.css a { - b: rem(test); + b: calc(-infinity); } <===> ================================================================================ -<===> preserved/percent/input.scss -a {b: rem(4px, 3px - 1.5px + 5%)} +<===> error/units/unit_and_unitless/input.scss +a {b: rem(16px, 5)} -<===> preserved/percent/output.css -a { - b: rem(4px, 1.5px + 5%); -} +<===> error/units/unit_and_unitless/error +Error: 16px and 5 are incompatible. + , +1 | a {b: rem(16px, 5)} + | ^^^^ 16px + | = 5 + ' + input.scss 1:11 root stylesheet <===> ================================================================================ -<===> preserved/operation/variable/input.scss -a { - --test: 5; - b: rem(3px - 1px + var(--test), 4px); -} +<===> error/units/incompatible/input.scss +a {b: rem(16px, 5deg)} -<===> preserved/operation/variable/output.css -a { - --test: 5; - b: rem(2px + var(--test), 4px); -} +<===> error/units/incompatible/error +Error: 16px and 5deg are incompatible. + , +1 | a {b: rem(16px, 5deg)} + | ^^^^ 16px + | ==== 5deg + ' + input.scss 1:11 root stylesheet <===> ================================================================================ -<===> positive_zero/input.scss -@use "sass:math"; -a {b: math.div(1, rem(7, 7))} +<===> error/too_few_args/input.scss +a {b: rem(3)} -<===> positive_zero/output.css -a { - b: calc(infinity); -} +<===> error/too_few_args/error +Error: 2 arguments required, but only 1 was passed. + , +1 | a {b: rem(3)} + | ^^^^^^ + ' + input.scss 1:7 root stylesheet <===> ================================================================================ -<===> y_zero/plus/input.scss -a {b: rem(6, 0)} +<===> error/syntax/invalid_arg/input.scss +a {b: rem($c, $)} -<===> y_zero/plus/output.css -a { - b: calc(NaN); -} +<===> error/syntax/invalid_arg/error +Error: Expected identifier. + , +1 | a {b: rem($c, $)} + | ^ + ' + input.scss 1:16 root stylesheet <===> ================================================================================ -<===> x_zero/plus/input.scss -a {b: rem(0, 6)} +<===> error/modulus_type/input.scss +a {b: rem(0, "0")} -<===> x_zero/plus/output.css -a { - b: 0; -} +<===> error/modulus_type/error +Error: Expected number, variable, function, or calculation. + , +1 | a {b: rem(0, "0")} + | ^ + ' + input.scss 1:14 root stylesheet <===> ================================================================================ -<===> zeros/plus/input.scss -a {b: rem(0, 0)} +<===> error/dividend_type/input.scss +a {b: rem("0", 0)} -<===> zeros/plus/output.css -a { - b: calc(NaN); -} +<===> error/dividend_type/error +Error: Expected number, variable, function, or calculation. + , +1 | a {b: rem("0", 0)} + | ^ + ' + input.scss 1:11 root stylesheet <===> ================================================================================ -<===> y_infinity/plus/input.scss -@use "sass:math"; -a {b: rem(math.div(1, 0), 10)} +<===> error/too_many_args/input.scss +a {b: rem(3, 2, 1)} -<===> y_infinity/plus/output.css -a { - b: calc(NaN); -} +<===> error/too_many_args/error +Error: expected "+", "-", "*", "/", or ")". + , +1 | a {b: rem(3, 2, 1)} + | ^ + ' + input.scss 1:15 root stylesheet <===> ================================================================================ -<===> x_infinity/plus/input.scss -a {b: rem(10, infinity)} +<===> error/mod/input.scss +a {b: rem(7 % 3, $x)} -<===> x_infinity/plus/output.css -a { - b: 10; -} +<===> error/mod/error +Error: expected "+", "-", "*", "/", ",", or ")". + , +1 | a {b: rem(7 % 3, $x)} + | ^ + ' + input.scss 1:13 root stylesheet diff --git a/spec/values/calculation/round/one_argument.hrx b/spec/values/calculation/round/one_argument.hrx index 216d57930..2680f74d0 100644 --- a/spec/values/calculation/round/one_argument.hrx +++ b/spec/values/calculation/round/one_argument.hrx @@ -1,58 +1,67 @@ <===> README.md -Most of the same behavior tested for `calc()` applies to single-argument -`round()`, but for terseness' sake isn't tested explicitly. +Most of the same behavior tested for `calc()` applies to `round()`, but for +terseness' sake isn't tested explicitly. <===> ================================================================================ -<===> preserved/unquoted_string/input.scss -a {b: round(test)} +<===> zero/input.scss +a {b: round(0)} -<===> preserved/unquoted_string/output.css +<===> zero/output.css a { - b: round(test); + b: 0; } <===> ================================================================================ -<===> operation/math_simplify/input.scss -a {b: round(3.8px + 4px)} +<===> positive/input.scss +a {b: round(1)} -<===> operation/math_simplify/output.css +<===> positive/output.css a { - b: 8px; + b: 1; } <===> ================================================================================ -<===> unitless/input.scss -a {b: round(5.5)} +<===> negative/input.scss +a {b: round(-5.6)} -<===> unitless/output.css +<===> negative/output.css a { - b: 6; + b: -6; } <===> ================================================================================ -<===> variable/named_arg/input.scss -c {d: round($number: 12.1)} +<===> operation/preserves_units/input.scss +a {b: round(-7px / 4em) * 1em} -<===> variable/named_arg/output.css -c { - d: 12; +<===> operation/preserves_units/output.css +a { + b: -2px; } <===> ================================================================================ -<===> unknown_variable/input.scss +<===> preserved/variable/input.scss a { - --example: 5; - b: round(var(--example)); + b: round(var(--c)) } -<===> unknown_variable/output.css + +<===> preserved/variable/output.css a { - --example: 5; - b: round(var(--example)); + b: round(var(--c)); +} + +<===> +================================================================================ +<===> named_argument/input.scss +a {b: round($number: -3)} + +<===> named_argument/output.css +a { + b: -3; } <===> @@ -91,25 +100,64 @@ More info and automated migrator: https://sass-lang.com/d/slash-div <===> ================================================================================ -<===> math/max/input.scss +<===> error/named_argument/variable/input.scss +a {b: round($number: var(--c))} + +<===> error/named_argument/variable/error +Error: $number: var(--c) is not a number. + , +1 | a {b: round($number: var(--c))} + | ^^^^^^^^^^^^^^^^^^^^^^^^ + ' + input.scss 1:7 root stylesheet + +<===> +================================================================================ +<===> error/unsimplifiable/input.scss +a {b: round(17px + 5%)} + +<===> error/unsimplifiable/error +Error: Single argument 17px + 5% expected to be simplifiable. + , +1 | a {b: round(17px + 5%)} + | ^^^^^^^^^^^^^^^^ + ' + input.scss 1:7 root stylesheet + +<===> +================================================================================ +<===> error/variables/input.scss a { - e: round(max(1px, 1%)); + b: round(1px + 2px - var(--c)) } -<===> math/max/error -Error: Single argument max(1px, 1%) expected to be simplifiable. +<===> error/variables/error +Error: Single argument 3px - var(--c) expected to be simplifiable. , -2 | e: round(max(1px, 1%)); - | ^^^^^^^^^^^^^^^^^^^ +2 | b: round(1px + 2px - var(--c)) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ' input.scss 2:6 root stylesheet <===> ================================================================================ -<===> error/syntax/no_arg/input.scss +<===> error/type/input.scss +a {b: round("0")} + +<===> error/type/error +Error: $number: "0" is not a number. + , +1 | a {b: round("0")} + | ^^^^^^^^^^ + ' + input.scss 1:7 root stylesheet + +<===> +================================================================================ +<===> error/no_args/input.scss a {b: round()} -<===> error/syntax/no_arg/error +<===> error/no_args/error Error: Missing argument $number. ,--> input.scss 1 | a {b: round()} @@ -123,46 +171,30 @@ Error: Missing argument $number. <===> ================================================================================ -<===> error/one_arg/missing_args/input.scss -a { - c: round(up); -} +<===> error/too_many_args/input.scss +a {b: round(1, 2, 3, 4)} -<===> error/one_arg/missing_args/error -Error: Number to round and step arguments are required. - , -2 | c: round(up); - | ^^^^^^^^^ +<===> error/too_many_args/error +Error: Only 1 argument allowed, but 4 were passed. + ,--> input.scss +1 | a {b: round(1, 2, 3, 4)} + | ^^^^^^^^^^^^^^^^^ invocation ' - input.scss 2:6 root stylesheet - -<===> -================================================================================ -<===> error/one_arg/unsimplified/input.scss -a { - c: round(1px + 10%); -} - -<===> error/one_arg/unsimplified/error -Error: Single argument 1px + 10% expected to be simplifiable. - , -2 | c: round(1px + 10%); - | ^^^^^^^^^^^^^^^^ + ,--> sass:math +1 | @function round($number) { + | ============== declaration ' - input.scss 2:6 root stylesheet + input.scss 1:7 root stylesheet <===> ================================================================================ -<===> error/math/variable/input.scss -a { - --example: 5; - b: round(3.8px + var(--example)); -} +<===> error/syntax/invalid_arg/input.scss +a {b: round($)} -<===> error/math/variable/error -Error: Single argument 3.8px + var(--example) expected to be simplifiable. +<===> error/syntax/invalid_arg/error +Error: Expected identifier. , -3 | b: round(3.8px + var(--example)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 | a {b: round($)} + | ^ ' - input.scss 3:6 root stylesheet + input.scss 1:14 root stylesheet diff --git a/spec/values/calculation/round/three_arguments.hrx b/spec/values/calculation/round/three_arguments.hrx index 8c103bc77..07069ea3f 100644 --- a/spec/values/calculation/round/three_arguments.hrx +++ b/spec/values/calculation/round/three_arguments.hrx @@ -6,12 +6,10 @@ terseness' sake isn't tested explicitly. ================================================================================ <===> 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); } @@ -147,22 +145,22 @@ a { ================================================================================ <===> unknown_variable/first_arg/input.scss a { - e: round(var(--example), 8px, 9px); + e: round(var(--c), 8px, 9px); } <===> unknown_variable/first_arg/output.css a { - e: round(var(--example), 8px, 9px); + e: round(var(--c), 8px, 9px); } <===> ================================================================================ <===> unknown_variable/third_arg/input.scss a { - d: round(up, 8px, var(--example)); + d: round(up, 8px, var(--c)); } <===> unknown_variable/third_arg/output.css a { - d: round(up, 8px, var(--example)); + d: round(up, 8px, var(--c)); } <===> diff --git a/spec/values/calculation/round/two_arguments.hrx b/spec/values/calculation/round/two_arguments.hrx index c59ef793b..6023b66b4 100644 --- a/spec/values/calculation/round/two_arguments.hrx +++ b/spec/values/calculation/round/two_arguments.hrx @@ -131,12 +131,12 @@ a { ================================================================================ <===> error/unknown_variable/number/input.scss a { - c: round(up, var(--example)); + c: round(up, var(--c)); } <===> error/unknown_variable/number/output.css a { - c: round(up, var(--example)); + c: round(up, var(--c)); } <===> diff --git a/spec/values/calculation/sign.hrx b/spec/values/calculation/sign.hrx index 0ae6039f4..13dd55eca 100644 --- a/spec/values/calculation/sign.hrx +++ b/spec/values/calculation/sign.hrx @@ -4,172 +4,127 @@ terseness' sake isn't tested explicitly. <===> ================================================================================ -<===> error/syntax/no_arg/input.scss -a {b: sign()} - -<===> error/syntax/no_arg/error -Error: Expected number, variable, function, or calculation. - , -1 | a {b: sign()} - | ^ - ' - input.scss 1:12 root stylesheet - -<===> -================================================================================ -<===> error/syntax/many_args/input.scss -a {b: sign(3, 2)} - -<===> error/syntax/many_args/error -Error: expected "+", "-", "*", "/", or ")". - , -1 | a {b: sign(3, 2)} - | ^ - ' - input.scss 1:13 root stylesheet - -<===> -================================================================================ -<===> error/syntax/operation_incompatible/input.scss -a {b: sign(1 + 16px)} - -<===> error/syntax/operation_incompatible/error -Error: 1 and 16px are incompatible. - , -1 | a {b: sign(1 + 16px)} - | ^^^^^^^^ - ' - input.scss 1:12 root stylesheet +<===> positive/input.scss +a {b: sign(3)} -<===> -================================================================================ -<===> error/syntax/invalid_arg/input.scss -a {b: sign($)} - -<===> error/syntax/invalid_arg/error -Error: Expected identifier. - , -1 | a {b: sign($)} - | ^ - ' - input.scss 1:13 root stylesheet - -<===> -================================================================================ -<===> error/complex_unit/input.scss -a {b: sign(1px*1px)} - -<===> error/complex_unit/output.css +<===> positive/output.css a { b: 1; } <===> ================================================================================ -<===> error/unit/input.scss -a {b: sign(5%)} +<===> negative/input.scss +a {b: sign(-5.6)} -<===> error/unit/output.css +<===> negative/output.css a { - b: sign(5%); + b: -1; } <===> ================================================================================ -<===> operation/unit/positive/input.scss -a {b: sign(5px)} +<===> zero/input.scss +a {b: sign(0)} -<===> operation/unit/positive/output.css +<===> zero/output.css a { - b: 1; + b: 0; } <===> ================================================================================ -<===> operation/unitless/negative/input.scss -a {b: sign(-1000.65)} +<===> zero_fuzzy/input.scss +a {b: sign(0.000000000001)} -<===> operation/unitless/negative/output.css +<===> zero_fuzzy/output.css a { - b: -1; + b: 1; } <===> ================================================================================ -<===> operation/zero/positive/input.scss -a {b: sign(0px)} +<===> operation/preserves_units/input.scss +a {b: sign(-7px / 4em) * 1em} -<===> operation/zero/positive/output.css +<===> operation/preserves_units/output.css a { - b: 0; + b: -1em; } <===> ================================================================================ -<===> operation/zero/negative/input.scss -a {b: sign(-0)} +<===> operation/simplification/input.scss +a { + b: sign(1px + 2px - var(--c)) +} -<===> operation/zero/negative/output.css +<===> operation/simplification/output.css a { - b: 0; + b: sign(3px - var(--c)); } <===> ================================================================================ -<===> operation/nan/input.scss -a {b: sign(NaN)} +<===> error/type/input.scss +a {b: sign("0")} -<===> operation/nan/output.css -a { - b: calc(NaN); -} +<===> error/type/error +Error: Expected number, variable, function, or calculation. + , +1 | a {b: sign("0")} + | ^ + ' + input.scss 1:12 root stylesheet <===> ================================================================================ -<===> preserved/variable/input.scss -a { - --one-arg: 2; - b: sign(var(--one-arg)); -} +<===> error/too_few_args/input.scss +a {b: sign()} -<===> preserved/variable/output.css -a { - --one-arg: 2; - b: sign(var(--one-arg)); -} +<===> error/too_few_args/error +Error: Expected number, variable, function, or calculation. + , +1 | a {b: sign()} + | ^ + ' + input.scss 1:12 root stylesheet <===> ================================================================================ -<===> preserved/unquoted_string/input.scss -a { - b: sign(test); -} +<===> error/too_many_args/input.scss +a {b: sign(0, 0)} -<===> preserved/unquoted_string/output.css -a { - b: sign(test); -} +<===> error/too_many_args/error +Error: expected "+", "-", "*", "/", or ")". + , +1 | a {b: sign(0, 0)} + | ^ + ' + input.scss 1:13 root stylesheet <===> ================================================================================ -<===> preserved/percent/input.scss -a {b: sign(3px - 1.5px + 5%)} +<===> error/syntax/invalid_arg/input.scss +a {b: sign($)} -<===> preserved/percent/output.css -a { - b: sign(1.5px + 5%); -} +<===> error/syntax/invalid_arg/error +Error: Expected identifier. + , +1 | a {b: sign($)} + | ^ + ' + input.scss 1:13 root stylesheet <===> ================================================================================ -<===> preserved/operation/variable/input.scss -a { - --test: 5; - b: sign(3px - 1px + var(--test)); -} +<===> error/mod/input.scss +a {b: sign(7 % 3)} -<===> preserved/operation/variable/output.css -a { - --test: 5; - b: sign(2px + var(--test)); -} +<===> error/mod/error +Error: expected "+", "-", "*", "/", or ")". + , +1 | a {b: sign(7 % 3)} + | ^ + ' + input.scss 1:14 root stylesheet diff --git a/spec/values/calculation/sin.hrx b/spec/values/calculation/sin.hrx index 7a45ae5d7..b41b17be1 100644 --- a/spec/values/calculation/sin.hrx +++ b/spec/values/calculation/sin.hrx @@ -2,28 +2,6 @@ Most of the same behavior tested for `calc()` applies to `sin()`, but for terseness' sake isn't tested explicitly. -<===> -================================================================================ -<===> negative_infinity/input.scss -@use "sass:math"; -a {b: sin(math.div(-1, 0))} - -<===> negative_infinity/output.css -a { - b: calc(NaN); -} - -<===> -================================================================================ -<===> infinity/input.scss -@use "sass:math"; -a {b: sin(math.div(1, 0))} - -<===> infinity/output.css -a { - b: calc(NaN); -} - <===> ================================================================================ <===> deg/input.scss @@ -66,113 +44,56 @@ a { <===> ================================================================================ -<===> less_than_negative_one/input.scss -a {b: sin(-2)} - -<===> less_than_negative_one/output.css -a { - b: -0.9092974268; -} - -<===> -================================================================================ -<===> negative_decimal/input.scss -a {b: sin(-0.5)} - -<===> negative_decimal/output.css -a { - b: -0.4794255386; -} - -<===> -================================================================================ -<===> decimal/input.scss -a {b: sin(0.5)} - -<===> decimal/output.css -a { - b: 0.4794255386; -} - -<===> -================================================================================ -<===> unitless/input.scss -a {b: sin(1)} - -<===> unitless/output.css -a { - b: 0.8414709848; -} - -<===> -================================================================================ -<===> one_fuzzy/input.scss -a {b: sin(1.000000000001)} - -<===> one_fuzzy/output.css -a { - b: 0.8414709848; -} - -<===> -================================================================================ -<===> greater_than_one/input.scss -a {b: sin(2)} +<===> negative_infinity/input.scss +a {b: sin(-infinity)} -<===> greater_than_one/output.css +<===> negative_infinity/output.css a { - b: 0.9092974268; + b: calc(NaN); } <===> ================================================================================ -<===> preserved/percent/input.scss -a {b: sin(3px - 1.5px + 5%)} +<===> negative_one/input.scss +a {b: sin(-1)} -<===> preserved/percent/output.css +<===> negative_one/output.css a { - b: sin(1.5px + 5%); + b: -0.8414709848; } <===> ================================================================================ -<===> preserved/operation/variable/input.scss -a { - --test: 5; - b: sin(3px - 1px + var(--test)); -} +<===> zero/input.scss +a {b: sin(0)} -<===> preserved/operation/variable/output.css +<===> zero/output.css a { - --test: 5; - b: sin(2px + var(--test)); + b: 0; } <===> ================================================================================ -<===> preserved/variable/input.scss -a { - --test: 5; - b: sin(var(--test)); -} +<===> infinity/input.scss +a {b: sin(infinity)} -<===> preserved/variable/output.css +<===> infinity/output.css a { - --test: 5; - b: sin(var(--test)); + b: calc(NaN); } <===> ================================================================================ -<===> preserved/unquoted_string/input.scss -a { - b: sin(test); -} +<===> error/percentage/input.scss +a {b: sin(1%)} -<===> preserved/unquoted_string/output.css -a { - b: sin(test); -} +<===> error/percentage/error +Error: $number: Expected 1% to have an angle unit (deg, grad, rad, turn). + , +1 | a {b: sin(1%)} + | ^^^^^^^ + ' + input.scss 1:7 root stylesheet <===> ================================================================================ @@ -202,10 +123,10 @@ Error: Expected number, variable, function, or calculation. <===> ================================================================================ -<===> error/zero_args/input.scss +<===> error/too_few_args/input.scss a {b: sin()} -<===> error/zero_args/error +<===> error/too_few_args/error Error: Expected number, variable, function, or calculation. , 1 | a {b: sin()} @@ -241,13 +162,25 @@ Error: Expected identifier. <===> ================================================================================ -<===> percent/input.scss -a {b: sin(1%)} +<===> error/mod/input.scss +a {b: sin(7 % 3)} -<===> percent/error -Error: $number: Expected 1% to have an angle unit (deg, grad, rad, turn). +<===> error/mod/error +Error: expected "+", "-", "*", "/", or ")". , -1 | a {b: sin(1%)} - | ^^^^^^^ +1 | a {b: sin(7 % 3)} + | ^ ' - input.scss 1:7 root stylesheet + input.scss 1:13 root stylesheet + +<===> +================================================================================ +<===> preserved/operation/variable/input.scss +a { + b: sin(3px - 1px + var(--c)); +} + +<===> preserved/operation/variable/output.css +a { + b: sin(2px + var(--c)); +} diff --git a/spec/values/calculation/sqrt.hrx b/spec/values/calculation/sqrt.hrx index 2b05ea81a..86d4f7b86 100644 --- a/spec/values/calculation/sqrt.hrx +++ b/spec/values/calculation/sqrt.hrx @@ -4,129 +4,68 @@ terseness' sake isn't tested explicitly. <===> ================================================================================ -<===> operation/unitless/result_is_integer/input.scss -a {b: sqrt(16)} - -<===> operation/unitless/result_is_integer/output.css -a { - b: 4; -} +<===> zero/input.scss +a {b: sqrt(0)} -<===> -================================================================================ -<===> operation/unitless/result_is_float/input.scss -a {b: sqrt(2)} - -<===> operation/unitless/result_is_float/output.css +<===> zero/output.css a { - b: 1.4142135624; + b: 0; } <===> ================================================================================ -<===> operation/unitless/negative/input.scss -a {b: sqrt(-9)} - -<===> operation/unitless/negative/output.css -a { - b: calc(NaN); -} - -<===> -================================================================================ -<===> operation/math/plus/input.scss -a {b: sqrt(10 + 6)} +<===> result_is_integer/input.scss +a {b: sqrt(16)} -<===> operation/math/plus/output.css +<===> result_is_integer/output.css a { b: 4; } <===> ================================================================================ -<===> operation/nested_function/input.scss -a {b: sqrt(max(2, 9))} - -<===> operation/nested_function/output.css -a { - b: 3; -} - -<===> -================================================================================ -<===> operation/percent/input.scss -a {b: sqrt(3px - 1.5px + 5%)} - -<===> operation/percent/output.css -a { - b: sqrt(1.5px + 5%); -} - -<===> -================================================================================ -<===> preserved/operation/variable/input.scss -a { - --test: 5; - b: sqrt(3px - 1px + var(--test)); -} +<===> result_is_float/input.scss +a {b: sqrt(2)} -<===> preserved/operation/variable/output.css +<===> result_is_float/output.css a { - --test: 5; - b: sqrt(2px + var(--test)); + b: 1.4142135624; } <===> ================================================================================ -<===> preserved/variable/input.scss -a { - --test: 5; - b: sqrt(var(--test)); -} +<===> negative/input.scss +a {b: sqrt(-9)} -<===> preserved/variable/output.css +<===> negative/output.css a { - --test: 5; - b: sqrt(var(--test)); + b: calc(NaN); } <===> ================================================================================ -<===> preserved/unquoted_string/input.scss +<===> operation/simplification/input.scss a { - b: sqrt(test); + b: sqrt(1px + 2px - var(--c)) } -<===> preserved/unquoted_string/output.css +<===> operation/simplification/output.css a { - b: sqrt(test); + b: sqrt(3px - var(--c)); } -<===> -================================================================================ -<===> error/variables/input.scss -a {b: sqrt($base: 1, $exponent: -1)} - -<===> error/variables/error -Error: expected "+", "-", "*", "/", or ")". - , -1 | a {b: sqrt($base: 1, $exponent: -1)} - | ^ - ' - input.scss 1:17 root stylesheet - <===> ================================================================================ <===> error/percentage/input.scss -a {b: calc(sqrt(5%))} +a {b: sqrt(1%)} <===> error/percentage/error -Error: Expected 5% to have no units. +Error: Expected 1% to have no units. , -1 | a {b: calc(sqrt(5%))} - | ^^^^^^^^ +1 | a {b: sqrt(1%)} + | ^^^^^^^^ ' - input.scss 1:12 root stylesheet + input.scss 1:7 root stylesheet <===> ================================================================================ @@ -143,49 +82,49 @@ Error: Expected 16px to have no units. <===> ================================================================================ -<===> error/nested_function/units/input.scss -a {b: calc(sqrt(min(16, 9px)))} +<===> error/type/input.scss +a {b: sqrt("0")} -<===> error/nested_function/units/error -Error: Expected 9px to have no units. +<===> error/type/error +Error: Expected number, variable, function, or calculation. , -1 | a {b: calc(sqrt(min(16, 9px)))} - | ^^^^^^^^^^^^^^^^^^ +1 | a {b: sqrt("0")} + | ^ ' input.scss 1:12 root stylesheet <===> ================================================================================ -<===> error/operation/incompatible_units/input.scss -a {b: sqrt(1 + 16px)} +<===> error/syntax/too_few_args/input.scss +a {b: sqrt()} -<===> error/operation/incompatible_units/error -Error: 1 and 16px are incompatible. +<===> error/syntax/too_few_args/error +Error: Expected number, variable, function, or calculation. , -1 | a {b: sqrt(1 + 16px)} - | ^^^^^^^^ +1 | a {b: sqrt()} + | ^ ' input.scss 1:12 root stylesheet <===> ================================================================================ -<===> error/syntax/no_arg/input.scss -a {b: sqrt()} +<===> error/syntax/invalid_arg/input.scss +a {b: sqrt($)} -<===> error/syntax/no_arg/error -Error: Expected number, variable, function, or calculation. +<===> error/syntax/invalid_arg/error +Error: Expected identifier. , -1 | a {b: sqrt()} - | ^ +1 | a {b: sqrt($)} + | ^ ' - input.scss 1:12 root stylesheet + input.scss 1:13 root stylesheet <===> ================================================================================ -<===> error/syntax/many_args/input.scss +<===> error/too_many_args/input.scss a {b: sqrt(3, 4)} -<===> error/syntax/many_args/error +<===> error/too_many_args/error Error: expected "+", "-", "*", "/", or ")". , 1 | a {b: sqrt(3, 4)} @@ -195,14 +134,13 @@ Error: expected "+", "-", "*", "/", or ")". <===> ================================================================================ -<===> error/syntax/invalid_arg/input.scss -a {b: sqrt($)} +<===> error/mod/input.scss +a {b: sqrt(7 % 3)} -<===> error/syntax/invalid_arg/error -Error: Expected identifier. +<===> error/mod/error +Error: expected "+", "-", "*", "/", or ")". , -1 | a {b: sqrt($)} - | ^ +1 | a {b: sqrt(7 % 3)} + | ^ ' - input.scss 1:13 root stylesheet - + input.scss 1:14 root stylesheet diff --git a/spec/values/calculation/tan.hrx b/spec/values/calculation/tan.hrx index 305f948c5..6ed046ea7 100644 --- a/spec/values/calculation/tan.hrx +++ b/spec/values/calculation/tan.hrx @@ -2,28 +2,6 @@ Most of the same behavior tested for `calc()` applies to `tan()`, but for terseness' sake isn't tested explicitly. -<===> -================================================================================ -<===> negative_infinity/input.scss -@use "sass:math"; -a {b: tan(math.div(-1, 0))} - -<===> negative_infinity/output.css -a { - b: calc(NaN); -} - -<===> -================================================================================ -<===> infinity/input.scss -@use "sass:math"; -a {b: tan(math.div(1, 0))} - -<===> infinity/output.css -a { - b: calc(NaN); -} - <===> ================================================================================ <===> deg/input.scss @@ -66,113 +44,68 @@ a { <===> ================================================================================ -<===> less_than_negative_one/input.scss -a {b: tan(-2)} - -<===> less_than_negative_one/output.css -a { - b: 2.1850398633; -} - -<===> -================================================================================ -<===> negative_decimal/input.scss -a {b: tan(-0.5)} - -<===> negative_decimal/output.css -a { - b: -0.5463024898; -} - -<===> -================================================================================ -<===> decimal/input.scss -a {b: tan(0.5)} - -<===> decimal/output.css -a { - b: 0.5463024898; -} - -<===> -================================================================================ -<===> unitless/input.scss -a {b: tan(1)} +<===> negative_infinity/input.scss +a {b: tan(-infinity)} -<===> unitless/output.css +<===> negative_infinity/output.css a { - b: 1.5574077247; + b: calc(NaN); } <===> ================================================================================ -<===> one_fuzzy/input.scss -a {b: tan(1.000000000001)} +<===> negative_one/input.scss +a {b: tan(-1)} -<===> one_fuzzy/output.css +<===> negative_one/output.css a { - b: 1.5574077247; + b: -1.5574077247; } <===> ================================================================================ -<===> greater_than_one/input.scss -a {b: tan(2)} +<===> zero/input.scss +a {b: tan(0)} -<===> greater_than_one/output.css +<===> zero/output.css a { - b: -2.1850398633; + b: 0; } <===> ================================================================================ -<===> preserved/percent/input.scss -a {b: tan(3px - 1.5px + 5%)} +<===> infinity/input.scss +a {b: tan(infinity)} -<===> preserved/percent/output.css +<===> infinity/output.css a { - b: tan(1.5px + 5%); + b: calc(NaN); } <===> ================================================================================ <===> preserved/operation/variable/input.scss a { - --test: 5; - b: tan(3px - 1px + var(--test)); + b: tan(3px - 1px + var(--c)); } <===> preserved/operation/variable/output.css a { - --test: 5; - b: tan(2px + var(--test)); + b: tan(2px + var(--c)); } <===> ================================================================================ -<===> preserved/variable/input.scss -a { - --test: 5; - b: tan(var(--test)); -} - -<===> preserved/variable/output.css -a { - --test: 5; - b: tan(var(--test)); -} +<===> error/percentage/input.scss +a {b: cos(1%)} -<===> -================================================================================ -<===> preserved/unquoted_string/input.scss -a { - b: tan(test); -} - -<===> preserved/unquoted_string/output.css -a { - b: tan(test); -} +<===> error/percentage/error +Error: $number: Expected 1% to have an angle unit (deg, grad, rad, turn). + , +1 | a {b: cos(1%)} + | ^^^^^^^ + ' + input.scss 1:7 root stylesheet <===> ================================================================================ @@ -202,10 +135,10 @@ Error: Expected number, variable, function, or calculation. <===> ================================================================================ -<===> error/zero_args/input.scss +<===> error/too_few_args/input.scss a {b: tan()} -<===> error/zero_args/error +<===> error/too_few_args/error Error: Expected number, variable, function, or calculation. , 1 | a {b: tan()} @@ -229,25 +162,25 @@ Error: expected "+", "-", "*", "/", or ")". <===> ================================================================================ <===> error/syntax/invalid_arg/input.scss -a {b: tan($)} +a {b: sin($)} <===> error/syntax/invalid_arg/error Error: Expected identifier. , -1 | a {b: tan($)} +1 | a {b: sin($)} | ^ ' input.scss 1:12 root stylesheet <===> ================================================================================ -<===> percent/input.scss -a {b: tan(1%)} +<===> error/mod/input.scss +a {b: tan(7 % 3)} -<===> percent/error -Error: $number: Expected 1% to have an angle unit (deg, grad, rad, turn). +<===> error/mod/error +Error: expected "+", "-", "*", "/", or ")". , -1 | a {b: tan(1%)} - | ^^^^^^^ +1 | a {b: tan(7 % 3)} + | ^ ' - input.scss 1:7 root stylesheet + input.scss 1:13 root stylesheet