Sha256: 3a1a9581b0a146ac776bb194416eb396297eddef66c765d252030e88fccdb993

Contents?: true

Size: 979 Bytes

Versions: 4

Compression:

Stored size: 979 Bytes

Contents

# encoding: UTF-8

require './test_helper'


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

class Testattributes < Minitest::Test
  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

4 entries across 4 versions & 1 rubygems

Version Path
libxml-ruby-3.0.0-x64-mingw32 test/tc_properties.rb
libxml-ruby-3.0.0 test/tc_properties.rb
libxml-ruby-2.9.0-x64-mingw32 test/tc_properties.rb
libxml-ruby-2.9.0 test/tc_properties.rb