From 8a4567b207ab7dec4b2d01cc8708824538f4abe9 Mon Sep 17 00:00:00 2001 From: kou Date: Sat, 10 Aug 2013 03:40:58 +0000 Subject: [PATCH] * test/rexml/parse/test_document_type_declaration.rb: Add tests for parsing document type declaration. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 ++ .../parse/test_document_type_declaration.rb | 47 +++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 test/rexml/parse/test_document_type_declaration.rb diff --git a/ChangeLog b/ChangeLog index b43c55bd27..fc25ed4314 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Aug 10 12:39:00 2013 Kouhei Sutou + + * test/rexml/parse/test_document_type_declaration.rb: Add tests for + parsing document type declaration. + Sat Aug 10 12:00:45 2013 Kouhei Sutou * lib/rexml/parsers/baseparser.rb (REXML::Parsers::BaseParser::SYSTEM): diff --git a/test/rexml/parse/test_document_type_declaration.rb b/test/rexml/parse/test_document_type_declaration.rb new file mode 100644 index 0000000000..7d527a5fe8 --- /dev/null +++ b/test/rexml/parse/test_document_type_declaration.rb @@ -0,0 +1,47 @@ +require "test/unit" +require "rexml/document" + +class TestParseDocumentTypeDeclaration < Test::Unit::TestCase + private + def xml(internal_subset) + <<-XML + + + 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) + + + INTERNAL_SUBSET + assert_equal([REXML::Entity, REXML::ElementDecl], + doctype.children.collect(&:class)) + end + + def test_attlist_entity + doctype = parse(<<-INTERNAL_SUBSET) + + + INTERNAL_SUBSET + assert_equal([REXML::AttlistDecl, REXML::Entity], + doctype.children.collect(&:class)) + end + + def test_notation_attlist + doctype = parse(<<-INTERNAL_SUBSET) + + + INTERNAL_SUBSET + assert_equal([REXML::NotationDecl, REXML::AttlistDecl], + doctype.children.collect(&:class)) + end + end +end