* 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
This commit is contained in:
parent
8aecece693
commit
80cb3351dd
@ -1,3 +1,12 @@
|
|||||||
|
Sat Jun 11 16:04:03 2011 Kouhei Sutou <kou@cozmixng.org>
|
||||||
|
|
||||||
|
* 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 15:53:27 2011 Kouhei Sutou <kou@cozmixng.org>
|
Sat Jun 11 15:53:27 2011 Kouhei Sutou <kou@cozmixng.org>
|
||||||
|
|
||||||
* test/rexml/test_elements.rb (ElementsTester): remove needless
|
* test/rexml/test_elements.rb (ElementsTester): remove needless
|
||||||
|
@ -17,8 +17,9 @@ module REXML
|
|||||||
end
|
end
|
||||||
|
|
||||||
def parse path
|
def parse path
|
||||||
|
path = path.dup
|
||||||
path.gsub!(/([\(\[])\s+/, '\1') # Strip ignorable spaces
|
path.gsub!(/([\(\[])\s+/, '\1') # Strip ignorable spaces
|
||||||
path.gsub!( /\s+([\]\)])/, '\1' )
|
path.gsub!( /\s+([\]\)])/, '\1')
|
||||||
parsed = []
|
parsed = []
|
||||||
path = OrExpr(path, parsed)
|
path = OrExpr(path, parsed)
|
||||||
parsed
|
parsed
|
||||||
|
@ -84,6 +84,15 @@ class ElementsTester < Test::Unit::TestCase
|
|||||||
assert_equal 7, count
|
assert_equal 7, count
|
||||||
end
|
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
|
def test_to_a
|
||||||
doc = Document.new '<a>sean<b/>elliott<c/></a>'
|
doc = Document.new '<a>sean<b/>elliott<c/></a>'
|
||||||
assert_equal 2, doc.root.elements.to_a.size
|
assert_equal 2, doc.root.elements.to_a.size
|
||||||
|
Loading…
x
Reference in New Issue
Block a user