ruby-changes:50993
From: kou <ko1@a...>
Date: Fri, 20 Apr 2018 05:45:23 +0900 (JST)
Subject: [ruby-changes:50993] kou:r63200 (trunk): rexml: Make more readable
kou 2018-04-20 05:45:16 +0900 (Fri, 20 Apr 2018) New Revision: 63200 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63200 Log: rexml: Make more readable test/rexml/xpath/test_base.rb: Use here document for XML. Modified files: trunk/test/rexml/xpath/test_base.rb Index: test/rexml/xpath/test_base.rb =================================================================== --- test/rexml/xpath/test_base.rb (revision 63199) +++ test/rexml/xpath/test_base.rb (revision 63200) @@ -692,7 +692,18 @@ module REXMLTests https://github.com/ruby/ruby/blob/trunk/test/rexml/xpath/test_base.rb#L692 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 https://github.com/ruby/ruby/blob/trunk/test/rexml/xpath/test_base.rb#L847 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)"], -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/