Commits

Shlomi Fish committed e3c1e2d

Convert t/27new_callbacks_simple.t to Test::More.

TODO : convert it to the Counter interface.

Comments (0)

Files changed (1)

t/27new_callbacks_simple.t

 use warnings;
 
 # $Id$
-use Test;
 
-BEGIN { plan tests => 20 }
+# Should be 20.
+use Test::More tests => 20;
 
 use XML::LibXML;
 use IO::File;
 EOF
 
 my $icb    = XML::LibXML::InputCallback->new();
-ok($icb);
+# TEST
+
+ok($icb, ' TODO : Add test name');
 
 $icb->register_callbacks( [ \&match_file, \&open_file, 
                             \&read_file, \&close_file ] );
 $parser->input_callbacks($icb);
 my $doc = $parser->parse_string($string);
 
-ok($doc);
-ok($doc->string_value(),"test..");
+# TEST
+
+ok($doc, ' TODO : Add test name');
+# TEST
+
+is($doc->string_value(),"test..", ' TODO : Add test name');
 
 my $icb2    = XML::LibXML::InputCallback->new();
-ok($icb2);
+# TEST
+
+ok($icb2, ' TODO : Add test name');
 
 $icb2->register_callbacks( [ \&match_hash, \&open_hash, 
                              \&read_hash, \&close_hash ] );
 $parser->input_callbacks($icb2);
 $doc = $parser->parse_string($string);
 
-ok($doc);
-ok($doc->string_value(),"testbar..");
+# TEST
+
+ok($doc, ' TODO : Add test name');
+# TEST
+
+is($doc->string_value(),"testbar..", ' TODO : Add test name');
 
 # --------------------------------------------------------------------- #
 # CALLBACKS
 sub match_file {
         my $uri = shift;
         if ( $uri =~ /^\/example\// ){
-                ok(1);
+                # TEST
+                ok(1, 'match_file');
                 return 1;
         }
         return 0;        
         my $uri = shift;
         open my $file, '<', ".$uri"
             or die "Cannot open '.$uri'";
-        ok(1);
+        # TEST
+        ok(1, 'open_file');
         return $file;
 }
 
         my $buflen = shift;
         my $rv   = undef;
 
-        ok(1);
+        # TEST*2
+        ok(1, 'read_file');
         
         my $n = $h->read( $rv , $buflen );
 
 
 sub close_file {
         my $h   = shift;
-        ok(1);
+        # TEST
+        ok(1, 'close_file');
         $h->close();
         return 1;
 }
 sub match_hash {
         my $uri = shift;
         if ( $uri =~ /^\/example\// ){
-                ok(1);
+                # TEST
+                ok(1, 'match_hash');
                 return 1;
         }
 }
         my $hash = { line => 0,
                      lines => [ "<foo>", "bar", "<xsl/>", "..", "</foo>" ],
                    };                
-        ok(1);
+        # TEST
+        ok(1, 'open_hash');
 
         return $hash;
 }
 
         $rv = "" unless defined $rv;
 
-        ok(1);
+        # TEST*6
+        ok(1, 'read_hash');
         return $rv;
 }
 
 sub close_hash {
         my $h   = shift;
         undef $h;
-        ok(1);
+        # TEST
+        ok(1, 'close_hash');
 }
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.