From 61b303c5f9dea4ef26005f523f651d280b090be5 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Thu, 5 Feb 2015 11:31:10 -0500 Subject: [PATCH] Test reproducing the underlying bug in #1060. Signed-off-by: Jake Byman --- test/xml/test_document.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/xml/test_document.rb b/test/xml/test_document.rb index f7e90fa8e3..80a9e12d45 100644 --- a/test/xml/test_document.rb +++ b/test/xml/test_document.rb @@ -820,6 +820,24 @@ def test_dup assert dup.xml?, 'duplicate should be xml' end + def test_dup_xml_document_errors + html = "
error!" + + doc = Nokogiri::XML::Document.parse(html) + doc2 = doc.dup + + child = doc.css('body').children[0] + child2 = doc2.css('body').children[0] + + assert_equal doc, child.document + assert_equal doc.errors, child.document.errors + assert doc.errors.length > 0 + + assert_equal doc2, child2.document + assert_equal doc2.errors, child2.document.errors + assert doc2.errors.length > 0 + end + def test_new doc = nil doc = Nokogiri::XML::Document.new