# File test/xpath_test.rb, line 159 def test_functions # trivial text() test # confuse-a-function source = "<a>more <b id='1'/><b id='2'>dumb</b><b id='3'/><c/> text</a>" doc = Document.new source res = "" XPath::each(doc.root, "text()") {|val| res << val.to_s} assert_equal "more text", res res = XPath::first(doc.root, "b[last()]") assert_equal '3', res.attributes['id'] res = XPath::first(doc.root, "b[position()=2]") assert_equal '2', res.attributes['id'] res = XPath::first(doc.root, "*[name()='c']") assert_equal "c", res.name end