ea58e84d09
Backport upstream patch for libxml2 2.12.0 error handling change
43 lines
1.7 KiB
Diff
43 lines
1.7 KiB
Diff
From 374f3281a67ab3a3e52ebe6deacc0548b3f1b96a Mon Sep 17 00:00:00 2001
|
|
From: Mike Dalessio <mike.dalessio@gmail.com>
|
|
Date: Mon, 4 Sep 2023 12:58:45 -0400
|
|
Subject: [PATCH] test: update to handle upstream libxml2 error changes
|
|
|
|
The behavior changed in libxml2 commit 53050b1d
|
|
---
|
|
test/xml/test_reader.rb | 14 ++++++++++++--
|
|
1 file changed, 12 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/test/xml/test_reader.rb b/test/xml/test_reader.rb
|
|
index 4b5b5c5728..e5f01d32ec 100644
|
|
--- a/test/xml/test_reader.rb
|
|
+++ b/test/xml/test_reader.rb
|
|
@@ -765,7 +765,12 @@ def test_broken_markup_attribute_hash
|
|
e = assert_raises(Nokogiri::XML::SyntaxError) do
|
|
reader.attribute_hash
|
|
end
|
|
- assert_includes(e.message, "FATAL: Extra content at the end of the document")
|
|
+ expected = if Nokogiri.uses_libxml?(">= 2.12.0") # upstream commit 53050b1d
|
|
+ "FATAL: Premature end of data in tag foo line 1"
|
|
+ else
|
|
+ "FATAL: Extra content at the end of the document"
|
|
+ end
|
|
+ assert_includes(e.message, expected)
|
|
end
|
|
|
|
assert_equal(1, reader.errors.length)
|
|
@@ -796,7 +801,12 @@ def test_broken_markup_namespaces
|
|
e = assert_raises(Nokogiri::XML::SyntaxError) do
|
|
reader.namespaces
|
|
end
|
|
- assert_includes(e.message, "FATAL: Extra content at the end of the document")
|
|
+ expected = if Nokogiri.uses_libxml?(">= 2.12.0") # upstream commit 53050b1d
|
|
+ "FATAL: Premature end of data in tag foo line 1"
|
|
+ else
|
|
+ "FATAL: Extra content at the end of the document"
|
|
+ end
|
|
+ assert_includes(e.message, expected)
|
|
end
|
|
|
|
assert_equal(1, reader.errors.length)
|