From fb2f8e0f728a13bafaf88ab90d5a0b409bd3590e Mon Sep 17 00:00:00 2001 From: yugui Date: Sun, 3 Jul 2011 12:23:43 +0000 Subject: 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 --- ChangeLog | 18 ++++++++++++++++++ lib/rexml/parsers/xpathparser.rb | 3 ++- test/rexml/test_elements.rb | 9 +++++++++ version.h | 2 +- 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1670283334..fca3bd3027 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +Sat Jun 11 16:04:03 2011 Kouhei Sutou + + * 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!!! + +Sat Jun 11 16:04:03 2011 Kouhei Sutou + + * 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!!! + Mon Jun 6 09:39:43 2011 Aaron Patterson * ext/psych/parser.c (parse): release event objects to plug memory diff --git a/lib/rexml/parsers/xpathparser.rb b/lib/rexml/parsers/xpathparser.rb index 2db37a2578..a37dbdd4b6 100644 --- a/lib/rexml/parsers/xpathparser.rb +++ b/lib/rexml/parsers/xpathparser.rb @@ -17,8 +17,9 @@ module REXML end def parse path + path = path.dup path.gsub!(/([\(\[])\s+/, '\1') # Strip ignorable spaces - path.gsub!( /\s+([\]\)])/, '\1' ) + path.gsub!( /\s+([\]\)])/, '\1') parsed = [] path = OrExpr(path, parsed) parsed 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('') + 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 'seanelliott' assert_equal 2, doc.root.elements.to_a.size diff --git a/version.h b/version.h index 99774e89c3..86d2a215c1 100644 --- a/version.h +++ b/version.h @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_PATCHLEVEL 277 +#define RUBY_PATCHLEVEL 278 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 -- cgit v1.2.3