1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

Fix tests

\n is escaped as 


The error line number is on the first line
Force error to occur on line 2
This commit is contained in:
Tee Parham 2017-02-09 09:24:22 -07:00
parent eff1161dc6
commit f4f7812612
2 changed files with 6 additions and 6 deletions

View file

@ -379,10 +379,10 @@ HAML
end
def test_textareas
assert_equal("<textarea>Foo\n bar\n baz</textarea>\n",
assert_equal("<textarea>Foo&#x000A; bar&#x000A; baz</textarea>\n",
render('%textarea= "Foo\n bar\n baz"'))
assert_equal("<pre>Foo\n bar\n baz</pre>\n",
assert_equal("<pre>Foo&#x000A; bar&#x000A; baz</pre>\n",
render('%pre= "Foo\n bar\n baz"'))
assert_equal("<textarea>#{'a' * 100}</textarea>\n",
@ -951,7 +951,7 @@ HAML
end
def test_ampersand_equals_should_escape_before_preserve
assert_equal("<textarea>foo\nbar</textarea>\n", render('%textarea&= "foo\nbar"', :escape_html => false))
assert_equal("<textarea>foo&#x000A;bar</textarea>\n", render('%textarea&= "foo\nbar"', :escape_html => false))
end
def test_bang_equals_should_not_escape
@ -1434,7 +1434,7 @@ HAML
end
def test_auto_preserve
assert_equal("<pre>foo\nbar</pre>\n", render('%pre="foo\nbar"'))
assert_equal("<pre>foo&#x000A;bar</pre>\n", render('%pre="foo\nbar"'))
assert_equal("<pre>foo\nbar</pre>\n", render("%pre\n foo\n bar"))
end

View file

@ -559,10 +559,10 @@ MESSAGE
end
def test_error_return_line
render("%p foo\n= haml_concat 'foo'\n%p bar")
render("%p foo\n= haml_concat('foo').to_s\n%p bar")
assert false, "Expected Haml::Error"
rescue Haml::Error => e
assert_equal 2, e.backtrace[1].scan(/:(\d+)/).first.first.to_i
assert_equal 2, e.backtrace[0].scan(/:(\d+)/).first.first.to_i
end
def test_error_return_line_in_helper