From 9fb2d21d7d7dcaba7c4cfd01914c2f4bec66e161 Mon Sep 17 00:00:00 2001 From: kou Date: Sat, 15 Nov 2014 11:13:31 +0000 Subject: [PATCH] * test/rexml/test_document.rb (REXMLTests::TestDocument::EntityExpansionLimitTest): Indent. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/rexml/test_document.rb | 116 ++++++++++++++++++------------------ 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/test/rexml/test_document.rb b/test/rexml/test_document.rb index 33c62bacc5..a428e55dd4 100644 --- a/test/rexml/test_document.rb +++ b/test/rexml/test_document.rb @@ -33,7 +33,7 @@ EOF end class EntityExpansionLimitTest < Test::Unit::TestCase - XML_WITH_NESTED_ENTITY = < @@ -49,7 +49,7 @@ EOF EOF - XML_WITH_NESTED_EMPTY_ENTITY = < @@ -65,7 +65,7 @@ EOF EOF - XML_WITH_NESTED_PARAMETER_ENTITY = < @@ -79,7 +79,7 @@ EOF EOF - XML_WITH_NESTED_EMPTY_PARAMETER_ENTITY = < @@ -93,7 +93,7 @@ EOF EOF - XML_WITH_4_ENTITY_EXPANSION = < @@ -106,64 +106,64 @@ EOF EOF - def test_entity_expansion_limit - doc = REXML::Document.new(XML_WITH_NESTED_ENTITY) - assert_raise(RuntimeError) do - doc.root.children.first.value - end - REXML::Security.entity_expansion_limit = 100 - assert_equal(100, REXML::Security.entity_expansion_limit) - doc = REXML::Document.new(XML_WITH_NESTED_ENTITY) - assert_raise(RuntimeError) do - doc.root.children.first.value - end - assert_equal(101, doc.entity_expansion_count) + def test_entity_expansion_limit + doc = REXML::Document.new(XML_WITH_NESTED_ENTITY) + assert_raise(RuntimeError) do + doc.root.children.first.value + end + REXML::Security.entity_expansion_limit = 100 + assert_equal(100, REXML::Security.entity_expansion_limit) + doc = REXML::Document.new(XML_WITH_NESTED_ENTITY) + assert_raise(RuntimeError) do + doc.root.children.first.value + end + assert_equal(101, doc.entity_expansion_count) - doc = REXML::Document.new(XML_WITH_NESTED_EMPTY_ENTITY) - assert_raise(RuntimeError) do - doc.root.children.first.value - end - REXML::Security.entity_expansion_limit = 100 - assert_equal(100, REXML::Security.entity_expansion_limit) - doc = REXML::Document.new(XML_WITH_NESTED_EMPTY_ENTITY) - assert_raise(RuntimeError) do - doc.root.children.first.value - end - assert_equal(101, doc.entity_expansion_count) + doc = REXML::Document.new(XML_WITH_NESTED_EMPTY_ENTITY) + assert_raise(RuntimeError) do + doc.root.children.first.value + end + REXML::Security.entity_expansion_limit = 100 + assert_equal(100, REXML::Security.entity_expansion_limit) + doc = REXML::Document.new(XML_WITH_NESTED_EMPTY_ENTITY) + assert_raise(RuntimeError) do + doc.root.children.first.value + end + assert_equal(101, doc.entity_expansion_count) - REXML::Security.entity_expansion_limit = 4 - doc = REXML::Document.new(XML_WITH_4_ENTITY_EXPANSION) - assert_equal("\na\na a\n<\n", doc.root.children.first.value) - REXML::Security.entity_expansion_limit = 3 - doc = REXML::Document.new(XML_WITH_4_ENTITY_EXPANSION) - assert_raise(RuntimeError) do - doc.root.children.first.value - end - ensure - REXML::Security.entity_expansion_limit = 10000 - end - - def test_entity_expansion_limit_for_parameter_entity - assert_raise(REXML::ParseException) do - REXML::Document.new(XML_WITH_NESTED_PARAMETER_ENTITY) - end - REXML::Security.entity_expansion_limit = 100 - assert_equal(100, REXML::Security.entity_expansion_limit) - assert_raise(REXML::ParseException) do - REXML::Document.new(XML_WITH_NESTED_PARAMETER_ENTITY) + REXML::Security.entity_expansion_limit = 4 + doc = REXML::Document.new(XML_WITH_4_ENTITY_EXPANSION) + assert_equal("\na\na a\n<\n", doc.root.children.first.value) + REXML::Security.entity_expansion_limit = 3 + doc = REXML::Document.new(XML_WITH_4_ENTITY_EXPANSION) + assert_raise(RuntimeError) do + doc.root.children.first.value + end + ensure + REXML::Security.entity_expansion_limit = 10000 end - assert_raise(REXML::ParseException) do - REXML::Document.new(XML_WITH_NESTED_EMPTY_PARAMETER_ENTITY) + def test_entity_expansion_limit_for_parameter_entity + assert_raise(REXML::ParseException) do + REXML::Document.new(XML_WITH_NESTED_PARAMETER_ENTITY) + end + REXML::Security.entity_expansion_limit = 100 + assert_equal(100, REXML::Security.entity_expansion_limit) + assert_raise(REXML::ParseException) do + REXML::Document.new(XML_WITH_NESTED_PARAMETER_ENTITY) + end + + assert_raise(REXML::ParseException) do + REXML::Document.new(XML_WITH_NESTED_EMPTY_PARAMETER_ENTITY) + end + REXML::Security.entity_expansion_limit = 100 + assert_equal(100, REXML::Security.entity_expansion_limit) + assert_raise(REXML::ParseException) do + REXML::Document.new(XML_WITH_NESTED_EMPTY_PARAMETER_ENTITY) + end + ensure + REXML::Security.entity_expansion_limit = 10000 end - REXML::Security.entity_expansion_limit = 100 - assert_equal(100, REXML::Security.entity_expansion_limit) - assert_raise(REXML::ParseException) do - REXML::Document.new(XML_WITH_NESTED_EMPTY_PARAMETER_ENTITY) - end - ensure - REXML::Security.entity_expansion_limit = 10000 - end end def test_tag_in_cdata_with_not_ascii_only_but_ascii8bit_encoding_source