Skip to content

Commit

Permalink
Refactor specs for the for at-rule to be conformant
Browse files Browse the repository at this point in the history
  • Loading branch information
stof committed Jan 11, 2021
1 parent 71f17a8 commit 9cfb81b
Show file tree
Hide file tree
Showing 12 changed files with 181 additions and 196 deletions.
98 changes: 98 additions & 0 deletions spec/directives/for/basic.hrx
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<===> inclusive_forward/input.scss
a {
@for $i from 1 through 5 {b: $i;}
}

<===> inclusive_forward/output.css
a {
b: 1;
b: 2;
b: 3;
b: 4;
b: 5;
}

<===>
================================================================================
<===> inclusive_backward/input.scss
a {
@for $i from 5 through 1 {b: $i;}
}

<===> inclusive_backward/output.css
a {
b: 5;
b: 4;
b: 3;
b: 2;
b: 1;
}

<===>
================================================================================
<===> empty/input.scss
a {
@for $i from 1 to 1 {b: $i;}
}

<===> empty/output.css

<===>
================================================================================
<===> exclusive_forward/input.scss
a {
@for $i from 1 to 5 {b: $i;}
}

<===> exclusive_forward/output.css
a {
b: 1;
b: 2;
b: 3;
b: 4;
}

<===>
================================================================================
<===> exclusive_backward/input.scss
a {
@for $i from 5 to 1 {b: $i;}
}

<===> exclusive_backward/output.css
a {
b: 5;
b: 4;
b: 3;
b: 2;
}

<===>
================================================================================
<===> to_scope/input.scss
// Overriding the variable inside the loop will not impact the end of the loop.
$limit: 4;

@for $i from 1 through $limit {
$limit: 2;
a {
b: $limit c $i;
}
}

<===> to_scope/output.css
a {
b: 2 c 1;
}

a {
b: 2 c 2;
}

a {
b: 2 c 3;
}

a {
b: 2 c 4;
}
83 changes: 83 additions & 0 deletions spec/directives/for/error.hrx
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<===> from_type/input.scss
@for $i from "foo" through 4 {}
<===> from_type/error
Error: "foo" is not a number.
,
1 | @for $i from "foo" through 4 {}
| ^^^^^
'
input.scss 1:14 root stylesheet

<===> from_type/error-libsass
Error: "foo" is not an integer.
on line 1 of input.scss
Use --trace for backtrace.

<===>
================================================================================
<===> from_float/options.yml
---
:todo:
- libsass

<===> from_float/input.scss
@for $i from 1.5 through 4 {}
<===> from_float/error
Error: 1.5 is not an int.
,
1 | @for $i from 1.5 through 4 {}
| ^^^
'
input.scss 1:14 root stylesheet

<===>
================================================================================
<===> to_type/input.scss
@for $i from 1 through "foo" {}
<===> to_type/error
Error: "foo" is not a number.
,
1 | @for $i from 1 through "foo" {}
| ^^^^^
'
input.scss 1:24 root stylesheet

<===> to_type/error-libsass
Error: "foo" is not an integer.
on line 1 of input.scss
Use --trace for backtrace.

<===>
================================================================================
<===> to_float/options.yml
---
:todo:
- libsass

<===> to_float/input.scss
@for $i from 1 through 1.5 {}
<===> to_float/error
Error: 1.5 is not an int.
,
1 | @for $i from 1 through 1.5 {}
| ^^^
'
input.scss 1:24 root stylesheet

<===>
================================================================================
<===> incompatible_units/input.scss
@for $i from 100% through 42px {}
<===> incompatible_units/error
Error: Expected 100% to have a length unit (in, cm, pc, mm, q, pt, px).
,
1 | @for $i from 100% through 42px {}
| ^^^^
'
input.scss 1:14 root stylesheet

<===> incompatible_units/error-libsass
Error: Incompatible units: '%' and 'px'.
on line 1:14 of input.scss
>> @for $i from 100% through 42px {}
-------------^
19 changes: 0 additions & 19 deletions spec/non_conformant/errors/for-incompatible-units-fn.hrx

This file was deleted.

15 changes: 0 additions & 15 deletions spec/non_conformant/errors/for-incompatible-units.hrx

This file was deleted.

21 changes: 0 additions & 21 deletions spec/non_conformant/errors/loop-for/numeric/lower_eval.hrx

This file was deleted.

16 changes: 0 additions & 16 deletions spec/non_conformant/errors/loop-for/numeric/lower_expand.hrx

This file was deleted.

21 changes: 0 additions & 21 deletions spec/non_conformant/errors/loop-for/numeric/upper_eval.hrx

This file was deleted.

16 changes: 0 additions & 16 deletions spec/non_conformant/errors/loop-for/numeric/upper_expand.hrx

This file was deleted.

12 changes: 0 additions & 12 deletions spec/non_conformant/scss-tests/009_test_for_directive.hrx

This file was deleted.

13 changes: 0 additions & 13 deletions spec/non_conformant/scss-tests/010_test_for_directive.hrx

This file was deleted.

50 changes: 0 additions & 50 deletions spec/non_conformant/scss/for.hrx

This file was deleted.

13 changes: 0 additions & 13 deletions spec/non_conformant/scss/for_directive.hrx

This file was deleted.

0 comments on commit 9cfb81b

Please sign in to comment.