require 'test/unit'
require 'html/template/pro'
class TestPathLikeVariableScope < Test::Unit::TestCase
def test_path_like_variable_scope
template_text = <<'END'
END
template = HTML::Template::Pro.new(:path_like_variable_scope => true,
:scalarref => template_text)
template.param(:top_level_value => "3",
:class => [
{
:teacher_name => "Adam",
:person => [
{
:name => "Jon",
:age => "20",
},
{
:name => "Bob",
:age => "21",
},
],
},
{
}
])
assert_equal(<<'END', template.output)
Adam
Jon
20
3
15
Adam
Bob
21
3
15
END
end
end