mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/rexml/test_document.rb: Indent.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7cd76ab0c5
commit
9f4ab1c69d
1 changed files with 56 additions and 56 deletions
|
@ -42,8 +42,8 @@ EOF
|
||||||
end
|
end
|
||||||
|
|
||||||
class GeneralEntityTest < self
|
class GeneralEntityTest < self
|
||||||
def test_have_value
|
def test_have_value
|
||||||
xml = <<EOF
|
xml = <<EOF
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE member [
|
<!DOCTYPE member [
|
||||||
<!ENTITY a "&b;&b;&b;&b;&b;&b;&b;&b;&b;&b;">
|
<!ENTITY a "&b;&b;&b;&b;&b;&b;&b;&b;&b;&b;">
|
||||||
|
@ -59,21 +59,21 @@ EOF
|
||||||
</member>
|
</member>
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
doc = REXML::Document.new(xml)
|
doc = REXML::Document.new(xml)
|
||||||
assert_raise(RuntimeError) do
|
assert_raise(RuntimeError) do
|
||||||
doc.root.children.first.value
|
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)
|
||||||
|
assert_raise(RuntimeError) do
|
||||||
|
doc.root.children.first.value
|
||||||
|
end
|
||||||
|
assert_equal(101, doc.entity_expansion_count)
|
||||||
end
|
end
|
||||||
REXML::Security.entity_expansion_limit = 100
|
|
||||||
assert_equal(100, REXML::Security.entity_expansion_limit)
|
|
||||||
doc = REXML::Document.new(xml)
|
|
||||||
assert_raise(RuntimeError) do
|
|
||||||
doc.root.children.first.value
|
|
||||||
end
|
|
||||||
assert_equal(101, doc.entity_expansion_count)
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_empty_value
|
def test_empty_value
|
||||||
xml = <<EOF
|
xml = <<EOF
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE member [
|
<!DOCTYPE member [
|
||||||
<!ENTITY a "&b;&b;&b;&b;&b;&b;&b;&b;&b;&b;">
|
<!ENTITY a "&b;&b;&b;&b;&b;&b;&b;&b;&b;&b;">
|
||||||
|
@ -89,21 +89,21 @@ EOF
|
||||||
</member>
|
</member>
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
doc = REXML::Document.new(xml)
|
doc = REXML::Document.new(xml)
|
||||||
assert_raise(RuntimeError) do
|
assert_raise(RuntimeError) do
|
||||||
doc.root.children.first.value
|
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)
|
||||||
|
assert_raise(RuntimeError) do
|
||||||
|
doc.root.children.first.value
|
||||||
|
end
|
||||||
|
assert_equal(101, doc.entity_expansion_count)
|
||||||
end
|
end
|
||||||
REXML::Security.entity_expansion_limit = 100
|
|
||||||
assert_equal(100, REXML::Security.entity_expansion_limit)
|
|
||||||
doc = REXML::Document.new(xml)
|
|
||||||
assert_raise(RuntimeError) do
|
|
||||||
doc.root.children.first.value
|
|
||||||
end
|
|
||||||
assert_equal(101, doc.entity_expansion_count)
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_with_default_entity
|
def test_with_default_entity
|
||||||
xml = <<EOF
|
xml = <<EOF
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE member [
|
<!DOCTYPE member [
|
||||||
<!ENTITY a "a">
|
<!ENTITY a "a">
|
||||||
|
@ -116,20 +116,20 @@ EOF
|
||||||
</member>
|
</member>
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
REXML::Security.entity_expansion_limit = 4
|
REXML::Security.entity_expansion_limit = 4
|
||||||
doc = REXML::Document.new(xml)
|
doc = REXML::Document.new(xml)
|
||||||
assert_equal("\na\na a\n<\n", doc.root.children.first.value)
|
assert_equal("\na\na a\n<\n", doc.root.children.first.value)
|
||||||
REXML::Security.entity_expansion_limit = 3
|
REXML::Security.entity_expansion_limit = 3
|
||||||
doc = REXML::Document.new(xml)
|
doc = REXML::Document.new(xml)
|
||||||
assert_raise(RuntimeError) do
|
assert_raise(RuntimeError) do
|
||||||
doc.root.children.first.value
|
doc.root.children.first.value
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
class ParameterEntityTest < self
|
class ParameterEntityTest < self
|
||||||
def test_have_value
|
def test_have_value
|
||||||
xml = <<EOF
|
xml = <<EOF
|
||||||
<!DOCTYPE root [
|
<!DOCTYPE root [
|
||||||
<!ENTITY % a "BOOM.BOOM.BOOM.BOOM.BOOM.BOOM.BOOM.BOOM.BOOM.">
|
<!ENTITY % a "BOOM.BOOM.BOOM.BOOM.BOOM.BOOM.BOOM.BOOM.BOOM.">
|
||||||
<!ENTITY % b "%a;%a;%a;%a;%a;%a;%a;%a;%a;%a;%a;%a;%a;%a;%a;">
|
<!ENTITY % b "%a;%a;%a;%a;%a;%a;%a;%a;%a;%a;%a;%a;%a;%a;%a;">
|
||||||
|
@ -143,18 +143,18 @@ EOF
|
||||||
<cd></cd>
|
<cd></cd>
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
assert_raise(REXML::ParseException) do
|
assert_raise(REXML::ParseException) do
|
||||||
REXML::Document.new(xml)
|
REXML::Document.new(xml)
|
||||||
|
end
|
||||||
|
REXML::Security.entity_expansion_limit = 100
|
||||||
|
assert_equal(100, REXML::Security.entity_expansion_limit)
|
||||||
|
assert_raise(REXML::ParseException) do
|
||||||
|
REXML::Document.new(xml)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
REXML::Security.entity_expansion_limit = 100
|
|
||||||
assert_equal(100, REXML::Security.entity_expansion_limit)
|
|
||||||
assert_raise(REXML::ParseException) do
|
|
||||||
REXML::Document.new(xml)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_empty_value
|
def test_empty_value
|
||||||
xml = <<EOF
|
xml = <<EOF
|
||||||
<!DOCTYPE root [
|
<!DOCTYPE root [
|
||||||
<!ENTITY % a "">
|
<!ENTITY % a "">
|
||||||
<!ENTITY % b "%a;%a;%a;%a;%a;%a;%a;%a;%a;%a;%a;%a;%a;%a;%a;">
|
<!ENTITY % b "%a;%a;%a;%a;%a;%a;%a;%a;%a;%a;%a;%a;%a;%a;%a;">
|
||||||
|
@ -168,17 +168,17 @@ EOF
|
||||||
<cd></cd>
|
<cd></cd>
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
assert_raise(REXML::ParseException) do
|
assert_raise(REXML::ParseException) do
|
||||||
REXML::Document.new(xml)
|
REXML::Document.new(xml)
|
||||||
end
|
end
|
||||||
REXML::Security.entity_expansion_limit = 100
|
REXML::Security.entity_expansion_limit = 100
|
||||||
assert_equal(100, REXML::Security.entity_expansion_limit)
|
assert_equal(100, REXML::Security.entity_expansion_limit)
|
||||||
assert_raise(REXML::ParseException) do
|
assert_raise(REXML::ParseException) do
|
||||||
REXML::Document.new(xml)
|
REXML::Document.new(xml)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def test_tag_in_cdata_with_not_ascii_only_but_ascii8bit_encoding_source
|
def test_tag_in_cdata_with_not_ascii_only_but_ascii8bit_encoding_source
|
||||||
tag = "<b>...</b>"
|
tag = "<b>...</b>"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue