\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 == 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(Faml::SyntaxError)
end
it 'raises error if self-closing tag have children' do
expect { render_string(<