Skip to content

Commit

Permalink
Test to reproduce issue #643.
Browse files Browse the repository at this point in the history
  • Loading branch information
flavorjones committed Apr 27, 2012
1 parent cba9567 commit aba01a1
Showing 1 changed file with 27 additions and 8 deletions.
35 changes: 27 additions & 8 deletions test/xml/test_document_fragment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,34 @@ def awesome!
assert fragment.children.respond_to?(:awesome!), fragment.children.class
end

def test_for_libxml_in_context_fragment_parsing_bug_workaround
10.times do
begin
fragment = Nokogiri::XML.fragment("<div></div>")
parent = fragment.children.first
child = parent.parse("<h1></h1>").first
parent.add_child child
if Nokogiri.uses_libxml?
def test_for_libxml_in_context_fragment_parsing_bug_workaround
10.times do
begin
fragment = Nokogiri::XML.fragment("<div></div>")
parent = fragment.children.first
child = parent.parse("<h1></h1>").first
parent.add_child child
end
GC.start
end
GC.start
end

def test_for_libxml_in_context_memory_badness_when_encountering_encoding_errors
# see issue #643 for background
# this test exists solely to raise an error during valgrind test runs.
html = <<-EOHTML
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=shizzle" />
</head>
<body>
<div>Foo</div>
</body>
</html>
EOHTML
doc = Nokogiri::HTML html
doc.at_css("div").replace("Bar")
end
end
end
Expand Down

0 comments on commit aba01a1

Please sign in to comment.