diff options
Diffstat (limited to 'test/rexml/parse')
-rw-r--r-- | test/rexml/parse/test_document_type_declaration.rb | 50 | ||||
-rw-r--r-- | test/rexml/parse/test_element.rb | 51 | ||||
-rw-r--r-- | test/rexml/parse/test_notation_declaration.rb | 100 | ||||
-rw-r--r-- | test/rexml/parse/test_processing_instruction.rb | 25 |
4 files changed, 0 insertions, 226 deletions
diff --git a/test/rexml/parse/test_document_type_declaration.rb b/test/rexml/parse/test_document_type_declaration.rb deleted file mode 100644 index 80f70888fb..0000000000 --- a/test/rexml/parse/test_document_type_declaration.rb +++ /dev/null @@ -1,50 +0,0 @@ -# frozen_string_literal: false -require "test/unit" -require "rexml/document" - -module REXMLTests - class TestParseDocumentTypeDeclaration < Test::Unit::TestCase - private - def xml(internal_subset) - <<-XML -<!DOCTYPE r SYSTEM "urn:x-rexml:test" [ -#{internal_subset} -]> -<r/> - XML - end - - def parse(internal_subset) - REXML::Document.new(xml(internal_subset)).doctype - end - - class TestMixed < self - def test_entity_element - doctype = parse(<<-INTERNAL_SUBSET) -<!ENTITY entity-name "entity content"> -<!ELEMENT element-name EMPTY> - INTERNAL_SUBSET - assert_equal([REXML::Entity, REXML::ElementDecl], - doctype.children.collect(&:class)) - end - - def test_attlist_entity - doctype = parse(<<-INTERNAL_SUBSET) -<!ATTLIST attribute-list-name attribute-name CDATA #REQUIRED> -<!ENTITY entity-name "entity content"> - INTERNAL_SUBSET - assert_equal([REXML::AttlistDecl, REXML::Entity], - doctype.children.collect(&:class)) - end - - def test_notation_attlist - doctype = parse(<<-INTERNAL_SUBSET) -<!NOTATION notation-name SYSTEM "system-literal"> -<!ATTLIST attribute-list-name attribute-name CDATA #REQUIRED> - INTERNAL_SUBSET - assert_equal([REXML::NotationDecl, REXML::AttlistDecl], - doctype.children.collect(&:class)) - end - end - end -end diff --git a/test/rexml/parse/test_element.rb b/test/rexml/parse/test_element.rb deleted file mode 100644 index 7322e0eb4e..0000000000 --- a/test/rexml/parse/test_element.rb +++ /dev/null @@ -1,51 +0,0 @@ -require "test/unit" -require "rexml/document" - -module REXMLTests - class TestParseElement < Test::Unit::TestCase - def parse(xml) - REXML::Document.new(xml) - end - - class TestInvalid < self - def test_top_level_end_tag - exception = assert_raise(REXML::ParseException) do - parse("</a>") - end - assert_equal(<<-DETAIL.chomp, exception.to_s) -Unexpected top-level end tag (got 'a') -Line: 1 -Position: 4 -Last 80 unconsumed characters: - - DETAIL - end - - def test_no_end_tag - exception = assert_raise(REXML::ParseException) do - parse("<a></") - end - assert_equal(<<-DETAIL.chomp, exception.to_s) -Missing end tag for 'a' -Line: 1 -Position: 5 -Last 80 unconsumed characters: -</ - DETAIL - end - - def test_empty_namespace_attribute_name - exception = assert_raise(REXML::ParseException) do - parse("<x :a=\"\"></x>") - end - assert_equal(<<-DETAIL.chomp, exception.to_s) -Invalid attribute name: <:a=""> -Line: 1 -Position: 9 -Last 80 unconsumed characters: - - DETAIL - end - end - end -end diff --git a/test/rexml/parse/test_notation_declaration.rb b/test/rexml/parse/test_notation_declaration.rb deleted file mode 100644 index 0d29f0d81f..0000000000 --- a/test/rexml/parse/test_notation_declaration.rb +++ /dev/null @@ -1,100 +0,0 @@ -# frozen_string_literal: false -require 'test/unit' -require 'rexml/document' - -module REXMLTests - class TestParseNotationDeclaration < Test::Unit::TestCase - private - def xml(internal_subset) - <<-XML -<!DOCTYPE r SYSTEM "urn:x-henrikmartensson:test" [ -#{internal_subset} -]> -<r/> - XML - end - - def parse(internal_subset) - REXML::Document.new(xml(internal_subset)).doctype - end - - class TestCommon < self - def test_name - doctype = parse("<!NOTATION name PUBLIC 'urn:public-id'>") - assert_equal("name", doctype.notation("name").name) - end - end - - class TestExternalID < self - class TestSystem < self - def test_single_quote - doctype = parse(<<-INTERNAL_SUBSET) -<!NOTATION name SYSTEM 'system-literal'> - INTERNAL_SUBSET - assert_equal("system-literal", doctype.notation("name").system) - end - - def test_double_quote - doctype = parse(<<-INTERNAL_SUBSET) -<!NOTATION name SYSTEM "system-literal"> - INTERNAL_SUBSET - assert_equal("system-literal", doctype.notation("name").system) - end - end - - class TestPublic < self - class TestPublicIDLiteral < self - def test_single_quote - doctype = parse(<<-INTERNAL_SUBSET) -<!NOTATION name PUBLIC 'public-id-literal' "system-literal"> - INTERNAL_SUBSET - assert_equal("public-id-literal", doctype.notation("name").public) - end - - def test_double_quote - doctype = parse(<<-INTERNAL_SUBSET) -<!NOTATION name PUBLIC "public-id-literal" "system-literal"> - INTERNAL_SUBSET - assert_equal("public-id-literal", doctype.notation("name").public) - end - end - - class TestSystemLiteral < self - def test_single_quote - doctype = parse(<<-INTERNAL_SUBSET) -<!NOTATION name PUBLIC "public-id-literal" 'system-literal'> - INTERNAL_SUBSET - assert_equal("system-literal", doctype.notation("name").system) - end - - def test_double_quote - doctype = parse(<<-INTERNAL_SUBSET) -<!NOTATION name PUBLIC "public-id-literal" "system-literal"> - INTERNAL_SUBSET - assert_equal("system-literal", doctype.notation("name").system) - end - end - end - - class TestMixed < self - def test_system_public - doctype = parse(<<-INTERNAL_SUBSET) -<!NOTATION system-name SYSTEM "system-literal"> -<!NOTATION public-name PUBLIC "public-id-literal" 'system-literal'> - INTERNAL_SUBSET - assert_equal(["system-name", "public-name"], - doctype.notations.collect(&:name)) - end - - def test_public_system - doctype = parse(<<-INTERNAL_SUBSET) -<!NOTATION public-name PUBLIC "public-id-literal" 'system-literal'> -<!NOTATION system-name SYSTEM "system-literal"> - INTERNAL_SUBSET - assert_equal(["public-name", "system-name"], - doctype.notations.collect(&:name)) - end - end - end - end -end diff --git a/test/rexml/parse/test_processing_instruction.rb b/test/rexml/parse/test_processing_instruction.rb deleted file mode 100644 index a23513fc6e..0000000000 --- a/test/rexml/parse/test_processing_instruction.rb +++ /dev/null @@ -1,25 +0,0 @@ -require "test/unit" -require "rexml/document" - -module REXMLTests - class TestParseProcessinInstruction < Test::Unit::TestCase - def parse(xml) - REXML::Document.new(xml) - end - - class TestInvalid < self - def test_no_name - exception = assert_raise(REXML::ParseException) do - parse("<??>") - end - assert_equal(<<-DETAIL.chomp, exception.to_s) -Invalid processing instruction node -Line: 1 -Position: 4 -Last 80 unconsumed characters: -<??> - DETAIL - end - end - end -end |