require 'test/unit' require 'htree' class TestRawString < Test::Unit::TestCase def test_elem t = HTree.parse("x") assert_equal("x", t.root.raw_string) assert_equal("x", t.root.raw_string) # raw_string shouldn't have side effect. end def test_no_raw_string t = HTree::Elem.new('a') assert_equal(nil, t.raw_string) t = HTree::Elem.new('a', HTree.parse("x").root) assert_equal(nil, t.raw_string) end end