diff --git a/test/parse/test_entity_declaration.rb b/test/parse/test_entity_declaration.rb index 1442385d..e2dcb3e8 100644 --- a/test/parse/test_entity_declaration.rb +++ b/test/parse/test_entity_declaration.rb @@ -71,85 +71,85 @@ def test_prohibited_character valid-name \"% &\">]> DETAIL end + end - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-ExternalID - class TestExternalID < self - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-SystemLiteral - class TestSystemLiteral < self - def test_no_quote_in_system - exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') - end - assert_equal(<<-DETAIL.chomp, exception.to_s) + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-ExternalID + class TestExternalID < self + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-SystemLiteral + class TestSystemLiteral < self + def test_no_quote_in_system + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(']>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration Line: 1 Position: 68 Last 80 unconsumed characters: valid-name SYSTEM invalid-system-literal>]> - DETAIL - end + DETAIL + end - def test_no_quote_in_public - exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') - end - assert_equal(<<-DETAIL.chomp, exception.to_s) + def test_no_quote_in_public + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(']>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration Line: 1 Position: 90 Last 80 unconsumed characters: valid-name PUBLIC \"valid-pubid-literal\" invalid-system-literal>]> - DETAIL - end + DETAIL end + end - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PubidLiteral - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PubidChar - class TestPublicIDLiteral < self - def test_no_quote - exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') - end - assert_equal(<<-DETAIL.chomp, exception.to_s) + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PubidLiteral + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PubidChar + class TestPublicIDLiteral < self + def test_no_quote + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(']>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration Line: 1 Position: 90 Last 80 unconsumed characters: valid-name PUBLIC invalid-pubid-literal \"valid-system-literal\">]> - DETAIL - end + DETAIL + end - def test_invalid_pubid_char - exception = assert_raise(REXML::ParseException) do - # U+3042 HIRAGANA LETTER A - REXML::Document.new("]>") - end - assert_equal(<<-DETAIL.force_encoding('utf-8').chomp, exception.to_s.force_encoding('utf-8')) + def test_invalid_pubid_char + exception = assert_raise(REXML::ParseException) do + # U+3042 HIRAGANA LETTER A + REXML::Document.new("]>") + end + assert_equal(<<-DETAIL.force_encoding('utf-8').chomp, exception.to_s.force_encoding('utf-8')) Malformed entity declaration Line: 1 Position: 74 Last 80 unconsumed characters: valid-name PUBLIC \"\u3042\" \"valid-system-literal\">]> - DETAIL - end + DETAIL end end + end - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-NDataDecl - class TestNotationDataDeclaration < self - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-NameChar - def test_prohibited_character - exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') - end - assert_equal(<<-DETAIL.chomp, exception.to_s) + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-NDataDecl + class TestNotationDataDeclaration < self + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-NameChar + def test_prohibited_character + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(']>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration Line: 1 Position: 109 Last 80 unconsumed characters: valid-name PUBLIC \"valid-pubid-literal\" \"valid-system-literal\" NDATA invalid&nam - DETAIL - end + DETAIL end end end @@ -157,24 +157,24 @@ def test_prohibited_character # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PEDecl class TestParsedEntityDeclaration < self - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PEDef - class TestParsedEntityDefinition < self - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-Name - class TestName < self - def test_prohibited_character - exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') - end - assert_equal(<<-DETAIL.chomp, exception.to_s) + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-Name + class TestName < self + def test_prohibited_character + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(']>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration Line: 1 Position: 63 Last 80 unconsumed characters: % invalid&name \"valid-entity-value\">]> DETAIL - end end + end + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PEDef + class TestParsedEntityDefinition < self # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EntityValue class TestEntityValue < self def test_no_quote @@ -266,19 +266,19 @@ def test_invalid_pubid_char end end end - end - def test_unnecessary_ndata_declaration - exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') - end - assert_equal(<<-DETAIL.chomp, exception.to_s) + def test_unnecessary_ndata_declaration + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(']>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration Line: 1 Position: 85 Last 80 unconsumed characters: % valid-name \"valid-entity-value\" NDATA valid-ndata-value>]> DETAIL + end end end