Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repro test case for #1952 #2024

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions test/xml/test_node_set.rb
Expand Up @@ -542,6 +542,23 @@ def test_wrap_a_fragment
assert_equal 'employee', frag.at(".//wrapper").children.first.name
end

# https://github.com/sparklemotion/nokogiri/issues/1952
def test_gc_stress
frag = "<winstrom><invoice><id>13250</id><code>123</code><type>type</type></invoice></winstrom>"
pages = 150

50.times do |i|
frag_dup = frag.dup

xml = Nokogiri::XML.parse(frag)
xml.root.content = ''
pages.times do
xml.root.children += Nokogiri::XML.parse(frag_dup).root.children
end
assert_equal pages, xml.root.children.count
end
end

def test_wrap_preserves_document_structure
assert_equal "employeeId",
@xml.at_xpath("//employee").children.detect{|j| ! j.text? }.name
Expand Down