root / test / test_xml_declaration_parent_child.rb

Revision 549:e07d72733cae, 0.8 kB (checked in by Sean Russell <ser@…>, 5 months ago)

Moved and renamed files to conform to Ruby's test suite.

Line 
1#!/usr/bin/env ruby
2#
3#  Created by Henrik MÃ¥rtensson on 2007-02-18.
4#  Copyright (c) 2007. All rights reserved.
5
6require "rexml/document"
7require "test/unit"
8
9class TestXmlDeclaration < Test::Unit::TestCase
10  def setup
11    xml = <<-'END_XML'
12    <?xml encoding= 'UTF-8' standalone='yes'?>
13    <root>
14    </root>
15    END_XML
16    @doc = REXML::Document.new xml
17    @root = @doc.root
18    @xml_declaration = @doc.children[0]
19  end
20 
21  def test_xml_declaration_is_first_child
22    assert_kind_of(REXML::XMLDecl, @xml_declaration)
23  end
24 
25  def test_xml_declaration_has_document_as_parent
26   assert_kind_of(REXML::Document, @xml_declaration.parent)
27  end
28 
29  def test_xml_declaration_has_sibling
30    assert_kind_of(REXML::XMLDecl, @root.previous_sibling.previous_sibling)
31    assert_kind_of(REXML::Element, @xml_declaration.next_sibling.next_sibling)
32  end
33end
Note: See TracBrowser for help on using the browser.