Skip to content

Commit

Permalink
test: adjust tests to pass on system libxml2 >= 2.9.11
Browse files Browse the repository at this point in the history
because the comment parsing improvement was merged upstream.
  • Loading branch information
flavorjones committed May 19, 2021
1 parent 3d8a570 commit 8f54c0f
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions test/html/test_comments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand All @@ -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?
Expand Down

0 comments on commit 8f54c0f

Please sign in to comment.