\n2+3i\n\n")
%div
%span= Complex(2,
3)
HAML
end
it 'parses string interpolation' do
expect(render_string(%q|%span hello #{''} |)).to eq("hello </span> \n")
expect(render_string(<<'HAML')).to eq("\nhello </span> \n\n")
%span
hello #{{text: ''}[:text]}
HAML
expect(render_string(<<'HAML')).to eq("\nhello </span> \n\n")
- @var = ''
%span
hello #@var
HAML
end
it 'parses string interpolation with multibyte characters' do
expect(render_string(%q|#{'日本語'} にほんご|)).to eq("日本語 にほんご\n")
end
it 'recognized escaped string interpolation' do
expect(render_string(%q|%p hello \#{1 + 2}|)).to eq("hello \#{1 + 2}
\n")
end
it 'parses self-closing tag' do
expect(render_string('%p/')).to eq("\n")
end
it 'renders some attributes as self-closing by default' do
expect(render_string('%meta{"http-equiv" => "Content-Type", :content => "text/html"}')).to eq("\n")
end
it 'parses nuke-inner-whitespace (<)' do
expect(render_string(<\nFoo!\n
\n")
%blockquote<
%div
Foo!
HAML
end
it 'renders pre tag as nuke-inner-whitespace by default' do
expect(render_string(<hello\nworld\n")
%pre
hello
world
HAML
end
it 'parses nuke-outer-whitespace (>)' do
expect(render_string(<hello\n")
%img
%span> hello
%img
HAML
end
it 'parses nuke-whitespaces' do
expect(render_string(<foo\nbar
\n")
%img
%pre><
foo
bar
%img
HAML
end
it 'parses == syntax' do
expect(render_string('%p== =#{1+2}hello')).to eq("=3hello
\n")
end
it 'raises error if self-closing tag have text' do
expect { render_string('%p/ hello') }.to raise_error(FastHaml::SyntaxError)
end
it 'raises error if self-closing tag have children' do
expect { render_string(<