Sha256: 7f0b3d70f76f0571693619e2a5b78c3d1d2f54f2ac51d6c57c67137a2ae7bac0

Contents?: true

Size: 992 Bytes

Versions: 5

Compression:

Stored size: 992 Bytes

Contents

require "xml"
require 'test/unit'

# Properties is deprecated - use attributes instead.
# Tests for backwards compatibility

class TestProperties < 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
  end

  def teardown()
    @doc = nil
  end

  def test_traversal
    properties = @doc.root.properties
    
    assert_instance_of(XML::Attributes, properties)
    # FIXME ordering of Attributes
    # attribute = properties.first
    # assert_equal('uga', attribute.name)
    # assert_equal('booga', attribute.value)
    # 
    # attribute = attribute.next
    # assert_instance_of(XML::Attr, attribute)
    # assert_equal('foo', attribute.name)
    # assert_equal('bar', attribute.value)
  end
  
  def test_no_properties
    properties = @doc.root.child.properties
    assert_instance_of(XML::Attributes, properties)
    assert_equal(0, properties.length)
  end
end

Version data entries

5 entries across 5 versions & 4 rubygems

Version Path
libxml-jruby-modified-1.0.2-jruby test/tc_properties.rb
libxml-jruby-modified-1.0.1-jruby test/tc_properties.rb
libxml-fixed-jruby-1.0.0-jruby test/tc_properties.rb
libxml-jruby-fixed-1.0.0-jruby test/tc_properties.rb
libxml-jruby-1.0.0 test/tc_properties.rb