mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
[Sass] Format the Sass backtrace string a little nicer.
This commit is contained in:
parent
a0cdac1613
commit
f392867fb0
2 changed files with 7 additions and 9 deletions
|
@ -103,14 +103,11 @@ module Sass
|
|||
# @see #sass_backtrace
|
||||
# @return [String]
|
||||
def sass_backtrace_str(default_filename = "an unknown file")
|
||||
msg = "Syntax error on line #{sass_line}" +
|
||||
" of #{sass_filename || default_filename}" +
|
||||
": #{message}"
|
||||
sass_backtrace[1..-1].each do |entry|
|
||||
msg << "\n from line #{entry[:line]}" +
|
||||
"Syntax error: #{message}" +
|
||||
Haml::Util.enum_with_index(sass_backtrace).map do |entry, i|
|
||||
"\n #{i == 0 ? "on" : "from"} line #{entry[:line]}" +
|
||||
" of #{entry[:filename] || default_filename}"
|
||||
end
|
||||
msg
|
||||
end.join
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -55,9 +55,10 @@ class SassPluginTest < Test::Unit::TestCase
|
|||
File.delete(tempfile_loc('bork1'))
|
||||
Sass::Plugin.update_stylesheets
|
||||
File.open(tempfile_loc('bork1')) do |file|
|
||||
assert_equal(<<CSS, file.read.split("\n")[0...6].join("\n"))
|
||||
assert_equal(<<CSS.strip, file.read.split("\n")[0...6].join("\n"))
|
||||
/*
|
||||
Syntax error on line 2 of #{template_loc('bork1')}: Undefined variable: "!bork".
|
||||
Syntax error: Undefined variable: "!bork".
|
||||
on line 2 of #{template_loc('bork1')}
|
||||
|
||||
1: bork
|
||||
2: :bork= !bork
|
||||
|
|
Loading…
Add table
Reference in a new issue