2 # $Id: filehandle.t,v 1.1 2006-02-19 23:02:37 eagle Exp $
4 # filehandle.t -- Test the parse_from_filehandle interface.
6 # Copyright 2006 by Russ Allbery <rra@stanford.edu>
8 # This program is free software; you may redistribute it and/or modify it
9 # under the same terms as Perl itself.
13 if ($ENV{PERL_CORE}) {
16 unshift (@INC, '../blib/lib');
18 unshift (@INC, '../blib/lib');
24 print "not ok 1\n" unless $loaded;
33 my $man = Pod::Man->new or die "Cannot create parser\n";
34 my $text = Pod::Text->new or die "Cannot create parser\n";
37 next until $_ eq "###\n";
38 open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
40 last if $_ eq "###\n";
44 open (IN, '< tmp.pod') or die "Cannot open tmp.pod: $!\n";
45 open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
46 $man->parse_from_filehandle (\*IN, \*OUT);
49 open (OUT, 'out.tmp') or die "Cannot open out.tmp: $!\n";
50 while (<OUT>) { last if /^\.TH/ }
59 last if $_ eq "###\n";
62 if ($output eq $expected) {
66 print "Expected\n========\n$expected\nOutput\n======\n$output\n";
69 open (IN, '< tmp.pod') or die "Cannot open tmp.pod: $!\n";
70 open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
71 $text->parse_from_filehandle (\*IN, \*OUT);
74 open (OUT, 'out.tmp') or die "Cannot open out.tmp: $!\n";
80 unlink ('tmp.pod', 'out.tmp');
83 last if $_ eq "###\n";
86 if ($output eq $expected) {
90 print "Expected\n========\n$expected\nOutput\n======\n$output\n";
95 # Below the marker are bits of POD, corresponding expected nroff output, and
96 # corresponding expected text output. The input and output are separated by
97 # lines containing only ###.
104 gcc - GNU project C and C++ compiler
108 Other mentions of C++.
111 gcc \- GNU project C and C++ compiler
114 Other mentions of \*(C+.
117 gcc - GNU project C and C++ compiler
120 Other mentions of C++.