1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
# -*- coding: utf-8 -*-
require "helper"
module Nokogiri
module XML
class TestDTDEncoding < Nokogiri::TestCase
def setup
super
@xml = Nokogiri::XML(File.read(XML_FILE), XML_FILE, 'UTF-8')
assert @dtd = @xml.internal_subset
end
def test_entities
@dtd.entities.each do |k,v|
assert_equal @xml.encoding, k.encoding.name
end
end
def test_notations
@dtd.notations.each do |k,notation|
assert_equal 'UTF-8', k.encoding.name
%w{ name public_id system_id }.each do |attribute|
v = notation.send(:"#{attribute}") || next
assert_equal 'UTF-8', v.encoding.name
end
end
end
end
end
end
|