Sha256: 4650bc07bff242f127595d0224fdd5d4983841c8034932d0352cd9e03d1cbd69
Contents?: true
Size: 1.78 KB
Versions: 49
Compression:
Stored size: 1.78 KB
Contents
require "helper" module Nokogiri module XML class TestAttributeDecl < Nokogiri::TestCase def setup super @xml = Nokogiri::XML(<<-eoxml) <?xml version="1.0"?><?TEST-STYLE PIDATA?> <!DOCTYPE staff SYSTEM "staff.dtd" [ <!ATTLIST br width CDATA "0"> <!ATTLIST a width CDATA > <!ATTLIST payment type (check|cash) "cash"> ]> <root /> eoxml @attrs = @xml.internal_subset.children @attr_decl = @attrs.first end def test_inspect assert_equal( "#<#{@attr_decl.class.name}:#{sprintf("0x%x", @attr_decl.object_id)} #{@attr_decl.to_s.inspect}>", @attr_decl.inspect ) end def test_type assert_equal 16, @attr_decl.type end def test_class assert_instance_of Nokogiri::XML::AttributeDecl, @attr_decl end def test_content assert_raise NoMethodError do @attr_decl.content end end def test_attributes assert_raise NoMethodError do @attr_decl.attributes end end def test_namespace assert_raise NoMethodError do @attr_decl.namespace end end def test_namespace_definitions assert_raise NoMethodError do @attr_decl.namespace_definitions end end def test_line assert_raise NoMethodError do @attr_decl.line end end def test_attribute_type assert_equal 1, @attr_decl.attribute_type end def test_default assert_equal '0', @attr_decl.default assert_nil @attrs[1].default end def test_enumeration assert_equal [], @attr_decl.enumeration assert_equal ['check', 'cash'], @attrs[2].enumeration end end end end
Version data entries
49 entries across 49 versions & 8 rubygems