Sha256: 93b9c8e0a9293a839c1d85b00e0eb81c08fd32a123eef4792c7c4d6b936302c8

Contents?: true

Size: 999 Bytes

Versions: 22

Compression:

Stored size: 999 Bytes

Contents

require File.expand_path(::File.dirname(__FILE__) + '/../lib/xml/smart')
require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb')

class TestXpathRoot < Minitest::Test
  def test_xpath_root
    doc = XML::Smart.open(::File.dirname(__FILE__) + "/EXAMPLE.xml")
    nodes = doc.find("//*/text()")
    assert(nodes[0].path == "/test/names/name[1]/text()")
    assert(nodes[1].path == "/test/names/name[2]/text()")
    assert(nodes[2].path == "/test/names/name[3]/text()")
    assert(nodes[3].path == "/test/names/name[4]/text()")
    assert(nodes[4].path == "/test/names/name[5]/text()")
    assert(nodes[5].path == "/test/names/name[5]/b/text()")
    assert(nodes[6].path == "/test/names/name[6]/text()")
    assert(nodes[7].path == "/test/names/test_node/text()[1]")
    assert(nodes[8].path == "/test/names/test_node/text()[2]")
    assert(nodes[9].path == "/test/names/test_node/text()[3]")
    assert(nodes[10].path == "/test/colors/blue/text()")
    assert(nodes[11].nil?)
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
xml-smart-0.5.3 test/tc_xpath_root.rb
xml-smart-0.5.2 test/tc_xpath_root.rb
xml-smart-0.5.1 test/tc_xpath_root.rb
xml-smart-0.5.0 test/tc_xpath_root.rb
xml-smart-0.4.4 test/tc_xpath_root.rb
xml-smart-0.4.3 test/tc_xpath_root.rb
xml-smart-0.4.2 test/tc_xpath_root.rb
xml-smart-0.4.1 test/tc_xpath_root.rb
xml-smart-0.4.0 test/tc_xpath_root.rb
xml-smart-0.3.22 test/tc_xpath_root.rb
xml-smart-0.3.21 test/tc_xpath_root.rb
xml-smart-0.3.20 test/tc_xpath_root.rb
xml-smart-0.3.19 test/tc_xpath_root.rb
xml-smart-0.3.18 test/tc_xpath_root.rb
xml-smart-0.3.17 test/tc_xpath_root.rb
xml-smart-0.3.16 test/tc_xpath_root.rb
xml-smart-0.3.15 test/tc_xpath_root.rb
xml-smart-0.3.14 test/tc_xpath_root.rb
xml-smart-0.3.12 test/tc_xpath_root.rb
xml-smart-0.3.11 test/tc_xpath_root.rb