mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
[Sass] Set the line numbers for illegal-property-syntax exceptions.
This commit is contained in:
parent
9e354ac2bb
commit
a373d92bfb
2 changed files with 4 additions and 2 deletions
|
@ -42,9 +42,9 @@ module Sass::Tree
|
||||||
# @raise [Sass::SyntaxError] if the property uses invalid syntax
|
# @raise [Sass::SyntaxError] if the property uses invalid syntax
|
||||||
def to_s(tabs, parent_name = nil)
|
def to_s(tabs, parent_name = nil)
|
||||||
if @options[:property_syntax] == :old && @prop_syntax == :new
|
if @options[:property_syntax] == :old && @prop_syntax == :new
|
||||||
raise Sass::SyntaxError.new("Illegal property syntax: can't use new syntax when :property_syntax => :old is set.")
|
raise Sass::SyntaxError.new("Illegal property syntax: can't use new syntax when :property_syntax => :old is set.", @line)
|
||||||
elsif @options[:property_syntax] == :new && @prop_syntax == :old
|
elsif @options[:property_syntax] == :new && @prop_syntax == :old
|
||||||
raise Sass::SyntaxError.new("Illegal property syntax: can't use old syntax when :property_syntax => :new is set.")
|
raise Sass::SyntaxError.new("Illegal property syntax: can't use old syntax when :property_syntax => :new is set.", @line)
|
||||||
end
|
end
|
||||||
|
|
||||||
if value[-1] == ?;
|
if value[-1] == ?;
|
||||||
|
|
|
@ -255,12 +255,14 @@ SASS
|
||||||
rescue Sass::SyntaxError => e
|
rescue Sass::SyntaxError => e
|
||||||
assert_equal("Illegal property syntax: can't use new syntax when :property_syntax => :old is set.",
|
assert_equal("Illegal property syntax: can't use new syntax when :property_syntax => :old is set.",
|
||||||
e.message)
|
e.message)
|
||||||
|
assert_equal(2, e.sass_line)
|
||||||
else
|
else
|
||||||
assert(false, "SyntaxError not raised for :property_syntax => :old")
|
assert(false, "SyntaxError not raised for :property_syntax => :old")
|
||||||
end
|
end
|
||||||
|
|
||||||
begin
|
begin
|
||||||
render("a\n :b c", :property_syntax => :new)
|
render("a\n :b c", :property_syntax => :new)
|
||||||
|
assert_equal(2, e.sass_line)
|
||||||
rescue Sass::SyntaxError => e
|
rescue Sass::SyntaxError => e
|
||||||
assert_equal("Illegal property syntax: can't use old syntax when :property_syntax => :new is set.",
|
assert_equal("Illegal property syntax: can't use old syntax when :property_syntax => :new is set.",
|
||||||
e.message)
|
e.message)
|
||||||
|
|
Loading…
Add table
Reference in a new issue