3 # man-options.t -- Additional tests for Pod::Man options.
5 # Copyright 2002, 2004, 2006, 2008 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');
17 unshift (@INC, '../blib/lib');
23 print "not ok 1\n" unless $loaded;
28 # Redirect stderr to a file.
30 open (OLDERR, '>&STDERR') or die "Can't dup STDERR: $!\n";
31 open (STDERR, '> out.err') or die "Can't redirect STDERR: $!\n";
37 open (STDERR, '>&OLDERR') or die "Can't dup STDERR: $!\n";
47 next until $_ eq "###\n";
49 last if $_ eq "###\n";
50 my ($option, $value) = split;
51 $options{$option} = $value;
53 open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
55 last if $_ eq "###\n";
59 my $parser = Pod::Man->new (%options) or die "Cannot create parser\n";
60 open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
62 $parser->parse_from_file ('tmp.pod', \*OUT);
66 open (TMP, 'out.tmp') or die "Cannot open out.tmp: $!\n";
76 unlink ('tmp.pod', 'out.tmp');
79 last if $_ eq "###\n";
82 if ($output eq $expected) {
86 print "Expected\n========\n$expected\nOutput\n======\n$output\n";
89 open (ERR, 'out.err') or die "Cannot open out.err: $!\n";
99 last if $_ eq "###\n";
102 if ($errors eq $expected) {
106 print "Expected errors:\n ${expected}Errors:\n $errors";
111 # Below the marker are bits of POD and corresponding expected text output.
112 # This is used to test specific features or problems with Pod::Man. The
113 # input and output are separated by lines containing only ###.
125 C<foo B<bar I<baz>> I<bay>>
128 .IX Header "FIXED FONTS"
129 \&\f(CR\*(C`foo \f(CYbar \f(CXbaz\f(CY\f(CR \f(CWbay\f(CR\*(C'\fR
149 .IX Header "POD ERRORS"
150 Hey! \fBThe above document had some coding errors, which are explained below:\fR
151 .IP "Around line 7:" 4
152 .IX Item "Around line 7:"
153 You forgot a '=back' before '=head1'
174 tmp.pod around line 7: You forgot a '=back' before '=head1'