Upgrade to podlators-2.00
[p5sagit/p5-mst-13.2.git] / lib / Pod / t / basic.t
index 984e720..6a70f7c 100644 (file)
@@ -1,9 +1,9 @@
 #!/usr/bin/perl -w
-# $Id: basic.t,v 1.4 2002/01/28 02:56:19 eagle Exp $
+# $Id: basic.t,v 1.8 2004/12/31 21:27:58 eagle Exp $
 #
 # basic.t -- Basic tests for podlators.
 #
-# Copyright 2001 by Russ Allbery <rra@stanford.edu>
+# Copyright 2001, 2002, 2004 by Russ Allbery <rra@stanford.edu>
 #
 # This program is free software; you may redistribute it and/or modify it
 # under the same terms as Perl itself.
@@ -16,11 +16,6 @@ BEGIN {
         unshift (@INC, '../blib/lib');
     }
     unshift (@INC, '../blib/lib');
-    require Config;
-    if (($Config::Config{'extensions'} !~ /\bPOSIX\b/) ){
-        print "1..0 # Skip -- Perl configured without POSIX module\n";
-        exit 0;
-    }
     $| = 1;
     print "1..11\n";
 }
@@ -31,7 +26,6 @@ END {
 
 use Pod::Man;
 use Pod::Text;
-use Pod::Text::Color;
 use Pod::Text::Overstrike;
 use Pod::Text::Termcap;
 
@@ -70,6 +64,17 @@ my %translators = ('Pod::Man'              => 'man',
 
 my $n = 2;
 for (sort keys %translators) {
+    if ($_ eq 'Pod::Text::Color') {
+        eval { require Term::ANSIColor };
+        if ($@) {
+            print "ok $n # skip\n";
+            $n++;
+            print "ok $n # skip\n";
+            $n++;
+            next;
+        }
+        require Pod::Text::Color;
+    }
     my $parser = $_->new (%options);
     print (($parser && ref ($parser) eq $_) ? "ok $n\n" : "not ok $n\n");
     $n++;
@@ -77,8 +82,9 @@ for (sort keys %translators) {
     # For Pod::Man, strip out the autogenerated header up to the .TH title
     # line.  That means that we don't check those things; oh well.  The header
     # changes with each version change or touch of the input file.
+    $parser->parse_from_file (source_path ('basic.pod'), 'out.tmp');
+    undef $parser;
     if ($_ eq 'Pod::Man') {
-        $parser->parse_from_file (source_path ('basic.pod'), 'out.tmp');
         open (TMP, 'out.tmp') or die "Cannot open out.tmp: $!\n";
         open (OUTPUT, "> out.$translators{$_}")
             or die "Cannot create out.$translators{$_}: $!\n";
@@ -89,8 +95,8 @@ for (sort keys %translators) {
         close TMP;
         unlink 'out.tmp';
     } else {
-        my $basic = source_path ('basic.pod');
-        $parser->parse_from_file ($basic, "out.$translators{$_}");
+        rename ('out.tmp', "out.$translators{$_}")
+            or die "Cannot rename out.tmp: $!\n";
     }
     {
         local $/;