summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-09-17 14:47:20 +0000
committerkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-09-17 14:47:20 +0000
commitd8c3fa15069932cac36790df2485d148f7f4c807 (patch)
tree1474cb856a60bda6b86312734c973ace60a8c7bb /test
parent7bf12316a1716c2116908c494e9e259dc39eb8a5 (diff)
downloadruby-d8c3fa15069932cac36790df2485d148f7f4c807.tar.gz
* lib/rexml/xpath_parser.rb, test/rexml/test_xpath.rb:
add missing method availability check. [ruby-core:32447] Reported by Wiebe Cazemier. Thanks!!! git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/rexml/test_xpath.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/rexml/test_xpath.rb b/test/rexml/test_xpath.rb
index f3a27cf154..d7ab9620a8 100644
--- a/test/rexml/test_xpath.rb
+++ b/test/rexml/test_xpath.rb
@@ -1053,4 +1053,27 @@ EOF
r = REXML::XPath.match( d, %q{/a/b[c='3']} )
assert_equal(1, r.size())
end
+
+ def test_or_and
+ doc = "
+<html>
+ <head>
+ <title>test</title>
+ </head>
+ <body>
+ <p>
+ A <a rel=\"sub\" href=\"/\">link</a>.
+ </p>
+ </body>
+</html>
+"
+
+ xmldoc = REXML::Document.new(doc)
+ xpath = "descendant::node()[(local-name()='link' or local-name()='a') and @rel='sub']"
+ hrefs = []
+ xmldoc.elements.each(xpath) do |element|
+ hrefs << element.attributes["href"]
+ end
+ assert_equal(["/"], hrefs, "Bug #3842 [ruby-core:32447]")
+ end
end