We've already passed comment spec

This commit is contained in:
Takashi Kokubun 2015-10-24 20:47:06 +09:00
parent 21a4816464
commit 7a437f76c6
2 changed files with 47 additions and 1 deletions

View File

@ -8,4 +8,49 @@ class Hamlit::CommentTest < Haml::TestCase
<!-- comments -->
HTML
end
test 'strips html comment ignoring around spcaes' do
assert_render('/ comments ', <<-HTML)
<!-- comments -->
HTML
end
test 'accepts backslash-only line in a comment' do
assert_render(<<-'HAML', <<-HTML)
/
\
HAML
<!--
-->
HTML
end
test 'renders a deeply indented comment starting with backslash' do
assert_render(<<-'HAML', <<-HTML)
/
\ a
/
a
HAML
<!--
a
-->
<!--
a
-->
HTML
end
test 'ignores multiline comment' do
assert_render(<<-'HAML', <<-HTML)
-# if true
- raise 'ng'
= invalid script
too deep indent
ok
HAML
ok
HTML
end
end

View File

@ -27,7 +27,8 @@ end
module HamlitTest
def assert_render(haml, html)
haml, html = haml.unindent, html.unindent
assert_equal render(haml), html
options = { escape_html: true, ugly: true }
assert_equal render(haml, options), html
end
end