1
0
Fork 0
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:
Nathan Weizenbaum 2010-05-12 14:06:55 -07:00
parent a4540d0005
commit c559c550a6
3 changed files with 21 additions and 1 deletions

View file

@ -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).

View file

@ -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)

View file

@ -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