Skip to content

Commit

Permalink
Merge pull request #1349 from sass/use-members
Browse files Browse the repository at this point in the history
Add @use member usage and load error tests
  • Loading branch information
nex3 authored Feb 26, 2019
2 parents abeaff3 + f74c74c commit 491a7a6
Show file tree
Hide file tree
Showing 37 changed files with 3,166 additions and 404 deletions.
201 changes: 201 additions & 0 deletions spec/core_functions/function_exists.hrx
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
<===> global/input.scss
@function global-function() {@return null}

a {b: function-exists(global-function)}

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

<===>
================================================================================
<===> local/options.yml
---
:todo:
- libsass # sass/libsass#2831

<===> local/input.scss
a {
@function local-function() {@return null}
b: function-exists(local-function);
}

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

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

a {b: function-exists(global_function)}

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

<===>
================================================================================
<===> through_import/input.scss
@import "other";
a {b: function-exists(global-function)}

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

<===> through_import/output.css
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
a {
b: function-exists(non-existent);
}

<===> non_existent/output.css
a {
b: false;
}

<===>
================================================================================
<===> keyword/input.scss
a {b: function-exists($name: foo)}

<===> keyword/output.css
a {
b: false;
}

<===>
================================================================================
<===> error/argument/type/input.scss
a {b: function-exists(12px)}

<===> error/argument/type/error
Error: $name: 12px is not a string.
,
1 | a {b: function-exists(12px)}
| ^^^^^^^^^^^^^^^^^^^^^
'
/sass/spec/core_functions/function_exists/error/argument/type/input.scss 1:7 root stylesheet

<===> error/argument/type/error-ruby-sass
Error: $name: 12px is not a string for `function-exists'
on line 1 of /sass/spec/core_functions/function_exists/error/argument/type/input.scss
Use --trace for backtrace.

<===> error/argument/type/error-libsass
Error: $name: 12px is not a string for `function-exists'
on line 1:7 of /sass/spec/core_functions/function_exists/error/argument/type/input.scss, in function `function-exists`
from line 1:7 of /sass/spec/core_functions/function_exists/error/argument/type/input.scss
>> a {b: function-exists(12px)}

------^

<===>
================================================================================
<===> error/argument/too_few/input.scss
a {b: function-exists()}

<===> error/argument/too_few/error
Error: Missing argument $name.
,
1 | a {b: function-exists()}
| ^^^^^^^^^^^^^^^^^
'
/sass/spec/core_functions/function_exists/error/argument/too_few/input.scss 1:7 root stylesheet

<===> error/argument/too_few/error-ruby-sass
Error: wrong number of arguments (0 for 1) for `function-exists'
on line 1 of /sass/spec/core_functions/function_exists/error/argument/too_few/input.scss
Use --trace for backtrace.

<===> error/argument/too_few/error-libsass
Error: Function function-exists is missing argument $name.
on line 1 of /sass/spec/core_functions/function_exists/error/argument/too_few/input.scss
>> a {b: function-exists()}

------^

<===>
================================================================================
<===> error/argument/too_many/input.scss
a {b: function-exists(foo, bar)}

<===> error/argument/too_many/error
Error: Only 1 argument allowed, but 2 were passed.
,
1 | a {b: function-exists(foo, bar)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^
'
/sass/spec/core_functions/function_exists/error/argument/too_many/input.scss 1:7 root stylesheet

<===> error/argument/too_many/error-ruby-sass
Error: wrong number of arguments (2 for 1) for `function-exists'
on line 1 of /sass/spec/core_functions/function_exists/error/argument/too_many/input.scss
Use --trace for backtrace.

<===> error/argument/too_many/error-libsass
Error: wrong number of arguments (2 for 1) for `function-exists'
on line 1:7 of /sass/spec/core_functions/function_exists/error/argument/too_many/input.scss
>> 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
19 changes: 0 additions & 19 deletions spec/core_functions/get-function/basic.hrx

This file was deleted.

15 changes: 0 additions & 15 deletions spec/core_functions/get-function/builtins.hrx

This file was deleted.

19 changes: 0 additions & 19 deletions spec/core_functions/get-function/css-fn-reference.hrx

This file was deleted.

29 changes: 0 additions & 29 deletions spec/core_functions/get-function/equality.hrx

This file was deleted.

24 changes: 0 additions & 24 deletions spec/core_functions/get-function/errors/function-exists.hrx

This file was deleted.

15 changes: 0 additions & 15 deletions spec/core_functions/get-function/errors/illegal-argument.hrx

This file was deleted.

21 changes: 0 additions & 21 deletions spec/core_functions/get-function/errors/illegal-kwarg.hrx

This file was deleted.

17 changes: 0 additions & 17 deletions spec/core_functions/get-function/errors/math/division.hrx

This file was deleted.

15 changes: 0 additions & 15 deletions spec/core_functions/get-function/errors/non-existent.hrx

This file was deleted.

Loading

0 comments on commit 491a7a6

Please sign in to comment.