Skip to content

Commit f74f48c

Browse files
authored
fix: work around change in upstream libxml2 recovery (#3013)
**What problem is this PR intended to solve?** Upstream libxml2 slightly changed encoding in recovery mode. Let's update the one failing test, which is intended to test general recovery mode error handling (and not encoding specifically) to be less specific and forwards-compatible. See: - https://gitlab.gnome.org/GNOME/libxml2/-/issues/598 - https://gitlab.gnome.org/GNOME/libxml2/-/commit/c082ef4644ce1f0af2a7c01e27c4a75f4d7d4feb
2 parents 49a0688 + 5e60c08 commit f74f48c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/xml/sax/test_push_parser.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,18 @@ def error(msg)
182182

183183
it :test_broken_encoding do
184184
skip_unless_libxml2("ultra hard to fix for pure Java version")
185+
185186
parser.options |= Nokogiri::XML::ParseOptions::RECOVER
186187
# This is ISO_8859-1:
187188
parser << "<?xml version='1.0' encoding='UTF-8'?><r>Gau\337</r>"
188189
parser.finish
190+
189191
assert_operator(parser.document.errors.size, :>=, 1)
190-
assert_equal "Gau\337", parser.document.data.join
192+
193+
# the interpretation of the byte may vary by libxml2 version in recovery mode
194+
# see for example https://gitlab.gnome.org/GNOME/libxml2/-/issues/598
195+
assert(parser.document.data.join.start_with?("Gau"))
196+
191197
assert_equal [["r"]], parser.document.end_elements
192198
end
193199

0 commit comments

Comments
 (0)