Skip to content

Commit

Permalink
Add specs for core functions interacting with modules
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed Feb 21, 2019
1 parent e0df66b commit 32fe000
Show file tree
Hide file tree
Showing 5 changed files with 250 additions and 0 deletions.
50 changes: 50 additions & 0 deletions spec/core_functions/function_exists.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,27 @@ a {
b: true;
}

<===>
================================================================================
<===> through_use/options.yml
---
:todo:
- libsass # sass/libsass#2807
:ignore_for:
- ruby-sass

<===> through_use/input.scss
@use "other" as *;
a {b: function-exists(global-function)}

<===> through_use/other.scss
@function global-function() {@return null}

<===> through_use/output.css
a {
b: true;
}

<===>
================================================================================
<===> non_existent/input.scss
Expand Down Expand Up @@ -149,3 +170,32 @@ Error: wrong number of arguments (2 for 1) for `function-exists'
>> a {b: function-exists(foo, bar)}

------^

<===>
================================================================================
<===> conflict/options.yml
---
:todo:
- libsass # sass/libsass#2807
:ignore_for:
- ruby-sass

<===> conflict/input.scss
@use "other1" as *;
@use "other2" as *;

a {b: function-exists(member)}

<===> conflict/other1.scss
@function member() {@return from other1}

<===> conflict/other2.scss
@function member() {@return from other2}

<===> conflict/error
Error: Multiple global modules have a function named "member".
,
4 | a {b: function-exists(member)}
| ^^^^^^^^^^^^^^^^^^^^^^^
'
/sass/spec/core_functions/function_exists/conflict/input.scss 4:7 root stylesheet
50 changes: 50 additions & 0 deletions spec/core_functions/get_function.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,27 @@ a {
b: 12;
}

<===>
================================================================================
<===> through_use/options.yml
---
:todo:
- libsass # sass/libsass#2807
:ignore_for:
- ruby-sass

<===> through_use/input.scss
@use "other" as *;
a {b: call(get-function(add-two), 10)}

<===> through_use/other.scss
@function add-two($v) {@return $v + 2}

<===> through_use/output.css
a {
b: 12;
}

<===>
================================================================================
<===> plain_css/input.scss
Expand Down Expand Up @@ -359,3 +380,32 @@ Error: $name: get-function("add-two") is not a string.
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
/sass/spec/core_functions/get_function/error/function_exists/input.scss 8:10 root stylesheet

<===>
================================================================================
<===> conflict/options.yml
---
:todo:
- libsass # sass/libsass#2807
:ignore_for:
- ruby-sass

<===> conflict/input.scss
@use "other1" as *;
@use "other2" as *;

a {b: get-function(member)}

<===> conflict/other1.scss
@function member() {@return from other1}

<===> conflict/other2.scss
@function member() {@return from other2}

<===> conflict/error
Error: Multiple global modules have a function named "member".
,
4 | a {b: get-function(member)}
| ^^^^^^^^^^^^^^^^^^^^
'
/sass/spec/core_functions/get_function/conflict/input.scss 4:7 root stylesheet
50 changes: 50 additions & 0 deletions spec/core_functions/global_variable_exists.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,27 @@ a {
b: true;
}

<===>
================================================================================
<===> through_use/options.yml
---
:todo:
- libsass # sass/libsass#2807
:ignore_for:
- ruby-sass

<===> through_use/input.scss
@use "other" as *;
a {b: global-variable-exists(global-variable)}

<===> through_use/other.scss
$global-variable: null;

<===> through_use/output.css
a {
b: true;
}

<===>
================================================================================
<===> dash_insensitive/input.scss
Expand Down Expand Up @@ -144,3 +165,32 @@ Error: wrong number of arguments (2 for 1) for `global-variable-exists'
>> a {b: global-variable-exists(foo, bar)}

------^

<===>
================================================================================
<===> conflict/options.yml
---
:todo:
- libsass # sass/libsass#2807
:ignore_for:
- ruby-sass

<===> conflict/input.scss
@use "other1" as *;
@use "other2" as *;

a {b: global-variable-exists(member)}

<===> conflict/other1.scss
$member: from other1;

<===> conflict/other2.scss
$member: from other2;

<===> conflict/error
Error: Multiple global modules have a variable named "$member".
,
4 | a {b: global-variable-exists(member)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
/sass/spec/core_functions/global_variable_exists/conflict/input.scss 4:7 root stylesheet
50 changes: 50 additions & 0 deletions spec/core_functions/mixin_exists.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ a {

<===>
================================================================================
<===> through_import/options.yml
---
:todo:
- libsass # sass/libsass#2807
:ignore_for:
- ruby-sass

<===> through_import/input.scss
@import "other";
a {b: mixin-exists(global-mixin)}
Expand All @@ -53,6 +60,20 @@ a {
b: true;
}

<===>
================================================================================
<===> through_use/input.scss
@use "other" as *;
a {b: mixin-exists(global-mixin)}

<===> through_use/other.scss
@mixin global-mixin() {}

<===> through_use/output.css
a {
b: true;
}

<===>
================================================================================
<===> non_existent/input.scss
Expand Down Expand Up @@ -150,3 +171,32 @@ Error: wrong number of arguments (2 for 1) for `mixin-exists'
>> a {b: mixin-exists(foo, bar)}

------^

<===>
================================================================================
<===> conflict/options.yml
---
:todo:
- libsass # sass/libsass#2807
:ignore_for:
- ruby-sass

<===> conflict/input.scss
@use "other1" as *;
@use "other2" as *;

a {b: mixin-exists(member)}

<===> conflict/other1.scss
@mixin member() {}

<===> conflict/other2.scss
@mixin member() {}

<===> conflict/error
Error: Multiple global modules have a mixin named "member".
,
4 | a {b: mixin-exists(member)}
| ^^^^^^^^^^^^^^^^^^^^
'
/sass/spec/core_functions/mixin_exists/conflict/input.scss 4:7 root stylesheet
50 changes: 50 additions & 0 deletions spec/core_functions/variable_exists.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,27 @@ a {
b: true;
}

<===>
================================================================================
<===> through_use/options.yml
---
:todo:
- libsass # sass/libsass#2807
:ignore_for:
- ruby-sass

<===> through_use/input.scss
@use "other" as *;
a {b: variable-exists(global-variable)}

<===> through_use/other.scss
$global-variable: null;

<===> through_use/output.css
a {
b: true;
}

<===>
================================================================================
<===> dash_insensitive/input.scss
Expand Down Expand Up @@ -144,3 +165,32 @@ Error: wrong number of arguments (2 for 1) for `variable-exists'
>> a {b: variable-exists(foo, bar)}

------^

<===>
================================================================================
<===> conflict/options.yml
---
:todo:
- libsass # sass/libsass#2807
:ignore_for:
- ruby-sass

<===> conflict/input.scss
@use "other1" as *;
@use "other2" as *;

a {b: variable-exists(member)}

<===> conflict/other1.scss
$member: from other1;

<===> conflict/other2.scss
$member: from other2;

<===> conflict/error
Error: Multiple global modules have a variable named "$member".
,
4 | a {b: variable-exists(member)}
| ^^^^^^^^^^^^^^^^^^^^^^^
'
/sass/spec/core_functions/variable_exists/conflict/input.scss 4:7 root stylesheet

0 comments on commit 32fe000

Please sign in to comment.