3 # termcap.t -- Additional specialized tests for Pod::Text::Termcap.
5 # Copyright 2002, 2004, 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 => 4;
22 BEGIN { use_ok ('Pod::Text::Termcap') }
24 # Hard-code a few values to try to get reproducible results.
27 $ENV{TERMCAP} = 'xterm:co=80:do=^J:md=\E[1m:us=\E[4m:me=\E[m';
29 my $parser = Pod::Text::Termcap->new;
30 isa_ok ($parser, 'Pod::Text::Termcap', 'Parser module');
33 next until $_ eq "###\n";
34 open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
36 last if $_ eq "###\n";
40 open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
41 $parser->parse_from_file ('tmp.pod', \*OUT);
43 open (TMP, 'out.tmp') or die "Cannot open out.tmp: $!\n";
50 1 while unlink ('tmp.pod', 'out.tmp');
53 last if $_ eq "###\n";
56 is ($output, $expected, "Output correct for test $n");
60 # Below the marker are bits of POD and corresponding expected output. This is
61 # used to test specific features or problems with Pod::Text::Termcap. The
62 # input and output are separated by lines containing only ###.
69 B<I<Do>> I<B<not>> B<I<include>> B<I<formatting codes when>> B<I<wrapping>>.
72 \e[1m
\e[4mDo
\e[m
\e[m
\e[4m
\e[1mnot
\e[m
\e[m
\e[1m
\e[4minclude
\e[m
\e[m
\e[1m
\e[4mformatting codes when
\e[m
\e[m
\e[1m
\e[4mwrapping
\e[m
\e[m.