3 # text-options.t -- Additional tests for Pod::Text options.
5 # Copyright 2002, 2004, 2006, 2008 by 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::Text->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);
65 open (TMP, 'out.tmp') or die "Cannot open out.tmp: $!\n";
72 1 while unlink ('tmp.pod', 'out.tmp');
75 last if $_ eq "###\n";
78 if ($output eq $expected) {
82 print "Expected\n========\n$expected\nOutput\n======\n$output\n";
85 open (ERR, 'out.err') or die "Cannot open out.err: $!\n";
95 last if $_ eq "###\n";
98 if ($errors eq $expected) {
102 print "Expected errors:\n ${expected}Errors:\n $errors";
107 # Below the marker are bits of POD and corresponding expected text output.
108 # This is used to test specific features or problems with Pod::Text. The
109 # input and output are separated by lines containing only ###.
156 This is some body text that is long enough to be a paragraph that wraps,
157 thereby testing margins with wrapped paragraphs.
159 This is some verbatim text.
165 This is a test of an indented paragraph.
167 This is another indented paragraph.
172 This is some body text that is long enough to be a paragraph that
173 wraps, thereby testing margins with wrapped paragraphs.
175 This is some verbatim text.
177 Test This is a test of an indented paragraph.
179 This is another indented paragraph.
187 This is some random text.
188 This is more random text.
190 This is some random text.
191 This is more random text.
199 This is more random text.
201 This is some random text.
202 This is more random text.
204 This is some random text.
205 This is more random text.
211 This is more random text.
220 Whitespace around C<< this. >> must be ignored per perlpodspec. >>
221 needs to eat all of the space in front of it.
226 Whitespace around "this." must be ignored per perlpodspec. >> needs to
227 eat all of the space in front of it.
246 Hey! The above document had some coding errors, which are explained
250 You forgot a '=back' before '=head1'
270 tmp.pod around line 7: You forgot a '=back' before '=head1'