Sha256: b98bb42b10f7e6ada254b65e24220c943e67ce356ef415d2e96ea31dfc5516c3

Contents?: true

Size: 1.14 KB

Versions: 14

Compression:

Stored size: 1.14 KB

Contents

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

module Nokogiri
  module HTML
    class TestDTD < Nokogiri::TestCase
      def setup
        super
        @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

14 entries across 14 versions & 1 rubygems

Version Path
nokogiri-1.3.0-x86-mingw32 test/xml/test_dtd.rb
nokogiri-1.2.2-java test/xml/test_dtd.rb
nokogiri-1.2.2-x86-mswin32-60 test/xml/test_dtd.rb
nokogiri-1.2.2 test/xml/test_dtd.rb
nokogiri-1.2.3 test/xml/test_dtd.rb
nokogiri-1.3.0-java test/xml/test_dtd.rb
nokogiri-1.2.3-java test/xml/test_dtd.rb
nokogiri-1.2.3-x86-mswin32-60 test/xml/test_dtd.rb
nokogiri-1.3.0 test/xml/test_dtd.rb
nokogiri-1.3.0-x86-mswin32 test/xml/test_dtd.rb
nokogiri-1.3.1-x86-mingw32 test/xml/test_dtd.rb
nokogiri-1.3.1-java test/xml/test_dtd.rb
nokogiri-1.3.1 test/xml/test_dtd.rb
nokogiri-1.3.1-x86-mswin32 test/xml/test_dtd.rb