From 2b42cef0470f58fe29a5e99e7a83f5f665bfff21 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 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/xml/test_document.rb b/test/xml/test_document.rb index 036ecb9af4..bf37c2c5ba 100644 --- a/test/xml/test_document.rb +++ b/test/xml/test_document.rb @@ -809,6 +809,22 @@ def test_dup assert dup.xml?, 'duplicate should be xml' end + def test_dup_xml_document_errors + html = "
replace me
" + + 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_equal doc2, child2.document + assert_equal doc2.errors, child2.document.errors + end + def test_new doc = nil doc = Nokogiri::XML::Document.new