diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/rexml/test_contrib.rb | 2 | ||||
-rw-r--r-- | test/rexml/test_core.rb | 20 | ||||
-rw-r--r-- | test/rexml/test_jaxen.rb | 2 | ||||
-rw-r--r-- | test/rexml/xpath/test_base.rb | 1 |
4 files changed, 14 insertions, 11 deletions
diff --git a/test/rexml/test_contrib.rb b/test/rexml/test_contrib.rb index 8462b3c23f..28b96a4972 100644 --- a/test/rexml/test_contrib.rb +++ b/test/rexml/test_contrib.rb @@ -451,7 +451,7 @@ EOL end def test_external_entity - xp = '//channel/title' + xp = '//*:channel/*:title' %w{working.rss broken.rss}.each do |path| File.open(File.join(fixture_path(path))) do |file| diff --git a/test/rexml/test_core.rb b/test/rexml/test_core.rb index 0071063128..b2e5299f39 100644 --- a/test/rexml/test_core.rb +++ b/test/rexml/test_core.rb @@ -877,18 +877,18 @@ EOL EOL # The most common case. People not caring about the namespaces much. - assert_equal( "XY", XPath.match( doc, "/test/a/text()" ).join ) - assert_equal( "XY", XPath.match( doc, "/test/x:a/text()" ).join ) + assert_equal( "XY", XPath.match( doc, "/*:test/*:a/text()" ).join ) + assert_equal( "XY", XPath.match( doc, "/*:test/x:a/text()" ).join ) # Surprising? I don't think so, if you believe my definition of the "common case" - assert_equal( "XYZ", XPath.match( doc, "//a/text()" ).join ) + assert_equal( "XYZ", XPath.match( doc, "//*:a/text()" ).join ) # These are the uncommon cases. Namespaces are actually important, so we define our own # mappings, and pass them in. assert_equal( "XY", XPath.match( doc, "/f:test/f:a/text()", { "f" => "1" } ).join ) # The namespaces are defined, and override the original mappings - assert_equal( "", XPath.match( doc, "/test/a/text()", { "f" => "1" } ).join ) + assert_equal( "XY", XPath.match( doc, "/*:test/*:a/text()", { "f" => "1" } ).join ) assert_equal( "", XPath.match( doc, "/x:test/x:a/text()", { "f" => "1" } ).join ) - assert_equal( "", XPath.match( doc, "//a/text()", { "f" => "1" } ).join ) + assert_equal( "XYZ", XPath.match( doc, "//*:a/text()", { "f" => "1" } ).join ) end def test_processing_instruction @@ -1390,8 +1390,8 @@ ENDXML def test_ticket_102 doc = REXML::Document.new '<doc xmlns="ns"><item name="foo"/></doc>' - assert_equal( "foo", doc.root.elements["item"].attribute("name","ns").to_s ) - assert_equal( "item", doc.root.elements["item[@name='foo']"].name ) + assert_equal( "foo", doc.root.elements["*:item"].attribute("name","ns").to_s ) + assert_equal( "item", doc.root.elements["*:item[@name='foo']"].name ) end def test_ticket_14 @@ -1420,11 +1420,11 @@ ENDXML doc = REXML::Document.new( '<doc xmlns="ns" xmlns:phantom="ns"><item name="foo">text</item></doc>' ) - assert_equal 'text', doc.text( "/doc/item[@name='foo']" ) + assert_equal 'text', doc.text( "/*:doc/*:item[@name='foo']" ) assert_equal "name='foo'", - doc.root.elements["item"].attribute("name", "ns").inspect + doc.root.elements["*:item"].attribute("name", "ns").inspect assert_equal "<item name='foo'>text</item>", - doc.root.elements["item[@name='foo']"].to_s + doc.root.elements["*:item[@name='foo']"].to_s end def test_ticket_135 diff --git a/test/rexml/test_jaxen.rb b/test/rexml/test_jaxen.rb index 1a1d36ba9a..0f8653c956 100644 --- a/test/rexml/test_jaxen.rb +++ b/test/rexml/test_jaxen.rb @@ -56,6 +56,8 @@ module REXMLTests def process_context(doc, context) test_context = XPath.match(doc, context.attributes["select"]) namespaces = context.namespaces + namespaces.delete("var") + namespaces = nil if namespaces.empty? variables = {} var_namespace = "http://jaxen.org/test-harness/var" XPath.each(context, diff --git a/test/rexml/xpath/test_base.rb b/test/rexml/xpath/test_base.rb index 5e0b477081..497bd9fc8f 100644 --- a/test/rexml/xpath/test_base.rb +++ b/test/rexml/xpath/test_base.rb @@ -877,6 +877,7 @@ module REXMLTests <tag1 xmlns='ns1'> <tag2 xmlns='ns2'/> <tada>xa</tada> + <tada xmlns=''>xb</tada> </tag1> XML x = d.root |