Sha256: 7266572b83c5e84f32cce3a220447cc3e26d246a7a71c47694d4aa5d78df39e7

Contents?: true

Size: 1.24 KB

Versions: 20

Compression:

Stored size: 1.24 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), '..', "helper"))

module Nokogiri
  module HTML
    class TestDTD < Nokogiri::TestCase
      def setup
        @xml = Nokogiri::XML.parse(File.read(XML_FILE))
        assert @dtd = @xml.internal_subset
      end

      def test_external_subsets
        assert subset = @xml.internal_subset
        assert_equal 'staff', subset.name
      end

      def test_entities
        assert entities = @dtd.entities
        assert_equal %w[ ent1 ent2 ent3 ent4 ent5 ].sort, entities.keys.sort
      end

      def test_attributes
        assert attributes = @dtd.attributes
        assert_equal %w[ width ], attributes.keys
        assert_equal 'width', attributes['width'].name
      end

      def test_elements
        assert elements = @dtd.elements
        assert_equal %w[ br ], elements.keys
        assert_equal 'br', elements['br'].name
      end

      def test_notations
        assert notations = @dtd.notations
        assert_equal %w[ notation1 notation2 ].sort, notations.keys.sort
        assert notation1 = notations['notation1']
        assert_equal 'notation1', notation1.name
        assert_equal 'notation1File', notation1.public_id
        assert_nil notation1.system_id
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
tenderlove-nokogiri-0.0.0-x86-mswin32-60 test/xml/test_dtd.rb
nokogiri-1.0.0-x86-mswin32-60 test/xml/test_dtd.rb
nokogiri-1.0.0 test/xml/test_dtd.rb
nokogiri-1.0.1 test/xml/test_dtd.rb
nokogiri-1.0.4 test/xml/test_dtd.rb
nokogiri-1.0.4-x86-mswin32-60 test/xml/test_dtd.rb
nokogiri-1.0.5-x86-mswin32-60 test/xml/test_dtd.rb
nokogiri-1.0.3-x86-mswin32-60 test/xml/test_dtd.rb
nokogiri-1.0.2 test/xml/test_dtd.rb
nokogiri-1.0.3 test/xml/test_dtd.rb
nokogiri-1.0.5 test/xml/test_dtd.rb
nokogiri-1.0.6 test/xml/test_dtd.rb
nokogiri-1.0.6-x86-mswin32-60 test/xml/test_dtd.rb
nokogiri-1.1.1-java test/xml/test_dtd.rb
nokogiri-1.0.7-x86-mswin32-60 test/xml/test_dtd.rb
nokogiri-1.1.0 test/xml/test_dtd.rb
nokogiri-1.0.7 test/xml/test_dtd.rb
nokogiri-1.1.0-x86-mswin32-60 test/xml/test_dtd.rb
nokogiri-1.1.1-x86-mswin32-60 test/xml/test_dtd.rb
nokogiri-1.1.1 test/xml/test_dtd.rb