3 # man-options.t -- Additional tests for Pod::Man options.
5 # Copyright 2002, 2004, 2006, 2008, 2009 Russ Allbery <rra@stanford.edu>
7 # This program is free software; you may redistribute it and/or modify it
8 # under the same terms as Perl itself.
12 if ($ENV{PERL_CORE}) {
15 unshift (@INC, '../blib/lib');
21 use Test::More tests => 10;
22 BEGIN { use_ok ('Pod::Man') }
24 # Redirect stderr to a file.
26 open (OLDERR, '>&STDERR') or die "Can't dup STDERR: $!\n";
27 open (STDERR, '> out.err') or die "Can't redirect STDERR: $!\n";
33 open (STDERR, '>&OLDERR') or die "Can't dup STDERR: $!\n";
40 next until $_ eq "###\n";
42 last if $_ eq "###\n";
43 my ($option, $value) = split;
44 $options{$option} = $value;
46 open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
48 last if $_ eq "###\n";
52 my $parser = Pod::Man->new (%options);
53 isa_ok ($parser, 'Pod::Man', 'Parser object');
54 open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
56 $parser->parse_from_file ('tmp.pod', \*OUT);
60 open (TMP, 'out.tmp') or die "Cannot open out.tmp: $!\n";
70 1 while unlink ('tmp.pod', 'out.tmp');
73 last if $_ eq "###\n";
76 is ($output, $expected, "Output correct for test $n");
77 open (ERR, 'out.err') or die "Cannot open out.err: $!\n";
84 1 while unlink ('out.err');
87 last if $_ eq "###\n";
90 is ($errors, $expected, "Errors are correct for test $n");
94 # Below the marker are bits of POD and corresponding expected text output and
95 # error output. This is used to test specific features or problems with
96 # Pod::Man. The options, input, output, and errors are separated by lines
97 # containing only ###.
109 C<foo B<bar I<baz>> I<bay>>
112 .IX Header "FIXED FONTS"
113 \&\f(CR\*(C`foo \f(CYbar \f(CXbaz\f(CY\f(CR \f(CWbay\f(CR\*(C'\fR
133 .IX Header "POD ERRORS"
134 Hey! \fBThe above document had some coding errors, which are explained below:\fR
135 .IP "Around line 7:" 4
136 .IX Item "Around line 7:"
137 You forgot a '=back' before '=head1'
158 tmp.pod around line 7: You forgot a '=back' before '=head1'