summaryrefslogtreecommitdiff
path: root/cpan/podlators/t/filehandle.t
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgs@consttype.org>2010-01-22 17:19:17 +0100
committerRafael Garcia-Suarez <rgs@consttype.org>2010-01-22 17:19:17 +0100
commitfe61459e95657c432074058bd8854fec03559335 (patch)
treea6a68c10689af759d17b71e16425dc8f519179c9 /cpan/podlators/t/filehandle.t
parent47bd56ab669218f71586b01b08c680861542c90b (diff)
downloadperl-fe61459e95657c432074058bd8854fec03559335.tar.gz
Update to podlators 2.3.0
Diffstat (limited to 'cpan/podlators/t/filehandle.t')
-rw-r--r--cpan/podlators/t/filehandle.t47
1 files changed, 18 insertions, 29 deletions
diff --git a/cpan/podlators/t/filehandle.t b/cpan/podlators/t/filehandle.t
index a53884d50d..1ed0667b33 100644
--- a/cpan/podlators/t/filehandle.t
+++ b/cpan/podlators/t/filehandle.t
@@ -2,7 +2,7 @@
#
# filehandle.t -- Test the parse_from_filehandle interface.
#
-# Copyright 2006 by Russ Allbery <rra@stanford.edu>
+# Copyright 2006, 2009 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.
@@ -11,27 +11,24 @@ BEGIN {
chdir 't' if -d 't';
if ($ENV{PERL_CORE}) {
@INC = '../lib';
- } else {
- unshift (@INC, '../blib/lib');
}
unshift (@INC, '../blib/lib');
$| = 1;
- print "1..3\n";
}
-END {
- print "not ok 1\n" unless $loaded;
-}
+use strict;
-use Pod::Man;
-use Pod::Text;
+use Test::More tests => 6;
-$loaded = 1;
-print "ok 1\n";
+BEGIN {
+ use_ok ('Pod::Man');
+ use_ok ('Pod::Text');
+}
-my $man = Pod::Man->new or die "Cannot create parser\n";
-my $text = Pod::Text->new or die "Cannot create parser\n";
-my $n = 2;
+my $man = Pod::Man->new;
+isa_ok ($man, 'Pod::Man', 'Pod::Man parser object');
+my $text = Pod::Text->new;
+isa_ok ($text, 'Pod::Text', 'Pod::Text parser object');
while (<DATA>) {
next until $_ eq "###\n";
open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
@@ -40,6 +37,8 @@ while (<DATA>) {
print TMP $_;
}
close TMP;
+
+ # Test Pod::Man output.
open (IN, '< tmp.pod') or die "Cannot open tmp.pod: $!\n";
open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
$man->parse_from_filehandle (\*IN, \*OUT);
@@ -58,13 +57,9 @@ while (<DATA>) {
last if $_ eq "###\n";
$expected .= $_;
}
- if ($output eq $expected) {
- print "ok $n\n";
- } else {
- print "not ok $n\n";
- print "Expected\n========\n$expected\nOutput\n======\n$output\n";
- }
- $n++;
+ is ($output, $expected, 'Pod::Man output is correct');
+
+ # Test Pod::Text output.
open (IN, '< tmp.pod') or die "Cannot open tmp.pod: $!\n";
open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
$text->parse_from_filehandle (\*IN, \*OUT);
@@ -76,19 +71,13 @@ while (<DATA>) {
$output = <OUT>;
}
close OUT;
- unlink ('tmp.pod', 'out.tmp');
+ 1 while unlink ('tmp.pod', 'out.tmp');
$expected = '';
while (<DATA>) {
last if $_ eq "###\n";
$expected .= $_;
}
- if ($output eq $expected) {
- print "ok $n\n";
- } else {
- print "not ok $n\n";
- print "Expected\n========\n$expected\nOutput\n======\n$output\n";
- }
- $n++;
+ is ($output, $expected, 'Pod::Text output is correct');
}
# Below the marker are bits of POD, corresponding expected nroff output, and