2 # $Id: termcap.t,v 1.2 2005/11/28 23:38:02 eagle Exp $
4 # termcap.t -- Additional specialized tests for Pod::Text::Termcap.
6 # Copyright 2002, 2004 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;
27 # Hard-code a few values to try to get reproducible results.
30 $ENV{TERMCAP} = 'xterm:co=80:do=^J:md=\E[1m:us=\E[4m:me=\E[m';
32 use Pod::Text::Termcap;
39 next until $_ eq "###\n";
40 open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
42 last if $_ eq "###\n";
46 my $parser = Pod::Text::Termcap->new or die "Cannot create parser\n";
47 $parser->parse_from_file ('tmp.pod', 'out.tmp');
49 open (TMP, 'out.tmp') or die "Cannot open out.tmp: $!\n";
56 unlink ('tmp.pod', 'out.tmp');
59 last if $_ eq "###\n";
62 if ($output eq $expected) {
66 print "Expected\n========\n$expected\nOutput\n======\n$output\n";
71 # Below the marker are bits of POD and corresponding expected output. This is
72 # used to test specific features or problems with Pod::Text::Termcap. The
73 # input and output are separated by lines containing only ###.
80 B<I<Do>> I<B<not>> B<I<include>> B<I<formatting codes when>> B<I<wrapping>>.
83 \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.