Skip to content

Commit

Permalink
refactor: test using Encoding instead of names
Browse files Browse the repository at this point in the history
  • Loading branch information
flavorjones committed Jan 22, 2023
1 parent 7892ef7 commit 97cde04
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/xml/test_document_encoding.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,19 @@ class TestDocumentEncoding < Nokogiri::TestCase
end

it "encodes the URL as UTF-8" do
assert_equal("UTF-8", shift_jis_document.url.encoding.name)
assert_equal(Encoding::UTF_8, shift_jis_document.url.encoding)
end

it "encodes the encoding name as UTF-8" do
assert_equal("UTF-8", shift_jis_document.encoding.encoding.name)
assert_equal(Encoding::UTF_8, shift_jis_document.encoding.encoding)
end

it "encodes the library versions as UTF-8" do
skip_unless_libxml2
assert_equal("UTF-8", Nokogiri::LIBXML_COMPILED_VERSION.encoding.name)
assert_equal("UTF-8", Nokogiri::LIBXSLT_COMPILED_VERSION.encoding.name)

assert_equal(Encoding::UTF_8, Nokogiri::LIBXML_COMPILED_VERSION.encoding)
assert_equal(Encoding::UTF_8, Nokogiri::LIBXSLT_COMPILED_VERSION.encoding)
end
end

it "serializes UTF-16 correctly across libxml2 buffer flushes" do
Expand Down

0 comments on commit 97cde04

Please sign in to comment.