Sha256: 8041721216264d3e5392b9dbe47a239b5a57d80930f2420f3f617c9a913116a9

Contents?: true

Size: 1.12 KB

Versions: 6

Compression:

Stored size: 1.12 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(File.open(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_nil @dtd.attributes
      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

6 entries across 6 versions & 1 rubygems

Version Path
nokogiri-1.2.0-java test/xml/test_dtd.rb
nokogiri-1.2.0-x86-mswin32-60 test/xml/test_dtd.rb
nokogiri-1.2.0 test/xml/test_dtd.rb
nokogiri-1.2.1-java test/xml/test_dtd.rb
nokogiri-1.2.1 test/xml/test_dtd.rb
nokogiri-1.2.1-x86-mswin32-60 test/xml/test_dtd.rb