3 # filehandle.t -- Test the parse_from_filehandle interface.
5 # Copyright 2006 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;
32 my $man = Pod::Man->new or die "Cannot create parser\n";
33 my $text = Pod::Text->new or die "Cannot create parser\n";
36 next until $_ eq "###\n";
37 open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
39 last if $_ eq "###\n";
43 open (IN, '< tmp.pod') or die "Cannot open tmp.pod: $!\n";
44 open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
45 $man->parse_from_filehandle (\*IN, \*OUT);
48 open (OUT, 'out.tmp') or die "Cannot open out.tmp: $!\n";
49 while (<OUT>) { last if /^\.nh/ }
58 last if $_ eq "###\n";
61 if ($output eq $expected) {
65 print "Expected\n========\n$expected\nOutput\n======\n$output\n";
68 open (IN, '< tmp.pod') or die "Cannot open tmp.pod: $!\n";
69 open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
70 $text->parse_from_filehandle (\*IN, \*OUT);
73 open (OUT, 'out.tmp') or die "Cannot open out.tmp: $!\n";
79 unlink ('tmp.pod', 'out.tmp');
82 last if $_ eq "###\n";
85 if ($output eq $expected) {
89 print "Expected\n========\n$expected\nOutput\n======\n$output\n";
94 # Below the marker are bits of POD, corresponding expected nroff output, and
95 # corresponding expected text output. The input and output are separated by
96 # lines containing only ###.
103 gcc - GNU project C and C++ compiler
107 Other mentions of C++.
110 gcc \- GNU project C and C++ compiler
113 Other mentions of \*(C+.
116 gcc - GNU project C and C++ compiler
119 Other mentions of C++.