Convert lib/Pod/t/utils.t from Test to Test::More
authorNicholas Clark <nick@ccl4.org>
Wed, 19 Jan 2011 11:36:30 +0000 (11:36 +0000)
committerNicholas Clark <nick@ccl4.org>
Fri, 21 Jan 2011 08:36:52 +0000 (08:36 +0000)
Curiously this test file is not part of the Pod-Parser distribution.

lib/Pod/t/utils.t

index 4a1b8a1..9f4fe55 100644 (file)
@@ -1,18 +1,11 @@
-
+#!./perl -w
 # Test hyperlinks et al from Pod::ParseUtils
 
-BEGIN {
-        chdir 't' if -d 't';
-        @INC = '../lib';
-        require Test; import Test;
-        plan(tests => 22);
-}
+use Test::More tests => 22;
 
 use strict;
 use Pod::ParseUtils;
 
-# First test the hyperlinks
-
 my @links = qw{
   name
   name/ident
@@ -39,11 +32,11 @@ my @results = (
               "Q<text>",
              );
 
-ok(@results,@links);
+is(@results, @links, 'sanity check - array lengths equal?');
 
 for my $i( 0..@links ) {
   my $link = new Pod::Hyperlink( $links[$i] );
-  ok($link->markup, $results[$i]);
+  is($link->markup, $results[$i], "test hyperlink $i");
 }
 
 # Now test lists
@@ -56,9 +49,9 @@ my $list = new Pod::List( -indent => 4,
 
 ok($list);
 
-ok($list->indent, 4);
-ok($list->start, 52);
-ok($list->type, "OL");
+is($list->indent, 4);
+is($list->start, 52);
+is($list->type, "OL");
 
 
 # Pod::Cache
@@ -74,19 +67,15 @@ $cache->item(
             -file => "file.t",
  );
 
-# Now look for an item of this name
 my $item = $cache->find_page("Pod::ParseUtils");
-ok($item);
+ok($item, 'found item of this name');
 
-# and a failure
-ok($cache->find_page("Junk"), undef);
+is($cache->find_page("Junk"), undef, 'expect to find nothing');
 
-# Make sure that the item we found is the same one as the
-# first in the list
 my @i = $cache->item;
-ok($i[0], $item);
+is($i[0], $item, 'item we found is the same one as the first in the list');
 
 # Check the contents
-ok($item->page, "Pod::ParseUtils");
-ok($item->description, "A description");
-ok($item->file, "file.t");
+is($item->page, "Pod::ParseUtils");
+is($item->description, "A description");
+is($item->file, "file.t");