Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-enable calc function specs #1934

Merged
merged 5 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 43 additions & 27 deletions spec/core_functions/math/abs.hrx
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<===> options.yml
---
:ignore_for:
- libsass

<===>
================================================================================
<===> zero/input.scss
a {b: abs(0)}
@use "sass:math";
a {b: math.abs(0)}

<===> zero/output.css
a {
Expand All @@ -9,7 +17,8 @@ a {
<===>
================================================================================
<===> positive/integer/input.scss
a {b: abs(1)}
@use "sass:math";
a {b: math.abs(1)}

<===> positive/integer/output.css
a {
Expand All @@ -19,7 +28,8 @@ a {
<===>
================================================================================
<===> positive/decimal/input.scss
a {b: abs(5.6)}
@use "sass:math";
a {b: math.abs(5.6)}

<===> positive/decimal/output.css
a {
Expand All @@ -29,7 +39,8 @@ a {
<===>
================================================================================
<===> negative/integer/input.scss
a {b: abs(-17)}
@use "sass:math";
a {b: math.abs(-17)}

<===> negative/integer/output.css
a {
Expand All @@ -39,7 +50,8 @@ a {
<===>
================================================================================
<===> negative/decimal/input.scss
a {b: abs(-123.456)}
@use "sass:math";
a {b: math.abs(-123.456)}

<===> negative/decimal/output.css
a {
Expand All @@ -53,7 +65,8 @@ a {
- sass/libsass#2887

<===> preserves_units/input.scss
a {b: abs(-7px / 4em) * 1em}
@use "sass:math";
a {b: math.abs(-7px / 4em) * 1em}

<===> preserves_units/output.css
a {
Expand All @@ -68,15 +81,16 @@ Recommendation: math.div(-7px, 4em)
More info and automated migrator: https://sass-lang.com/d/slash-div

,
1 | a {b: abs(-7px / 4em) * 1em}
| ^^^^^^^^^^
2 | a {b: math.abs(-7px / 4em) * 1em}
| ^^^^^^^^^^
'
input.scss 1:11 root stylesheet
input.scss 2:16 root stylesheet

<===>
================================================================================
<===> named/input.scss
a {b: abs($number: -3)}
@use "sass:math";
a { b: math.abs($number: 3)}

<===> named/output.css
a {
Expand All @@ -86,69 +100,71 @@ a {
<===>
================================================================================
<===> error/type/input.scss
a {b: abs(c)}
@use "sass:math";
a {b: math.abs(c)}

<===> error/type/error
Error: $number: c is not a number.
,
1 | a {b: abs(c)}
| ^^^^^^
2 | a {b: math.abs(c)}
| ^^^^^^^^^^^
'
input.scss 1:7 root stylesheet
input.scss 2:7 root stylesheet

<===> error/type/error-libsass
Error: argument `$number` of `abs($number)` must be a number
Error: argument `$number` of `math.abs($number)` must be a number
on line 1:7 of input.scss, in function `round`
from line 1:7 of input.scss
>> a {b: abs(c)}
>> a {b: math.abs(c)}

------^

<===>
================================================================================
<===> error/too_few_args/input.scss
a {b: abs()}
@use "sass:math";
a {b: math.abs()}

<===> error/too_few_args/error
Error: Missing argument $number.
,--> input.scss
1 | a {b: abs()}
| ^^^^^ invocation
2 | a {b: math.abs()}
| ^^^^^^^^^^ invocation
'
,--> sass:math
1 | @function abs($number) {
| ============ declaration
'
input.scss 1:7 root stylesheet
input.scss 2:7 root stylesheet

<===> error/too_few_args/error-libsass
Error: Function abs is missing argument $number.
on line 1 of input.scss
>> a {b: abs()}
>> a {b: math.abs()}

------^

<===>
================================================================================
<===> error/too_many_args/input.scss
a {b: abs(1, 2)}

@use "sass:math";
a {b: math.abs(1, 2)}

<===> error/too_many_args/error
Error: Only 1 argument allowed, but 2 were passed.
,--> input.scss
1 | a {b: abs(1, 2)}
| ^^^^^^^^^ invocation
2 | a {b: math.abs(1, 2)}
| ^^^^^^^^^^^^^^ invocation
'
,--> sass:math
1 | @function abs($number) {
| ============ declaration
'
input.scss 1:7 root stylesheet
input.scss 2:7 root stylesheet

<===> error/too_many_args/error-libsass
Error: wrong number of arguments (2 for 1) for `abs'
on line 1:7 of input.scss
>> a {b: abs(1, 2)}
>> a {b: math.abs(1, 2)}

------^
73 changes: 47 additions & 26 deletions spec/core_functions/math/round.hrx
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<===> options.yml
---
:ignore_for:
- libsass

<===>
================================================================================
<===> integer/input.scss
a {b: round(1)}
@use "sass:math";
a {b: math.round(1)}

<===> integer/output.css
a {
Expand All @@ -9,7 +17,8 @@ a {
<===>
================================================================================
<===> up/high/input.scss
a {b: round(2.9)}
@use "sass:math";
a {b: math.round(2.9)}

<===> up/high/output.css
a {
Expand All @@ -19,7 +28,8 @@ a {
<===>
================================================================================
<===> up/point_five/input.scss
a {b: round(16.5)}
@use "sass:math";
a {b: math.round(16.5)}

<===> up/point_five/output.css
a {
Expand All @@ -29,7 +39,8 @@ a {
<===>
================================================================================
<===> up/negative/input.scss
a {b: round(-5.4)}
@use "sass:math";
a {b: math.round(-5.4)}

<===> up/negative/output.css
a {
Expand All @@ -39,7 +50,8 @@ a {
<===>
================================================================================
<===> up/to_zero/input.scss
a {b: round(-0.2)}
@use "sass:math";
a {b: math.round(-0.2)}

<===> up/to_zero/output.css
a {
Expand All @@ -49,7 +61,8 @@ a {
<===>
================================================================================
<===> down/low/input.scss
a {b: round(2.2)}
@use "sass:math";
a {b: math.round(2.2)}

<===> down/low/output.css
a {
Expand All @@ -59,7 +72,8 @@ a {
<===>
================================================================================
<===> down/negative/input.scss
a {b: round(-5.6)}
@use "sass:math";
a {b: math.round(-5.6)}

<===> down/negative/output.css
a {
Expand All @@ -69,7 +83,8 @@ a {
<===>
================================================================================
<===> down/to_zero/input.scss
a {b: round(0.2)}
@use "sass:math";
a {b: math.round(0.2)}

<===> down/to_zero/output.css
a {
Expand All @@ -85,7 +100,8 @@ a {
<===> down/within_precision/input.scss
// This is the largest number that's representable as a float and outside the
// precision range to be considered equal to 1.5.
a {b: round(1.4999999999949998)}
@use "sass:math";
a {b: math.round(1.4999999999949998)}

<===> down/within_precision/output.css
a {
Expand All @@ -99,7 +115,8 @@ a {
- sass/libsass#2887

<===> preserves_units/input.scss
a {b: round(7px / 4em) * 1em}
@use "sass:math";
a {b: math.round(7px / 4em) * 1em}

<===> preserves_units/output.css
a {
Expand All @@ -114,15 +131,16 @@ Recommendation: math.div(7px, 4em)
More info and automated migrator: https://sass-lang.com/d/slash-div

,
1 | a {b: round(7px / 4em) * 1em}
| ^^^^^^^^^
2 | a {b: math.round(7px / 4em) * 1em}
| ^^^^^^^^^
'
input.scss 1:13 root stylesheet
input.scss 2:18 root stylesheet

<===>
================================================================================
<===> named/input.scss
a {b: round($number: 1.6)}
@use "sass:math";
a {b: math.round($number: 1.6)}

<===> named/output.css
a {
Expand All @@ -132,15 +150,16 @@ a {
<===>
================================================================================
<===> error/type/input.scss
a {b: round(c)}
@use "sass:math";
a {b: math.round(c)}

<===> error/type/error
Error: $number: c is not a number.
,
1 | a {b: round(c)}
| ^^^^^^^^
2 | a {b: math.round(c)}
| ^^^^^^^^^^^^^
'
input.scss 1:7 root stylesheet
input.scss 2:7 root stylesheet

<===> error/type/error-libsass
Error: argument `$number` of `round($number)` must be a number
Expand All @@ -153,19 +172,20 @@ Error: argument `$number` of `round($number)` must be a number
<===>
================================================================================
<===> error/too_few_args/input.scss
a {b: round()}
@use "sass:math";
a {b: math.round()}

<===> error/too_few_args/error
Error: Missing argument $number.
,--> input.scss
1 | a {b: round()}
| ^^^^^^^ invocation
2 | a {b: math.round()}
| ^^^^^^^^^^^^ invocation
'
,--> sass:math
1 | @function round($number) {
| ============== declaration
'
input.scss 1:7 root stylesheet
input.scss 2:7 root stylesheet

<===> error/too_few_args/error-libsass
Error: Function round is missing argument $number.
Expand All @@ -177,20 +197,21 @@ Error: Function round is missing argument $number.
<===>
================================================================================
<===> error/too_many_args/input.scss
a {b: round(1, 2)}
@use "sass:math";
a {b: math.round(1, 2)}


<===> error/too_many_args/error
Error: Only 1 argument allowed, but 2 were passed.
,--> input.scss
1 | a {b: round(1, 2)}
| ^^^^^^^^^^^ invocation
2 | a {b: math.round(1, 2)}
| ^^^^^^^^^^^^^^^^ invocation
'
,--> sass:math
1 | @function round($number) {
| ============== declaration
'
input.scss 1:7 root stylesheet
input.scss 2:7 root stylesheet

<===> error/too_many_args/error-libsass
Error: wrong number of arguments (2 for 1) for `round'
Expand Down
Loading