diff options
Diffstat (limited to 'cpan/podlators/t/pod-parser.t')
-rw-r--r-- | cpan/podlators/t/pod-parser.t | 52 |
1 files changed, 14 insertions, 38 deletions
diff --git a/cpan/podlators/t/pod-parser.t b/cpan/podlators/t/pod-parser.t index 318a76bc15..ae2ef01676 100644 --- a/cpan/podlators/t/pod-parser.t +++ b/cpan/podlators/t/pod-parser.t @@ -2,7 +2,7 @@ # # pod-parser.t -- Tests for backward compatibility with Pod::Parser. # -# Copyright 2006, 2008 by Russ Allbery <rra@stanford.edu> +# Copyright 2006, 2008, 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,28 +11,21 @@ BEGIN { chdir 't' if -d 't'; if ($ENV{PERL_CORE}) { @INC = '../lib'; - } else { - unshift (@INC, '../blib/lib'); } unshift (@INC, '../blib/lib'); $| = 1; - print "1..4\n"; } -my $loaded; - -END { - print "not ok 1\n" unless $loaded; -} - -use Pod::Man; -use Pod::Text; use strict; -$loaded = 1; -print "ok 1\n"; +use Test::More tests => 7; +BEGIN { + use_ok ('Pod::Man'); + use_ok ('Pod::Text'); +} -my $parser = Pod::Man->new or die "Cannot create parser\n"; +my $parser = Pod::Man->new; +isa_ok ($parser, 'Pod::Man', 'Pod::Man parser object'); open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n"; print TMP "Some random B<text>.\n"; close TMP; @@ -47,15 +40,10 @@ my $output; $output = <OUT>; } close OUT; -if ($output eq "Some random \\fBtext\\fR.\n") { - print "ok 2\n"; -} else { - print "not ok 2\n"; - print "Expected\n========\nSome random \\fBtext\\fR.\n\n"; - print "Output\n======\n$output\n"; -} +is ($output, "Some random \\fBtext\\fR.\n", 'Pod::Man -cutting output'); -$parser = Pod::Text->new or die "Cannot create parser\n"; +$parser = Pod::Text->new; +isa_ok ($parser, 'Pod::Text', 'Pod::Text parser object'); open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n"; $parser->parse_from_file ({ -cutting => 0 }, 'tmp.pod', \*OUT); close OUT; @@ -65,13 +53,7 @@ open (OUT, 'out.tmp') or die "Cannot open out.tmp: $!\n"; $output = <OUT>; } close OUT; -if ($output eq " Some random text.\n\n") { - print "ok 3\n"; -} else { - print "not ok 3\n"; - print "Expected\n========\n Some random text.\n\n\n"; - print "Output\n======\n$output\n"; -} +is ($output, " Some random text.\n\n", 'Pod::Text -cutting output'); # Test the pod2text function, particularly with only one argument. open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n"; @@ -90,13 +72,7 @@ open (OUT, 'out.tmp') or die "Cannot open out.tmp: $!\n"; $output = <OUT>; } close OUT; -if ($output eq " Some random text.\n\n") { - print "ok 4\n"; -} else { - print "not ok 4\n"; - print "Expected\n========\n Some random text.\n\n\n"; - print "Output\n======\n$output\n"; -} +is ($output, " Some random text.\n\n", 'Pod::Text pod2text function'); -unlink ('tmp.pod', 'out.tmp'); +1 while unlink ('tmp.pod', 'out.tmp'); exit 0; |