mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
[Sass] Mixin a mixin-arg error-handling bug.
This commit is contained in:
parent
a4540d0005
commit
c559c550a6
3 changed files with 21 additions and 1 deletions
|
@ -3,6 +3,11 @@
|
|||
* Table of contents
|
||||
{:toc}
|
||||
|
||||
## 3.0.3 (Unreleased)
|
||||
|
||||
* Raise an informative error when mixin arguments have a mispaced comma,
|
||||
as in `@include foo(bar, )`.
|
||||
|
||||
## 3.0.2
|
||||
|
||||
[Tagged on GitHub](http://github.com/nex3/haml/commit/3.0.2).
|
||||
|
|
|
@ -271,7 +271,7 @@ RUBY
|
|||
def arglist
|
||||
return unless e = interpolation
|
||||
return [e] unless try_tok(:comma)
|
||||
[e, *arglist]
|
||||
[e, *assert_expr(:arglist)]
|
||||
end
|
||||
|
||||
def raw
|
||||
|
@ -333,6 +333,7 @@ RUBY
|
|||
EXPR_NAMES = {
|
||||
:string => "string",
|
||||
:default => "expression (e.g. 1px, bold)",
|
||||
:arglist => "mixin argument",
|
||||
}
|
||||
|
||||
def assert_expr(name)
|
||||
|
|
|
@ -1022,6 +1022,20 @@ $value : bip;
|
|||
foo {
|
||||
bar: -moz-\#{$value};
|
||||
}
|
||||
SCSS
|
||||
end
|
||||
|
||||
def test_extra_comma_in_mixin_arglist_error
|
||||
assert_raise(Sass::SyntaxError, <<MESSAGE) {render <<SCSS}
|
||||
Invalid CSS after "@include foo(bar, ": expected mixin argument, was ")"
|
||||
MESSAGE
|
||||
@mixin foo($a1, $a2) {
|
||||
baz: $a1 $a2;
|
||||
}
|
||||
|
||||
.bar {
|
||||
@include foo(bar, );
|
||||
}
|
||||
SCSS
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue