Skip to content

Commit

Permalink
Improve inspect() output for complex units
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed Dec 5, 2023
1 parent 7516e17 commit cb82b6a
Show file tree
Hide file tree
Showing 40 changed files with 58 additions and 58 deletions.
2 changes: 1 addition & 1 deletion spec/libsass-closed-issues/issue_1793.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
}

<===> error
Error: 10px*in isn't a valid CSS value.
Error: calc(10px * 1in) isn't a valid CSS value.
,
1 | @media (max-width: (2px*5in)) {
| ^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion spec/libsass-closed-issues/issue_1804/inline.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ foo {
}

<===> error
Error: 10px*in isn't a valid CSS value.
Error: calc(10px * 1in) isn't a valid CSS value.
,
2 | bar: #{(2px*5in)};
| ^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion spec/libsass-closed-issues/issue_1804/variable.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ foo {
}

<===> error
Error: 10px*in isn't a valid CSS value.
Error: calc(10px * 1in) isn't a valid CSS value.
,
5 | bar: #{($foo*$bar)};
| ^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion spec/non_conformant/errors/invalid-operation/sub.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ test {
err: 2px - 2px*2px;
}
<===> error
Error: 2px and 4px*px have incompatible units.
Error: 2px and calc(4px * 1px) have incompatible units.
,
2 | err: 2px - 2px*2px;
| ^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion spec/values/calculation/acos.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Error: Expected 1px to have no units.
a {b: acos(-7px / 4em)}

<===> error/unit/complex/error
Error: Expected -1.75px/em to have no units.
Error: Expected calc(-1.75px / 1em) to have no units.
,
1 | a {b: acos(-7px / 4em)}
| ^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion spec/values/calculation/asin.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Error: Expected 1px to have no units.
a {b: asin(-7px / 4em)}

<===> error/unit/complex/error
Error: Expected -1.75px/em to have no units.
Error: Expected calc(-1.75px / 1em) to have no units.
,
1 | a {b: asin(-7px / 4em)}
| ^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion spec/values/calculation/atan.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Error: Expected 1px to have no units.
a {b: atan(-7px / 4em)}

<===> error/unit/complex/error
Error: Expected -1.75px/em to have no units.
Error: Expected calc(-1.75px / 1em) to have no units.
,
1 | a {b: atan(-7px / 4em)}
| ^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion spec/values/calculation/atan2.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ Error: 1deg and 1px are incompatible.
a {b: atan2(1px*2px, 10%)}

<===> error/units/complex_and_unknown/error
Error: Number 2px*px isn't compatible with CSS calculations.
Error: Number calc(2px * 1px) isn't compatible with CSS calculations.
,
1 | a {b: atan2(1px*2px, 10%)}
| ^^^^^^^
Expand Down
12 changes: 6 additions & 6 deletions spec/values/calculation/calc/error/complex_units.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
a {b: calc(1% + 1px * 2px)}

<===> multiple_numerator/within_calc/error
Error: Number 2px*px isn't compatible with CSS calculations.
Error: Number calc(2px * 1px) isn't compatible with CSS calculations.
,
1 | a {b: calc(1% + 1px * 2px)}
| ^^^^^^^^^^^^^^
Expand All @@ -16,7 +16,7 @@ $a: 1px * 2px;
b {c: calc(1% + $a)}

<===> multiple_numerator/from_variable/error
Error: Number 2px*px isn't compatible with CSS calculations.
Error: Number calc(2px * 1px) isn't compatible with CSS calculations.
,
2 | b {c: calc(1% + $a)}
| ^^^^^^^
Expand All @@ -29,7 +29,7 @@ Error: Number 2px*px isn't compatible with CSS calculations.
a {b: calc(1% + 1 / 2px)}

<===> denominator/within_calc/error
Error: Number 0.5px^-1 isn't compatible with CSS calculations.
Error: Number calc(0.5 / 1px) isn't compatible with CSS calculations.
,
1 | a {b: calc(1% + 1 / 2px)}
| ^^^^^^^^^^^^
Expand All @@ -44,7 +44,7 @@ $a: math.div(1, 2px);
b {c: calc(1% + $a)}

<===> denominator/from_variable/error
Error: Number 0.5px^-1 isn't compatible with CSS calculations.
Error: Number calc(0.5 / 1px) isn't compatible with CSS calculations.
,
3 | b {c: calc(1% + $a)}
| ^^^^^^^
Expand All @@ -57,7 +57,7 @@ Error: Number 0.5px^-1 isn't compatible with CSS calculations.
a {b: calc(1% + 1s / 2px)}

<===> numerator_and_denominator/within_calc/error
Error: Number 0.5s/px isn't compatible with CSS calculations.
Error: Number calc(0.5s / 1px) isn't compatible with CSS calculations.
,
1 | a {b: calc(1% + 1s / 2px)}
| ^^^^^^^^^^^^^
Expand All @@ -72,7 +72,7 @@ $a: math.div(1s, 2px);
b {c: calc(1% + $a)}

<===> numerator_and_denominator/from_variable/error
Error: Number 0.5s/px isn't compatible with CSS calculations.
Error: Number calc(0.5s / 1px) isn't compatible with CSS calculations.
,
3 | b {c: calc(1% + $a)}
| ^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Error: 1 and 1px are incompatible.
a {b: calc(1 + 1/1px)}

<===> unitless/and_denominator/error
Error: Number 1px^-1 isn't compatible with CSS calculations.
Error: Number calc(1 / 1px) isn't compatible with CSS calculations.
,
1 | a {b: calc(1 + 1/1px)}
| ^^^^^^^^^
Expand All @@ -28,7 +28,7 @@ Error: Number 1px^-1 isn't compatible with CSS calculations.
a {b: calc(1px + 1/1px)}

<===> numerator_and_denominator/error
Error: Number 1px^-1 isn't compatible with CSS calculations.
Error: Number calc(1 / 1px) isn't compatible with CSS calculations.
,
1 | a {b: calc(1px + 1/1px)}
| ^^^^^^^^^^^
Expand All @@ -41,7 +41,7 @@ Error: Number 1px^-1 isn't compatible with CSS calculations.
a {b: calc(1px + 1px*1px)}

<===> numerator_and_numerators/error
Error: Number 1px*px isn't compatible with CSS calculations.
Error: Number calc(1px * 1px) isn't compatible with CSS calculations.
,
1 | a {b: calc(1px + 1px*1px)}
| ^^^^^^^^^^^^^
Expand All @@ -54,7 +54,7 @@ Error: Number 1px*px isn't compatible with CSS calculations.
a {b: calc(1/1px + 1/1px/1px)}

<===> denominator_and_denominators/error
Error: Number 1px^-1 isn't compatible with CSS calculations.
Error: Number calc(1 / 1px) isn't compatible with CSS calculations.
,
1 | a {b: calc(1/1px + 1/1px/1px)}
| ^^^^^^^^^^^^^^^^^
Expand All @@ -67,7 +67,7 @@ Error: Number 1px^-1 isn't compatible with CSS calculations.
a {b: calc(1px*1s + 1px*1px)}

<===> mismatched_numerators/error
Error: Number 1px*s isn't compatible with CSS calculations.
Error: Number calc(1px * 1s) isn't compatible with CSS calculations.
,
1 | a {b: calc(1px*1s + 1px*1px)}
| ^^^^^^^^^^^^^^^^
Expand All @@ -80,7 +80,7 @@ Error: Number 1px*s isn't compatible with CSS calculations.
a {b: calc(1/1px/1s + 1/1px/1px)}

<===> mismatched_denominators/error
Error: Number 1(px*s)^-1 isn't compatible with CSS calculations.
Error: Number calc(1 / 1px / 1s) isn't compatible with CSS calculations.
,
1 | a {b: calc(1/1px/1s + 1/1px/1px)}
| ^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion spec/values/calculation/clamp.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Error: 1px and 3s are incompatible.
a {b: clamp(1px*1px, 2%*2%, 3px*3px)}

<===> error/complex_unit/error
Error: Number 1px*px isn't compatible with CSS calculations.
Error: Number calc(1px * 1px) isn't compatible with CSS calculations.
,
1 | a {b: clamp(1px*1px, 2%*2%, 3px*3px)}
| ^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion spec/values/calculation/cos.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ Error: $number: Expected 1px to have an angle unit (deg, grad, rad, turn).
a {b: cos(-7px / 4em)}

<===> error/unit/complex/error
Error: $number: Expected -1.75px/em to have an angle unit (deg, grad, rad, turn).
Error: $number: Expected calc(-1.75px / 1em) to have an angle unit (deg, grad, rad, turn).
,
1 | a {b: cos(-7px / 4em)}
| ^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion spec/values/calculation/hypot.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ a {
a {b: hypot(-7px / 4em)}

<===> error/unsimplifiable/error
Error: Number -1.75px/em isn't compatible with CSS calculations.
Error: Number calc(-1.75px / 1em) isn't compatible with CSS calculations.
,
1 | a {b: hypot(-7px / 4em)}
| ^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion spec/values/calculation/log.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ Error: Expected 1deg to have no units.
a {b: log(1px*2px, 10%)}

<===> error/units/complex_and_unknown/error
Error: Expected 2px*px to have no units.
Error: Expected calc(2px * 1px) to have no units.
,
1 | a {b: log(1px*2px, 10%)}
| ^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion spec/values/calculation/max.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Error: 1px and 2 are incompatible.
a {b: max(1px*1px, 2%*2%)}

<===> error/complex_unit/error
Error: Number 1px*px isn't compatible with CSS calculations.
Error: Number calc(1px * 1px) isn't compatible with CSS calculations.
,
1 | a {b: max(1px*1px, 2%*2%)}
| ^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion spec/values/calculation/min.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Error: 1px and 2 are incompatible.
a {b: min(1px*1px, 2%*2%)}

<===> error/complex_unit/error
Error: Number 1px*px isn't compatible with CSS calculations.
Error: Number calc(1px * 1px) isn't compatible with CSS calculations.
,
1 | a {b: min(1px*1px, 2%*2%)}
| ^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion spec/values/calculation/mod.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ Error: 16px and 5deg are incompatible.
a {b: mod(1px*2px, 10%)}

<===> error/units/complex_and_unknown/error
Error: Number 2px*px isn't compatible with CSS calculations.
Error: Number calc(2px * 1px) isn't compatible with CSS calculations.
,
1 | a {b: mod(1px*2px, 10%)}
| ^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion spec/values/calculation/rem.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ Error: 16px and 5deg are incompatible.
a {b: rem(1px*2px, 10%)}

<===> error/units/complex_and_unknown/error
Error: Number 2px*px isn't compatible with CSS calculations.
Error: Number calc(2px * 1px) isn't compatible with CSS calculations.
,
1 | a {b: rem(1px*2px, 10%)}
| ^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion spec/values/calculation/round/error.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Error: 10deg and 5px are incompatible.
a {b: round(1px*2px, 10%)}

<===> two_argument/units/complex_and_unknown/error
Error: Number 2px*px isn't compatible with CSS calculations.
Error: Number calc(2px * 1px) isn't compatible with CSS calculations.
,
1 | a {b: round(1px*2px, 10%)}
| ^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion spec/values/calculation/sin.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ Error: $number: Expected 1px to have an angle unit (deg, grad, rad, turn).
a {b: sin(-7px / 4em)}

<===> error/units/complex/error
Error: $number: Expected -1.75px/em to have an angle unit (deg, grad, rad, turn).
Error: $number: Expected calc(-1.75px / 1em) to have an angle unit (deg, grad, rad, turn).
,
1 | a {b: sin(-7px / 4em)}
| ^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion spec/values/calculation/tan.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ Error: $number: Expected 1px to have an angle unit (deg, grad, rad, turn).
a {b: tan(-7px / 4em)}

<===> error/units/complex/error
Error: $number: Expected -1.75px/em to have an angle unit (deg, grad, rad, turn).
Error: $number: Expected calc(-1.75px / 1em) to have an angle unit (deg, grad, rad, turn).
,
1 | a {b: tan(-7px / 4em)}
| ^^^^^^^^^^^^^^^
Expand Down
18 changes: 9 additions & 9 deletions spec/values/numbers/degenerate.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ a {
a {b: math.div(1px * 1em, 0)}

<===> error/infinity/multiple_numerator_units/error
Error: calc(Infinitypx*em) isn't a valid CSS value.
Error: calc(infinity * 1px * 1em) isn't a valid CSS value.
,
2 | a {b: math.div(1px * 1em, 0)}
| ^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -83,7 +83,7 @@ Error: calc(Infinitypx*em) isn't a valid CSS value.
a {b: math.div(1, 0px)}

<===> error/infinity/denominator_unit/error
Error: calc(Infinitypx^-1) isn't a valid CSS value.
Error: calc(infinity / 1px) isn't a valid CSS value.
,
2 | a {b: math.div(1, 0px)}
| ^^^^^^^^^^^^^^^^
Expand All @@ -97,7 +97,7 @@ Error: calc(Infinitypx^-1) isn't a valid CSS value.
a {b: math.div(1px, 0em)}

<===> error/infinity/numerator_and_denominator_unit/error
Error: calc(Infinitypx/em) isn't a valid CSS value.
Error: calc(infinity * 1px / 1em) isn't a valid CSS value.
,
2 | a {b: math.div(1px, 0em)}
| ^^^^^^^^^^^^^^^^^^
Expand All @@ -111,7 +111,7 @@ Error: calc(Infinitypx/em) isn't a valid CSS value.
a {b: math.div(-1px * 1em, 0)}

<===> error/minus_infinity/multiple_numerator_units/error
Error: calc(-Infinitypx*em) isn't a valid CSS value.
Error: calc(-infinity * 1px * 1em) isn't a valid CSS value.
,
2 | a {b: math.div(-1px * 1em, 0)}
| ^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -125,7 +125,7 @@ Error: calc(-Infinitypx*em) isn't a valid CSS value.
a {b: math.div(-1, 0px)}

<===> error/minus_infinity/denominator_unit/error
Error: calc(-Infinitypx^-1) isn't a valid CSS value.
Error: calc(-infinity / 1px) isn't a valid CSS value.
,
2 | a {b: math.div(-1, 0px)}
| ^^^^^^^^^^^^^^^^^
Expand All @@ -139,7 +139,7 @@ Error: calc(-Infinitypx^-1) isn't a valid CSS value.
a {b: math.div(-1px, 0em)}

<===> error/minus_infinity/numerator_and_denominator_unit/error
Error: calc(-Infinitypx/em) isn't a valid CSS value.
Error: calc(-infinity * 1px / 1em) isn't a valid CSS value.
,
2 | a {b: math.div(-1px, 0em)}
| ^^^^^^^^^^^^^^^^^^^
Expand All @@ -153,7 +153,7 @@ Error: calc(-Infinitypx/em) isn't a valid CSS value.
a {b: math.div(0px * 0em, 0)}

<===> error/nan/multiple_numerator_units/error
Error: calc(NaNpx*em) isn't a valid CSS value.
Error: calc(NaN * 1px * 1em) isn't a valid CSS value.
,
2 | a {b: math.div(0px * 0em, 0)}
| ^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -167,7 +167,7 @@ Error: calc(NaNpx*em) isn't a valid CSS value.
a {b: math.div(0, 0px)}

<===> error/nan/denominator_unit/error
Error: calc(NaNpx^-1) isn't a valid CSS value.
Error: calc(NaN / 1px) isn't a valid CSS value.
,
2 | a {b: math.div(0, 0px)}
| ^^^^^^^^^^^^^^^^
Expand All @@ -181,7 +181,7 @@ Error: calc(NaNpx^-1) isn't a valid CSS value.
a {b: math.div(0px, 0em)}

<===> error/nan/numerator_and_denominator_unit/error
Error: calc(NaNpx/em) isn't a valid CSS value.
Error: calc(NaN * 1px / 1em) isn't a valid CSS value.
,
2 | a {b: math.div(0px, 0em)}
| ^^^^^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ a {

<===> output.css
a {
b: 1px*rad;
b: calc(1px * 1rad);
}

<===> warning
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ a {

<===> output.css
a {
b: 1(px*rad)^-1;
b: calc(1 / 1px / 1rad);
}

<===> warning
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ a {

<===> output.css
a {
b: 1rad/Hz;
b: calc(1rad / 1Hz);
}

<===> warning
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ a {

<===> output.css
a {
b: 0.0104166667rad/ms*Hz;
b: calc(0.0104166667rad / 1ms / 1Hz);
}

<===> warning
Expand Down
Loading

0 comments on commit cb82b6a

Please sign in to comment.