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

Revert "Calc functions tests (#1912)" #1931

Merged
merged 1 commit into from
Aug 17, 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: 27 additions & 43 deletions spec/core_functions/math/abs.hrx
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
<===> options.yml
---
:ignore_for:
- libsass

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

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

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

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

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

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

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

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

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

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

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

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

<===> error/type/error-libsass
Error: argument `$number` of `math.abs($number)` must be a number
Error: argument `$number` of `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: math.abs(c)}
>> a {b: abs(c)}

------^

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

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

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

------^

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


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

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

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

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

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

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

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

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

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

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

<===> down/to_zero/output.css
a {
Expand All @@ -100,8 +85,7 @@ 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.
@use "sass:math";
a {b: math.round(1.4999999999949998)}
a {b: round(1.4999999999949998)}

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

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

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

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

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

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

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

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

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

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


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

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