aboutsummaryrefslogtreecommitdiffstats
path: root/test/rexml/test_doctype.rb
diff options
context:
space:
mode:
authorkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-27 13:10:55 +0000
committerkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-27 13:10:55 +0000
commitba3d2f4ac20bec871fe96a393d923d0cbb0fd96a (patch)
tree897a0308607db1dad21eef1fee86b351e93ebfa5 /test/rexml/test_doctype.rb
parent313fa180333a1eb4d1fa1542930e83f8d77e6b2d (diff)
downloadruby-ba3d2f4ac20bec871fe96a393d923d0cbb0fd96a.tar.gz
* test/rexml/test_contrib.rb: Indent.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rexml/test_doctype.rb')
-rw-r--r--test/rexml/test_doctype.rb190
1 files changed, 95 insertions, 95 deletions
diff --git a/test/rexml/test_doctype.rb b/test/rexml/test_doctype.rb
index 63c2ed9ada..0b3ea11929 100644
--- a/test/rexml/test_doctype.rb
+++ b/test/rexml/test_doctype.rb
@@ -2,105 +2,105 @@ require 'test/unit'
require 'rexml/document'
module REXMLTests
-class TestDocTypeAccessor < Test::Unit::TestCase
-
- def setup
- @sysid = "urn:x-test:sysid1"
- @notid1 = "urn:x-test:notation1"
- @notid2 = "urn:x-test:notation2"
- document_string1 = <<-"XMLEND"
- <!DOCTYPE r SYSTEM "#{@sysid}" [
- <!NOTATION n1 SYSTEM "#{@notid1}">
- <!NOTATION n2 SYSTEM "#{@notid2}">
- ]>
- <r/>
- XMLEND
- @doctype1 = REXML::Document.new(document_string1).doctype
-
- @pubid = "TEST_ID"
- document_string2 = <<-"XMLEND"
- <!DOCTYPE r PUBLIC "#{@pubid}">
- <r/>
- XMLEND
- @doctype2 = REXML::Document.new(document_string2).doctype
-
- document_string3 = <<-"XMLEND"
- <!DOCTYPE r PUBLIC "#{@pubid}" "#{@sysid}">
- <r/>
- XMLEND
- @doctype3 = REXML::Document.new(document_string3).doctype
+ class TestDocTypeAccessor < Test::Unit::TestCase
+
+ def setup
+ @sysid = "urn:x-test:sysid1"
+ @notid1 = "urn:x-test:notation1"
+ @notid2 = "urn:x-test:notation2"
+ document_string1 = <<-"XMLEND"
+ <!DOCTYPE r SYSTEM "#{@sysid}" [
+ <!NOTATION n1 SYSTEM "#{@notid1}">
+ <!NOTATION n2 SYSTEM "#{@notid2}">
+ ]>
+ <r/>
+ XMLEND
+ @doctype1 = REXML::Document.new(document_string1).doctype
+
+ @pubid = "TEST_ID"
+ document_string2 = <<-"XMLEND"
+ <!DOCTYPE r PUBLIC "#{@pubid}">
+ <r/>
+ XMLEND
+ @doctype2 = REXML::Document.new(document_string2).doctype
+
+ document_string3 = <<-"XMLEND"
+ <!DOCTYPE r PUBLIC "#{@pubid}" "#{@sysid}">
+ <r/>
+ 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
- def test_public
- assert_equal(nil, @doctype1.public)
- assert_equal(@pubid, @doctype2.public)
- assert_equal(@pubid, @doctype3.public)
+ class TestNotationDeclPublic < Test::Unit::TestCase
+ def setup
+ @name = "vrml"
+ @id = "VRML 1.0"
+ @uri = "http://www.web3d.org/"
+ end
+
+ def test_to_s
+ assert_equal("<!NOTATION #{@name} PUBLIC \"#{@id}\">",
+ decl(@id, nil).to_s)
+ end
+
+ def test_to_s_with_uri
+ assert_equal("<!NOTATION #{@name} PUBLIC \"#{@id}\" \"#{@uri}\">",
+ decl(@id, @uri).to_s)
+ end
+
+ private
+ def decl(id, uri)
+ REXML::NotationDecl.new(@name, "PUBLIC", id, uri)
+ end
end
- def test_system
- assert_equal(@sysid, @doctype1.system)
- assert_equal(nil, @doctype2.system)
- assert_equal(@sysid, @doctype3.system)
+ class TestNotationDeclSystem < Test::Unit::TestCase
+ def setup
+ @name = "gif"
+ @id = "gif viewer"
+ end
+
+ def test_to_s
+ assert_equal("<!NOTATION #{@name} SYSTEM \"#{@id}\">",
+ decl(@id).to_s)
+ end
+
+ private
+ def decl(id)
+ REXML::NotationDecl.new(@name, "SYSTEM", id, nil)
+ end
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
-
-class TestNotationDeclPublic < Test::Unit::TestCase
- def setup
- @name = "vrml"
- @id = "VRML 1.0"
- @uri = "http://www.web3d.org/"
- end
-
- def test_to_s
- assert_equal("<!NOTATION #{@name} PUBLIC \"#{@id}\">",
- decl(@id, nil).to_s)
- end
-
- def test_to_s_with_uri
- assert_equal("<!NOTATION #{@name} PUBLIC \"#{@id}\" \"#{@uri}\">",
- decl(@id, @uri).to_s)
- end
-
- private
- def decl(id, uri)
- REXML::NotationDecl.new(@name, "PUBLIC", id, uri)
- end
-end
-
-class TestNotationDeclSystem < Test::Unit::TestCase
- def setup
- @name = "gif"
- @id = "gif viewer"
- end
-
- def test_to_s
- assert_equal("<!NOTATION #{@name} SYSTEM \"#{@id}\">",
- decl(@id).to_s)
- end
-
- private
- def decl(id)
- REXML::NotationDecl.new(@name, "SYSTEM", id, nil)
- end
-end
end