summaryrefslogtreecommitdiff
path: root/jni/ruby/test/rexml/parse/test_document_type_declaration.rb
diff options
context:
space:
mode:
authorJari Vetoniemi <jari.vetoniemi@indooratlas.com>2020-03-16 18:49:26 +0900
committerJari Vetoniemi <jari.vetoniemi@indooratlas.com>2020-03-30 00:39:06 +0900
commitfcbf63e62c627deae76c1b8cb8c0876c536ed811 (patch)
tree64cb17de3f41a2b6fef2368028fbd00349946994 /jni/ruby/test/rexml/parse/test_document_type_declaration.rb
Fresh start
Diffstat (limited to 'jni/ruby/test/rexml/parse/test_document_type_declaration.rb')
-rw-r--r--jni/ruby/test/rexml/parse/test_document_type_declaration.rb49
1 files changed, 49 insertions, 0 deletions
diff --git a/jni/ruby/test/rexml/parse/test_document_type_declaration.rb b/jni/ruby/test/rexml/parse/test_document_type_declaration.rb
new file mode 100644
index 0000000..59fe561
--- /dev/null
+++ b/jni/ruby/test/rexml/parse/test_document_type_declaration.rb
@@ -0,0 +1,49 @@
+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