summaryrefslogtreecommitdiff
path: root/test/rexml
diff options
context:
space:
mode:
authorkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-11 07:05:42 +0000
committerkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-11 07:05:42 +0000
commit80cb3351ddcfabf7ba470a098f692c378456854d (patch)
tree21d5bd33966c7cc390cb53d9c7383f2bb3ec9819 /test/rexml
parent8aecece69326b14c8797203e692f7a6d354c5fa8 (diff)
* lib/rexml/parsers/xpathparser.rb
(REXML::Parsers::XPathParser#parse), test/rexml/test_elements.rb (ElementsTester::test_each_with_frozen_condition): don't modify original XPath. fixes #4164 Reported by Pavel Shved. Thanks!!! git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rexml')
-rw-r--r--test/rexml/test_elements.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/rexml/test_elements.rb b/test/rexml/test_elements.rb
index b7c7c26..e5e209e 100644
--- a/test/rexml/test_elements.rb
+++ b/test/rexml/test_elements.rb
@@ -84,6 +84,15 @@ class ElementsTester < Test::Unit::TestCase
assert_equal 7, count
end
+ def test_each_with_frozen_condition
+ doc = Document.new('<books><book name="Ruby"/><book name="XML"/></books>')
+ names = []
+ doc.root.elements.each('book'.freeze) do |element|
+ names << element.attributes["name"]
+ end
+ assert_equal(["Ruby", "XML"], names)
+ end
+
def test_to_a
doc = Document.new '<a>sean<b/>elliott<c/></a>'
assert_equal 2, doc.root.elements.to_a.size