require 'test/unit' require 'htree/traverse' require 'htree/parse' require 'htree/equality' class TestTraverse < Test::Unit::TestCase def test_filter l = HTree.parse('x').make_loc l2 = l.filter {|n| n.path != 'doc()/a/b[1]' } assert_equal(HTree.parse(''), l2) end def test_title inputs = [ HTree.parse('aaa'), HTree.parse(<<'End') aaa End ] result = HTree::Text.new('aaa') inputs.each {|input| assert_equal(result, input.title) } inputs.each {|input| assert_equal(result, input.make_loc.title) } end def test_author inputs = [ HTree.parse(''), HTree.parse(''), HTree.parse(<<'End'), xxx End HTree.parse(<<'End') xxx End ] result = HTree::Text.new('xxx') inputs.each {|input| #assert_equal(result, input.author) } inputs.each {|input| assert_equal(result, input.make_loc.author) } end end