Skip to content

Commit 8f54c0f

Browse files
committed
test: adjust tests to pass on system libxml2 >= 2.9.11
because the comment parsing improvement was merged upstream.
1 parent 3d8a570 commit 8f54c0f

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

test/html/test_comments.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,7 @@ class TestComment < Nokogiri::TestCase
113113
let(:subject) { doc.at_css("div#under-test") }
114114
let(:inner_div) { doc.at_css("div#do-i-exist") }
115115

116-
if Nokogiri.uses_libxml? && Nokogiri::VersionInfo.instance.libxml2_using_packaged?
117-
# see patches/libxml2/0006-htmlParseComment-treat-as-if-it-closed-the-comment.patch
116+
if Nokogiri::VersionInfo.instance.libxml2_using_packaged? || (Nokogiri::VersionInfo.instance.libxml2_using_system? && Nokogiri.uses_libxml?(">=2.9.11"))
118117
it "behaves as if the comment is normally closed" do # COMPLIANT
119118
assert_equal 3, subject.children.length
120119
assert subject.children[0].comment?
@@ -128,9 +127,7 @@ class TestComment < Nokogiri::TestCase
128127
end
129128
end
130129

131-
if Nokogiri.jruby? || Nokogiri::VersionInfo.instance.libxml2_using_system?
132-
# this behavior may change to the above in libxml v2.9.11 depending on whether
133-
# https://gitlab.gnome.org/GNOME/libxml2/-/merge_requests/82 is merged
130+
if Nokogiri.jruby? || (Nokogiri::VersionInfo.instance.libxml2_using_system? && Nokogiri.uses_libxml?("<2.9.11"))
134131
it "behaves as if the comment encompasses the inner div" do # NON-COMPLIANT
135132
assert_equal 1, subject.children.length
136133
assert subject.children.first.comment?

0 commit comments

Comments
 (0)