3 # filehandle.t -- Test the parse_from_filehandle interface.
5 # Copyright 2006, 2009 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');
21 use Test::More tests => 6;
28 my $man = Pod::Man->new;
29 isa_ok ($man, 'Pod::Man', 'Pod::Man parser object');
30 my $text = Pod::Text->new;
31 isa_ok ($text, 'Pod::Text', 'Pod::Text parser object');
33 next until $_ eq "###\n";
34 open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
36 last if $_ eq "###\n";
41 # Test Pod::Man output.
42 open (IN, '< tmp.pod') or die "Cannot open tmp.pod: $!\n";
43 open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
44 $man->parse_from_filehandle (\*IN, \*OUT);
47 open (OUT, 'out.tmp') or die "Cannot open out.tmp: $!\n";
48 while (<OUT>) { last if /^\.nh/ }
57 last if $_ eq "###\n";
60 is ($output, $expected, 'Pod::Man output is correct');
62 # Test Pod::Text output.
63 open (IN, '< tmp.pod') or die "Cannot open tmp.pod: $!\n";
64 open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
65 $text->parse_from_filehandle (\*IN, \*OUT);
68 open (OUT, 'out.tmp') or die "Cannot open out.tmp: $!\n";
74 1 while unlink ('tmp.pod', 'out.tmp');
77 last if $_ eq "###\n";
80 is ($output, $expected, 'Pod::Text output is correct');
83 # Below the marker are bits of POD, corresponding expected nroff output, and
84 # corresponding expected text output. The input and output are separated by
85 # lines containing only ###.
92 gcc - GNU project C and C++ compiler
96 Other mentions of C++.
99 gcc \- GNU project C and C++ compiler
102 Other mentions of \*(C+.
105 gcc - GNU project C and C++ compiler
108 Other mentions of C++.