From 8f54c0fc5a85e4d384f5dacefdfd5f595cf858a4 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Tue, 18 May 2021 09:58:31 -0400 Subject: [PATCH] test: adjust tests to pass on system libxml2 >= 2.9.11 because the comment parsing improvement was merged upstream. --- test/html/test_comments.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/test/html/test_comments.rb b/test/html/test_comments.rb index 476fc4b473..7d207815f5 100644 --- a/test/html/test_comments.rb +++ b/test/html/test_comments.rb @@ -113,8 +113,7 @@ class TestComment < Nokogiri::TestCase let(:subject) { doc.at_css("div#under-test") } let(:inner_div) { doc.at_css("div#do-i-exist") } - if Nokogiri.uses_libxml? && Nokogiri::VersionInfo.instance.libxml2_using_packaged? - # see patches/libxml2/0006-htmlParseComment-treat-as-if-it-closed-the-comment.patch + if Nokogiri::VersionInfo.instance.libxml2_using_packaged? || (Nokogiri::VersionInfo.instance.libxml2_using_system? && Nokogiri.uses_libxml?(">=2.9.11")) it "behaves as if the comment is normally closed" do # COMPLIANT assert_equal 3, subject.children.length assert subject.children[0].comment? @@ -128,9 +127,7 @@ class TestComment < Nokogiri::TestCase end end - if Nokogiri.jruby? || Nokogiri::VersionInfo.instance.libxml2_using_system? - # this behavior may change to the above in libxml v2.9.11 depending on whether - # https://gitlab.gnome.org/GNOME/libxml2/-/merge_requests/82 is merged + if Nokogiri.jruby? || (Nokogiri::VersionInfo.instance.libxml2_using_system? && Nokogiri.uses_libxml?("<2.9.11")) it "behaves as if the comment encompasses the inner div" do # NON-COMPLIANT assert_equal 1, subject.children.length assert subject.children.first.comment?