Commits

Anonymous committed d14f8a2

Log:
Submitted by:
Reviewed by:
PR:

Modified Files:
t/03doc.t t/04node.t t/22iterator.t
more tests

t/11memory.t
runs with incomplete versions (where Devel::Peek is missing)

Comments (0)

Files changed (4)

 use Test;
 use strict;
 
-BEGIN { plan tests => 78 };
+BEGIN { plan tests => 84 };
 use XML::LibXML;
 use XML::LibXML::Common qw(:libxml);
 
         ok($node->nodeType, XML_ELEMENT_NODE );
         ok($node->nodeName, "foo" );
     }
+    
+    {
+        print "# document with encoding\n";
+        my $encdoc = XML::LibXML::Document->new( "1.0", "iso-8859-1" );
+        {
+            my $node = $encdoc->createElement( "foo" );
+            ok($node);
+            ok($node->nodeType, XML_ELEMENT_NODE );
+            ok($node->nodeName, "foo" );
+        }
+
+        print "# SAX style document with encoding\n";
+        my $node_def = {
+            Name => "object",
+            LocalName => "object",
+            Prefix => "",
+            NamespaceURI => "",
+                       };
+        {
+            my $node = $encdoc->createElement( $node_def->{Name} );
+            ok($node);
+            ok($node->nodeType, XML_ELEMENT_NODE );
+            ok($node->nodeName, "object" );
+        }
+    }
 
     {
         # namespaced element test
         ok($node->toString, "<![CDATA[foo]]>");
     }
 
+    print "# 2.1 Create Attributes\n";
     {
         my $attr = $doc->createAttribute("foo", "bar");
         ok($attr);
         
     }
 
+    print "# 2.2 Create PIs\n";
     {
         my $pi = $doc->createProcessingInstruction( "foo", "bar" );
         ok($pi);
     my $xroot = $c[0]->ownerDocument;
     ok( $xroot->isSameNode($docA) );
 
-    print "# 4.2 move NS node where NS is defiend elsewhere\n";
-
+ 
 }
 
 print "# 5.   libxml2 specials\n";
     my $root = $doc->documentElement;
     my $attributes = $root->attributes;
     ok($attributes);
-    
+
     my $newAttr = $doc->createAttribute( "kung", "foo" );
     $attributes->setNamedItem( $newAttr );
-
+        
     my @att = $root->attributes;
     ok(@att);
     ok(scalar(@att), 2);
     @att = $root->attributes;
     ok(@att);
     ok(scalar(@att), 4); # because of the namespace ...
-    
+
     $newAttr = $doc->createAttributeNS( "http://kungfoo", "x:kung", "bar" );
     $attributes->setNamedItem($newAttr);
     @att = $root->attributes;
     my $cndoc2 = $node2->ownerDocument;
     ok( $cndoc2 );
     ok( $cndoc2->isSameNode( $doc2 ) );
- 
+
     my $doc3 = XML::LibXML::Document->new;
     my $node3 = $doc3->adoptNode( $xnode );
     ok( $node3 );
 {
     if ($^O eq 'linux' && $ENV{MEMORY_TEST}) {
 
-        require Devel::Peek;
+#        require Devel::Peek;
         my $peek = 0;
     
         ok(1);
             
             if($peek) {
                 warn("Doc before elem\n");
-                Devel::Peek::Dump($doc);
+                # Devel::Peek::Dump($doc);
                 warn("Elem alone\n");
-                Devel::Peek::Dump($elem);
+                # Devel::Peek::Dump($elem);
             }
             
             $doc->setDocumentElement($elem);
             
             if ($peek) {
                 warn("Elem after attaching\n");
-                Devel::Peek::Dump($elem);
+                # Devel::Peek::Dump($elem);
                 warn("Doc after elem\n");
-                Devel::Peek::Dump($doc);
+                # Devel::Peek::Dump($doc);
             }
         }
         if ($peek) {
             warn("Doc should be freed\n");
-            Devel::Peek::Dump($doc);
+            # Devel::Peek::Dump($doc);
         }
         ok(1);
         check_mem();
 
                 check_mem();
             }            
+            ok(1);
         }
-
     }
 }
 
 
 package sax_null;
 
-require Devel::Peek;
-use Data::Dumper;
+# require Devel::Peek;
+# use Data::Dumper;
 
 sub new {
     my $class = shift;
     die( $msg );
 }
 
-1;
+1;
 <test>
     text
     <foo/>
-    <bar><kungfoo/></bar>
     <foo/>
     text
+    <bar><kungfoo/></bar>
 </test>
 EOF
 
 my $iter = XML::LibXML::Iterator->new( $doc->documentElement );
 
 do {
-    ok(1);
+    ok(1); # warn $iter->current->nodeName;
 }while ( $iter->next );
 
 do {
-    ok(1);
+    ok(1); # warn $iter->current->nodeName;
 }while ( $iter->previous );
 
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.