Commits

ph...@9ae0c189-cd1f-4510-a509-f4891f5cf20d  committed be196dc

Modified Files:
t/05dombasic.t
+ importNode tests

  • Participants
  • Parent commits ab631c6

Comments (0)

Files changed (1)

File t/05dombasic.t

 # `make test'. After `make install' it should work as `perl test.pl'
 
 use Test;
-BEGIN { plan tests=>14; }
+BEGIN { plan tests=>15; }
 END {ok(0) unless $loaded;}
 use XML::LibXML;
 $loaded = 1;
 
 my $node;
 {
-    my $dom2 = XML::LibXML::Document->createDocument( $vers, $enc );
-    $node   = $dom2->createElement( $testtxt );
-    $dom2->setDocumentElement( $node );
+    my $dom3 = XML::LibXML::Document->createDocument( $vers, $enc );
+    $node   = $dom3->createElement( $testtxt );
+    $dom3->setDocumentElement( $node );
 }
 
 # this ends scope and older versions should segfault here 
 ok( defined $node && $node->getName() eq $testtxt );
 
 { 
-    my $dom2 = $node->getOwnerDocument();
-    ok( defined $dom2 && $dom2->isa( 'XML::LibXML::Document' ) ); 
+    my $dom3 = $node->getOwnerDocument();
+    ok( defined $dom3 && $dom3->isa( 'XML::LibXML::Document' ) ); 
 }
 
 # this ends scope and older versions should segfault here 
 ok( defined $node && $node->getName() eq $testtxt );
 
 
+$node = $dom2->createElement( $testtxt );
+$dom2->setDocumentElement( $node );
+my $node2 = $dom->importNode( $node );
+{
+    warn "node not defined " unless defined $node2;
+    my $tdoc = $node2->getOwnerDocument();
+    warn "doc not defined " unless defined $tdoc;
+    warn "wrong doc" if $tdoc->isEqual( $dom2 );
+    ok( defined $node2 && defined $tdoc && $tdoc->isEqual( $dom ) == 1 );
+}
 
 my $text = $dom->createTextNode( $testtxt );
 ok( defined $text && $text->isa( "XML::LibXML::Text" ) );