summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-03 12:23:43 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-03 12:23:43 +0000
commitfb2f8e0f728a13bafaf88ab90d5a0b409bd3590e (patch)
tree248f8b8eba1e0a370a3760ebf27dea301110dde2 /test
parentfe21cf8b3667e499086f937c0cbcc89840c7df46 (diff)
merges r31995 and r31998 from trunk into ruby_1_9_2.
-- * 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!!! -- * ChangeLog: fix ticket number at r31995. fixes #4161 is correct. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@32378 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-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 210004a1c0..7d2839e261 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_elements_to_a
doc = Document.new '<a>sean<b/>elliott<c/></a>'
assert_equal 2, doc.root.elements.to_a.size