aboutsummaryrefslogtreecommitdiffstats
path: root/test/rexml/test_xml_declaration.rb
diff options
context:
space:
mode:
authorkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-03 03:05:28 +0000
committerkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-03 03:05:28 +0000
commit9a2dc8f9da2b344c91dcd8c66223fa11412ec78b (patch)
treeb1935a3e21c91ff78bcb49aa0ac97aeac111b2c0 /test/rexml/test_xml_declaration.rb
parent63e9bc50f563dd0cddbdf957e27c3159aac49249 (diff)
downloadruby-9a2dc8f9da2b344c91dcd8c66223fa11412ec78b.tar.gz
* test/rexml/test_xml_declaration_parent_child.rb: Rename to ...
* test/rexml/test_xml_declaration.rb: ... this. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37436 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rexml/test_xml_declaration.rb')
-rw-r--r--test/rexml/test_xml_declaration.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/rexml/test_xml_declaration.rb b/test/rexml/test_xml_declaration.rb
new file mode 100644
index 0000000000..d883e105c1
--- /dev/null
+++ b/test/rexml/test_xml_declaration.rb
@@ -0,0 +1,33 @@
+#!/usr/bin/env ruby
+#
+# Created by Henrik MÃ¥rtensson on 2007-02-18.
+# Copyright (c) 2007. All rights reserved.
+
+require "rexml/document"
+require "test/unit"
+
+class TestXmlDeclaration < Test::Unit::TestCase
+ def setup
+ xml = <<-'END_XML'
+ <?xml encoding= 'UTF-8' standalone='yes'?>
+ <root>
+ </root>
+ END_XML
+ @doc = REXML::Document.new xml
+ @root = @doc.root
+ @xml_declaration = @doc.children[0]
+ end
+
+ def test_xml_declaration_is_first_child
+ assert_kind_of(REXML::XMLDecl, @xml_declaration)
+ end
+
+ def test_xml_declaration_has_document_as_parent
+ assert_kind_of(REXML::Document, @xml_declaration.parent)
+ end
+
+ def test_xml_declaration_has_sibling
+ assert_kind_of(REXML::XMLDecl, @root.previous_sibling.previous_sibling)
+ assert_kind_of(REXML::Element, @xml_declaration.next_sibling.next_sibling)
+ end
+end