Sha256: 53f9c5a1ca13fb273c84275fde8432d2e80ce5afb7cee8f96c1627e59c7161c4

Contents?: true

Size: 1006 Bytes

Versions: 40

Compression:

Stored size: 1006 Bytes

Contents

# encoding: UTF-8

require './test_helper'

require 'test/unit'

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

class Testattributes < 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
    attributes = @doc.root.attributes
    
    assert_instance_of(XML::Attributes, attributes)
    attribute = attributes.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_attributes
    attributes = @doc.root.child.attributes
    assert_instance_of(XML::Attributes, attributes)
    assert_equal(0, attributes.length)
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
libxml-ruby-2.1.2-x86-mingw32 test/tc_properties.rb
libxml-ruby-2.1.2 test/tc_properties.rb
libxml-ruby-2.1.1-x86-mingw32 test/tc_properties.rb
libxml-ruby-2.1.1 test/tc_properties.rb
libxml-ruby-2.1.0-x86-mingw32 test/tc_properties.rb
libxml-ruby-2.1.0 test/tc_properties.rb
libxml-ruby-2.0.9-x86-mingw32 test/tc_properties.rb
libxml-ruby-2.0.9 test/tc_properties.rb
libxml-ruby-2.0.6-x86-mingw32 test/tc_properties.rb
libxml-ruby-2.0.6 test/tc_properties.rb
libxml-ruby-2.0.5-x86-mingw32 test/tc_properties.rb
libxml-ruby-2.0.5 test/tc_properties.rb
libxml-ruby-2.0.4-x86-mingw32 test/tc_properties.rb
libxml-ruby-2.0.4 test/tc_properties.rb
libxml-ruby-2.0.3-x86-mingw32 test/tc_properties.rb
libxml-ruby-2.0.3 test/tc_properties.rb
libxml-ruby-2.0.2-x86-mingw32 test/tc_properties.rb
libxml-ruby-2.0.2 test/tc_properties.rb
libxml-ruby-2.0.0-x86-mingw32 test/tc_properties.rb
libxml-ruby-2.0.0 test/tc_properties.rb