From fcbf63e62c627deae76c1b8cb8c0876c536ed811 Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Mon, 16 Mar 2020 18:49:26 +0900 Subject: Fresh start --- jni/ruby/test/rexml/xpath/test_attribute.rb | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 jni/ruby/test/rexml/xpath/test_attribute.rb (limited to 'jni/ruby/test/rexml/xpath/test_attribute.rb') diff --git a/jni/ruby/test/rexml/xpath/test_attribute.rb b/jni/ruby/test/rexml/xpath/test_attribute.rb new file mode 100644 index 0000000..95af4de --- /dev/null +++ b/jni/ruby/test/rexml/xpath/test_attribute.rb @@ -0,0 +1,29 @@ +require 'test/unit' +require 'rexml/document' + +module REXMLTests + class TestXPathAttribute < Test::Unit::TestCase + def setup + @xml = <<-XML + + + child1 + child2 + child3 + + XML + @document = REXML::Document.new(@xml) + end + + def test_elements + root = @document.elements["root"] + second_child = root.elements["child[@name='two']"] + assert_equal("child2", second_child.text) + end + + def test_xpath_each + children = REXML::XPath.each(@document, "/root/child[@name='two']") + assert_equal(["child2"], children.collect(&:text)) + end + end +end -- cgit v1.2.3