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

Version Path
domo-0.0.4 vendor/bundle/ruby/1.9.1/gems/nokogiri-1.4.4/test/xml/test_attribute_decl.rb
nokogiri-1.4.7-java test/xml/test_attribute_decl.rb
nokogiri-1.4.7-x86-mingw32 test/xml/test_attribute_decl.rb
nokogiri-1.4.7-x86-mswin32-60 test/xml/test_attribute_decl.rb
nokogiri-1.4.7 test/xml/test_attribute_decl.rb
search_biomodel-1.0.0 search_biomodel/ruby/1.8/gems/nokogiri-1.4.6/test/xml/test_attribute_decl.rb
nokogiri-1.4.6 test/xml/test_attribute_decl.rb
nokogiri-1.4.6-java test/xml/test_attribute_decl.rb
nokogiri-1.4.6-x86-mingw32 test/xml/test_attribute_decl.rb
nokogiri-1.4.6-x86-mswin32-60 test/xml/test_attribute_decl.rb
nokogiri-1.4.5-java test/xml/test_attribute_decl.rb
nokogiri-1.4.5 test/xml/test_attribute_decl.rb
nokogiri-1.4.5-x86-mswin32-60 test/xml/test_attribute_decl.rb
nokogiri-1.4.5-x86-mingw32 test/xml/test_attribute_decl.rb
nokogiri-1.4.4.2-java test/xml/test_attribute_decl.rb
nokogiri-1.4.4.1-x86-mswin32 test/xml/test_attribute_decl.rb
nokogiri-1.4.4.1-x86-mingw32 test/xml/test_attribute_decl.rb
nokogiri-1.4.4-x86-mswin32 test/xml/test_attribute_decl.rb
nokogiri-1.4.4-x86-mingw32 test/xml/test_attribute_decl.rb
nokogiri-1.4.4-java test/xml/test_attribute_decl.rb