Blob Blame History Raw
From 520f4e7d64eab9b862b7fe9c683d348be9f4eb0a Mon Sep 17 00:00:00 2001
From: Mike Dalessio <mike.dalessio@gmail.com>
Date: Mon, 2 May 2022 18:04:39 -0400
Subject: [PATCH] dep: update libxml2 to v2.9.14

from v2.9.13

https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.9.14
---
 dependencies.yml                              |  6 +--
 ...t-approach-to-fix-quadratic-behavior.patch | 45 -------------------
 test/html4/test_comments.rb                   | 25 ++++++++++-
 test/html4/test_document.rb                   | 25 +++++++----
 4 files changed, 43 insertions(+), 58 deletions(-)
 delete mode 100644 patches/libxml2/0010-Revert-Different-approach-to-fix-quadratic-behavior.patch

diff --git a/test/html4/test_comments.rb b/test/html4/test_comments.rb
index 32d7a8785..56fd50682 100644
--- a/test/html4/test_comments.rb
+++ b/test/html4/test_comments.rb
@@ -173,7 +173,7 @@ class TestComment < Nokogiri::TestCase
         let(:body) { doc.at_css("body") }
         let(:subject) { doc.at_css("div#under-test") }
 
-        if Nokogiri.uses_libxml?
+        if Nokogiri.uses_libxml?("<=2.9.13")
           it "ignores up to the next '>'" do # NON-COMPLIANT
             assert_equal 2, body.children.length
             assert_equal body.children[0], subject
@@ -183,10 +183,33 @@ class TestComment < Nokogiri::TestCase
             assert body.children[1].text?
             assert_equal "-->hello", body.children[1].content
           end
+        elsif Nokogiri.uses_libxml?
+          it "parses as pcdata" do # NON-COMPLIANT
+            assert_equal 1, body.children.length
+            assert_equal subject, body.children.first
+
+            assert_equal 3, subject.children.length
+            subject.children[0].tap do |child|
+              assert_predicate(child, :text?)
+              assert_equal("<! comment ", child.content)
+            end
+            subject.children[1].tap do |child|
+              assert_predicate(child, :element?)
+              assert_equal("div", child.name)
+              assert_equal("inner content", child.content)
+            end
+            subject.children[2].tap do |child|
+              assert_predicate(child, :text?)
+              assert_equal("-->hello", child.content)
+            end
+          end
         end
 
         if Nokogiri.jruby?
           it "ignores up to the next '-->'" do # NON-COMPLIANT
+            assert_equal 1, body.children.length
+            assert_equal subject, body.children.first
+
             assert_equal 1, subject.children.length
             assert subject.children[0].text?
             assert_equal "hello", subject.children[0].content