Skip to content

Commit

Permalink
dep: update libxml2 to v2.9.14
Browse files Browse the repository at this point in the history
  • Loading branch information
flavorjones committed May 4, 2022
1 parent b7c4cc3 commit 66c2886
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 58 deletions.
6 changes: 3 additions & 3 deletions dependencies.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
libxml2:
version: "2.9.13"
sha256: "276130602d12fe484ecc03447ee5e759d0465558fbc9d6bd144e3745306ebf0e"
# sha-256 hash provided in https://download.gnome.org/sources/libxml2/2.9/libxml2-2.9.13.sha256sum
version: "2.9.14"
sha256: "60d74a257d1ccec0475e749cba2f21559e48139efba6ff28224357c7c798dfee"
# sha-256 hash provided in https://download.gnome.org/sources/libxml2/2.9/libxml2-2.9.14.sha256sum

libxslt:
version: "1.1.35"
Expand Down

This file was deleted.

25 changes: 24 additions & 1 deletion test/html4/test_comments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -183,10 +183,33 @@ class TestComment < Nokogiri::TestCase
assert_predicate 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_predicate subject.children[0], :text?
assert_equal "hello", subject.children[0].content
Expand Down
25 changes: 16 additions & 9 deletions test/html4/test_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -801,18 +801,25 @@ def test_leaking_dtd_nodes_after_internal_subset_removal

it "skips to the next start tag" do
# see https://github.com/sparklemotion/nokogiri/issues/2461 for why we're testing this edge case
if Nokogiri.uses_libxml?(">= 2.9.13")
skip_unless_libxml2_patch("0010-Revert-Different-approach-to-fix-quadratic-behavior.patch")
end

doc = Nokogiri::HTML4.parse(input)
body = doc.at_xpath("//body")

expected_error_snippet = Nokogiri.uses_libxml? ? "invalid element name" : "Missing start element name"
assert_includes(doc.errors.first.to_s, expected_error_snippet)

assert_equal("this < that", body.children.first.text, body.to_html)
assert_equal(["div", "div"], body.children.map(&:name), body.to_html)
if Nokogiri.uses_libxml?("= 2.9.13")
# <body><div>this <div>second element</div></div></body>
assert_equal(1, body.children.length)
body.children.first.tap do |div|
assert_equal(2, div.children.length)
assert_equal("this ", div.children[0].content)
assert_equal("div", div.children[1].name)
assert_equal("second element", div.children[1].content)
end
else
# <body><div>this &lt; that</div><div>second element</div></body>
assert_equal(2, body.children.length)
assert_equal(["div", "div"], body.children.map(&:name), body.to_html)
assert_equal("this < that", body.children[0].text, body.to_html)
assert_equal("second element", body.children[1].text, body.to_html)
end
end
end

Expand Down

0 comments on commit 66c2886

Please sign in to comment.