[前][次][番号順一覧][スレッド一覧]

ruby-changes:30407

From: kou <ko1@a...>
Date: Sat, 10 Aug 2013 12:41:05 +0900 (JST)
Subject: [ruby-changes:30407] kou:r42486 (trunk): * test/rexml/parse/test_document_type_declaration.rb: Add tests for

kou	2013-08-10 12:40:58 +0900 (Sat, 10 Aug 2013)

  New Revision: 42486

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42486

  Log:
    * test/rexml/parse/test_document_type_declaration.rb: Add tests for
      parsing document type declaration.

  Added files:
    trunk/test/rexml/parse/test_document_type_declaration.rb
  Modified files:
    trunk/ChangeLog
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 42485)
+++ ChangeLog	(revision 42486)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Aug 10 12:39:00 2013  Kouhei Sutou  <kou@c...>
+
+	* test/rexml/parse/test_document_type_declaration.rb: Add tests for
+	  parsing document type declaration.
+
 Sat Aug 10 12:00:45 2013  Kouhei Sutou  <kou@c...>
 
 	* lib/rexml/parsers/baseparser.rb (REXML::Parsers::BaseParser::SYSTEM):
Index: test/rexml/parse/test_document_type_declaration.rb
===================================================================
--- test/rexml/parse/test_document_type_declaration.rb	(revision 0)
+++ test/rexml/parse/test_document_type_declaration.rb	(revision 42486)
@@ -0,0 +1,47 @@ https://github.com/ruby/ruby/blob/trunk/test/rexml/parse/test_document_type_declaration.rb#L1
+require "test/unit"
+require "rexml/document"
+
+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

Property changes on: test/rexml/parse/test_document_type_declaration.rb
___________________________________________________________________
Added: svn:eol-style
   + LF


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]