summaryrefslogtreecommitdiff
path: root/test/rexml/xpath
diff options
context:
space:
mode:
authorkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-04-19 20:45:16 +0000
committerkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-04-19 20:45:16 +0000
commitbe000dcc157b9fb439a255c2639af7da7bb7acb0 (patch)
tree3d75fae80fcdebfa6aba4b00691de1fca9b8fa5f /test/rexml/xpath
parent35f1b8f54660cb0c022bc742c406cab46380c31a (diff)
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
Diffstat (limited to 'test/rexml/xpath')
-rw-r--r--test/rexml/xpath/test_base.rb31
1 files changed, 25 insertions, 6 deletions
diff --git a/test/rexml/xpath/test_base.rb b/test/rexml/xpath/test_base.rb
index 5079fdd75a..d9351e829e 100644
--- a/test/rexml/xpath/test_base.rb
+++ b/test/rexml/xpath/test_base.rb
@@ -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)"],