Skip to content

Commit

Permalink
fix: work around change in upstream libxml2 recovery
Browse files Browse the repository at this point in the history
  • Loading branch information
flavorjones committed Oct 24, 2023
1 parent 49a0688 commit 5e60c08
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/xml/sax/test_push_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,18 @@ def error(msg)

it :test_broken_encoding do
skip_unless_libxml2("ultra hard to fix for pure Java version")

parser.options |= Nokogiri::XML::ParseOptions::RECOVER
# This is ISO_8859-1:
parser << "<?xml version='1.0' encoding='UTF-8'?><r>Gau\337</r>"
parser.finish

assert_operator(parser.document.errors.size, :>=, 1)
assert_equal "Gau\337", parser.document.data.join

# the interpretation of the byte may vary by libxml2 version in recovery mode
# see for example https://gitlab.gnome.org/GNOME/libxml2/-/issues/598
assert(parser.document.data.join.start_with?("Gau"))

assert_equal [["r"]], parser.document.end_elements
end

Expand Down

0 comments on commit 5e60c08

Please sign in to comment.