From 80cb3351ddcfabf7ba470a098f692c378456854d Mon Sep 17 00:00:00 2001 From: kou Date: Sat, 11 Jun 2011 07:05:42 +0000 Subject: * 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 --- test/rexml/test_elements.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test') diff --git a/test/rexml/test_elements.rb b/test/rexml/test_elements.rb index b7c7c267ed..e5e209ecdc 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('') + 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 'seanelliott' assert_equal 2, doc.root.elements.to_a.size -- cgit v1.2.3