File: tc_xml_document_write2.rb

package info (click to toggle)
libxml-ruby 0.5.2.0-3%2Blenny1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 652 kB
  • ctags: 875
  • sloc: ansic: 5,874; ruby: 1,524; xml: 144; makefile: 9
file content (55 lines) | stat: -rw-r--r-- 1,943 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# $Id: tc_xml_document_write2.rb 67 2006-04-17 13:30:22Z roscopeco $
require "libxml_test"
require 'test/unit'

class TC_XML_Document_Write2 < Test::Unit::TestCase
  def setup()
    @doc = XML::Document.new('1.0')
    assert_instance_of(XML::Document, @doc)
  end

  def teardown()
    @doc = nil
  end

  def test_ruby_xml_document_write_root()
    xml = "<?xml version=\"1.0\"?>\n<rubynet/>\n"
    @doc.root = XML::Node.new('rubynet')
    assert_instance_of(XML::Node, @doc.root)
    assert_instance_of(XML::Document, @doc.root.doc)
    assert_equal(xml, @doc.to_s)
  end # def test_ruby_xml_document_write_root()

  def test_ruby_xml_document_write_root2()
    xml = "<?xml version=\"1.0\"?>\n<rubynet/>\n"
    @doc.root = XML::Node.new('rubynet')
    assert_instance_of(XML::Node, @doc.root)
    assert_instance_of(XML::Document, @doc.root.doc)
    assert_equal(xml, @doc.to_s(false))
  end # def test_ruby_xml_document_write_root()

  def test_ruby_xml_document_write_root3()
    xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rubynet/>\n"
    @doc.root = XML::Node.new('rubynet')
    @doc.encoding = 'UTF-8'
    assert_instance_of(XML::Node, @doc.root)
    assert_instance_of(XML::Document, @doc.root.doc)
    assert_equal(xml, @doc.to_s)
  end # def test_ruby_xml_document_write_root()

  def test_ruby_xml_document_write_root4()
    xml = "<?xml version=\"1.0\"?>\n<rubynet/>\n"
    @doc.root = XML::Node.new('rubynet')
    assert_instance_of(XML::Node, @doc.root)
    assert_instance_of(XML::Document, @doc.root.doc)
    assert_equal(xml, @doc.to_s(false))
  end # def test_ruby_xml_document_write_root()

  def test_ruby_xml_document_write_root5()
    xml = "<?xml version=\"1.0\"?>\n<rubynet/>\n"
    @doc.root = XML::Node.new('rubynet')
    assert_instance_of(XML::Node, @doc.root)
    assert_instance_of(XML::Document, @doc.root.doc)
    assert_equal(xml, @doc.to_s(true))
  end # def test_ruby_xml_document_write_root()
end