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

Unfreeze string literals for ParseNode#inspect

This commit is contained in:
Jalyna Schroeder 2019-08-06 11:00:17 +02:00
parent a054e2ad79
commit bc881814e6
2 changed files with 9 additions and 1 deletions

View file

@ -202,7 +202,7 @@ module Haml
end
def inspect
%Q[(#{type} #{value.inspect}#{children.each_with_object('') {|c, s| s << "\n#{c.inspect.gsub!(/^/, ' ')}"}})]
%Q[(#{type} #{value.inspect}#{children.each_with_object(''.dup) {|c, s| s << "\n#{c.inspect.gsub!(/^/, ' ')}"}})].dup
end
end

View file

@ -96,6 +96,14 @@ module Haml
end
end
test "inspect for node with children returns text" do
text = "some revealed text"
cond = "[cond]"
node = parse("/!#{cond} #{text}")
assert_equal "(root nil\n (comment {:conditional=>\"[cond]\", :text=>\"some revealed text\", :revealed=>true, :parse=>false}))", node.inspect
end
test "revealed conditional comments are detected" do
text = "some revealed text"
cond = "[cond]"