From eb20de889cd25999f0a2cd04337918150569b371 Mon Sep 17 00:00:00 2001 From: kou Date: Tue, 7 Dec 2010 11:30:19 +0000 Subject: * test/rexml/test_doctype_mixin.rb: rename to ... * test/rexml/test_doctype.rb: ... this to remove needless name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/rexml/test_doctype.rb | 67 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 test/rexml/test_doctype.rb (limited to 'test/rexml/test_doctype.rb') diff --git a/test/rexml/test_doctype.rb b/test/rexml/test_doctype.rb new file mode 100644 index 0000000000..78014bb5da --- /dev/null +++ b/test/rexml/test_doctype.rb @@ -0,0 +1,67 @@ +#! /usr/local/bin/ruby + + +require 'test/unit' +require 'rexml/document' + +class TestDoctype < Test::Unit::TestCase + + def setup + @sysid = "urn:x-test:sysid1" + @notid1 = "urn:x-test:notation1" + @notid2 = "urn:x-test:notation2" + document_string1 = <<-"XMLEND" + + + ]> + + XMLEND + @doctype1 = REXML::Document.new(document_string1).doctype + + @pubid = "TEST_ID" + document_string2 = <<-"XMLEND" + + + XMLEND + @doctype2 = REXML::Document.new(document_string2).doctype + + document_string3 = <<-"XMLEND" + + + XMLEND + @doctype3 = REXML::Document.new(document_string3).doctype + + end + + def test_public + assert_equal(nil, @doctype1.public) + assert_equal(@pubid, @doctype2.public) + assert_equal(@pubid, @doctype3.public) + end + + def test_system + assert_equal(@sysid, @doctype1.system) + assert_equal(nil, @doctype2.system) + assert_equal(@sysid, @doctype3.system) + end + + def test_notation + assert_equal(@notid1, @doctype1.notation("n1").system) + assert_equal(@notid2, @doctype1.notation("n2").system) + end + + def test_notations + notations = @doctype1.notations + assert_equal(2, notations.length) + assert_equal(@notid1, find_notation(notations, "n1").system) + assert_equal(@notid2, find_notation(notations, "n2").system) + end + + def find_notation(notations, name) + notations.find { |notation| + name == notation.name + } + end + +end -- cgit v1.2.3