File: tc_xml_node7.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 (36 lines) | stat: -rw-r--r-- 914 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
# $Id: tc_xml_node7.rb 123 2006-11-27 10:41:14Z roscopeco $
require "libxml_test"
require 'test/unit'

class TC_XML_Node7 < Test::Unit::TestCase
  def setup()
    xp = XML::Parser.string('<ruby_array uga="booga" foo="bar"><fixnum>one</fixnum><fixnum>two</fixnum></ruby_array>')
    doc = xp.parse
    @root = doc.root
    assert_equal 'bar', @root['foo']
  end

  def teardown()
    @root = nil
  end

  def test_xml_node_properties_traversal_bug()
    prop = @root.properties
    assert_instance_of XML::Attr, prop
    assert_equal 'uga', prop.name
    assert_equal 'booga', prop.value
    
    prop = prop.next
    assert_instance_of XML::Attr, prop
    assert_equal 'foo', prop.name
    assert_equal 'bar', prop.value    
  end
  
  def test_xml_node_properties_when_no_attributes
    xp = XML::Parser.string("<root></root>")
    doc = xp.parse
    root = doc.root
    
    assert_nil root.properties
  end
end