From ba3d2f4ac20bec871fe96a393d923d0cbb0fd96a Mon Sep 17 00:00:00 2001 From: kou Date: Tue, 27 May 2014 13:10:55 +0000 Subject: * test/rexml/test_contrib.rb: Indent. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/rexml/xpath/test_predicate.rb | 114 ++++++++++++++++++------------------- 1 file changed, 57 insertions(+), 57 deletions(-) (limited to 'test/rexml/xpath/test_predicate.rb') diff --git a/test/rexml/xpath/test_predicate.rb b/test/rexml/xpath/test_predicate.rb index 4cbf244d74..287e131c54 100644 --- a/test/rexml/xpath/test_predicate.rb +++ b/test/rexml/xpath/test_predicate.rb @@ -4,60 +4,60 @@ require "rexml/xpath" require "rexml/parsers/xpathparser" module REXMLTests -class TestXPathPredicate < Test::Unit::TestCase - include REXML - SRC=<<-EOL -
-
- free flowing text. -
-
-
- free flowing text. -
-
- free flowing text. -
-
-
- EOL + class TestXPathPredicate < Test::Unit::TestCase + include REXML + SRC=<<-EOL +
+
+ free flowing text. +
+
+
+ free flowing text. +
+
+ free flowing text. +
+
+
+ EOL - def setup - @doc = REXML::Document.new( SRC ) - @parser = REXML::Parsers::XPathParser.new + def setup + @doc = REXML::Document.new( SRC ) + @parser = REXML::Parsers::XPathParser.new - end + end - def test_predicates_parent - path = '//section[../self::section[@role="division"]]' - m = do_path( path ) - assert_equal( 2, m.size ) - assert_equal( "2", m[0].attributes["id"] ) - assert_nil( m[1].attributes["id"] ) - end + def test_predicates_parent + path = '//section[../self::section[@role="division"]]' + m = do_path( path ) + assert_equal( 2, m.size ) + assert_equal( "2", m[0].attributes["id"] ) + assert_nil( m[1].attributes["id"] ) + end - def test_predicates_single - path = '//section[@role="subdivision" and not(../self::section[@role="division"])]' - m = do_path( path ) - assert_equal( 1, m.size ) - assert_equal( "1", m[0].attributes["id"] ) - end + def test_predicates_single + path = '//section[@role="subdivision" and not(../self::section[@role="division"])]' + m = do_path( path ) + assert_equal( 1, m.size ) + assert_equal( "1", m[0].attributes["id"] ) + end - def test_predicates_multi - path = '//section[@role="subdivision"][not(../self::section[@role="division"])]' - m = do_path( path ) - assert_equal( 1, m.size ) - assert_equal( "1", m[0].attributes["id"] ) - end + def test_predicates_multi + path = '//section[@role="subdivision"][not(../self::section[@role="division"])]' + m = do_path( path ) + assert_equal( 1, m.size ) + assert_equal( "1", m[0].attributes["id"] ) + end - def do_path( path ) - m = REXML::XPath.match( @doc, path ) - #puts path, @parser.parse( path ).inspect - return m - end + def do_path( path ) + m = REXML::XPath.match( @doc, path ) + #puts path, @parser.parse( path ).inspect + return m + end - def test_get_no_siblings_terminal_nodes - source = <<-XML + def test_get_no_siblings_terminal_nodes + source = <<-XML TEXT1 @@ -68,15 +68,15 @@ class TestXPathPredicate < Test::Unit::TestCase XML - doc = REXML::Document.new(source) - predicate = "count(child::node()|" + - "following-sibling::node()|" + - "preceding-sibling::node())=0" - m = REXML::XPath.match(doc, "/descendant-or-self::node()[#{predicate}]") - assert_equal( [REXML::Text.new("TEXT1"), - REXML::Text.new("TEXT2"), - REXML::Comment.new("COMMENT")], - m ) + doc = REXML::Document.new(source) + predicate = "count(child::node()|" + + "following-sibling::node()|" + + "preceding-sibling::node())=0" + m = REXML::XPath.match(doc, "/descendant-or-self::node()[#{predicate}]") + assert_equal( [REXML::Text.new("TEXT1"), + REXML::Text.new("TEXT2"), + REXML::Comment.new("COMMENT")], + m ) + end end end -end -- cgit v1.2.3