1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

rexml: Make more readable

test/rexml/xpath/test_base.rb: Use here document for XML.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kou 2018-04-19 20:45:16 +00:00
parent 35f1b8f546
commit be000dcc15

View file

@ -692,7 +692,18 @@ module REXMLTests
end
def test_ordering
source = "<a><b><c id='1'/><c id='2'/></b><b><d id='1'/><d id='2'/></b></a>"
source = <<-XML
<a>
<b>
<c id='1'/>
<c id='2'/>
</b>
<b>
<d id='3'/>
<d id='4'/>
</b>
</a>
XML
d = REXML::Document.new( source )
r = REXML::XPath.match( d, %q{/a/*/*[1]} )
assert_equal( 1, r.size )
@ -836,11 +847,19 @@ module REXMLTests
end
def test_sum
d = Document.new("<a>"+
"<b>1</b><b>2</b><b>3</b>"+
"<c><d>1</d><d>2</d></c>"+
"<e att='1'/><e att='2'/>"+
"</a>")
d = Document.new(<<-XML)
<a>
<b>1</b>
<b>2</b>
<b>3</b>
<c>
<d>1</d>
<d>2</d>
</c>
<e att='1'/>
<e att='2'/>
</a>
XML
for v,p in [[6, "sum(/a/b)"],
[9, "sum(//b | //d)"],