ruby-changes:20331
From: yugui <ko1@a...>
Date: Sun, 3 Jul 2011 21:24:13 +0900 (JST)
Subject: [ruby-changes:20331] yugui:r32378 (ruby_1_9_2): merges r31995 and r31998 from trunk into ruby_1_9_2.
yugui 2011-07-03 21:23:43 +0900 (Sun, 03 Jul 2011) New Revision: 32378 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=32378 Log: 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. Modified files: branches/ruby_1_9_2/ChangeLog branches/ruby_1_9_2/lib/rexml/parsers/xpathparser.rb branches/ruby_1_9_2/test/rexml/test_elements.rb branches/ruby_1_9_2/version.h Index: ruby_1_9_2/ChangeLog =================================================================== --- ruby_1_9_2/ChangeLog (revision 32377) +++ ruby_1_9_2/ChangeLog (revision 32378) @@ -1,3 +1,21 @@ +Sat Jun 11 16:04:03 2011 Kouhei Sutou <kou@c...> + + * 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 <kou@c...> + + * 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 <aaron@t...> * ext/psych/parser.c (parse): release event objects to plug memory Index: ruby_1_9_2/lib/rexml/parsers/xpathparser.rb =================================================================== --- ruby_1_9_2/lib/rexml/parsers/xpathparser.rb (revision 32377) +++ ruby_1_9_2/lib/rexml/parsers/xpathparser.rb (revision 32378) @@ -17,8 +17,9 @@ 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 Index: ruby_1_9_2/version.h =================================================================== --- ruby_1_9_2/version.h (revision 32377) +++ ruby_1_9_2/version.h (revision 32378) @@ -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 Index: ruby_1_9_2/test/rexml/test_elements.rb =================================================================== --- ruby_1_9_2/test/rexml/test_elements.rb (revision 32377) +++ ruby_1_9_2/test/rexml/test_elements.rb (revision 32378) @@ -84,6 +84,15 @@ 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/