2 # $Id: color.t,v 1.3 2006-01-28 22:31:50 eagle Exp $
4 # color.t -- Additional specialized tests for Pod::Text::Color.
6 # Copyright 2002, 2004, 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;
27 eval { require Term::ANSIColor };
30 print "ok $_ # skip\n";
35 require Pod::Text::Color;
40 my $parser = Pod::Text::Color->new or die "Cannot create parser\n";
43 next until $_ eq "###\n";
44 open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
46 last if $_ eq "###\n";
50 open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
51 $parser->parse_from_file ('tmp.pod', \*OUT);
53 open (TMP, 'out.tmp') or die "Cannot open out.tmp: $!\n";
60 unlink ('tmp.pod', 'out.tmp');
63 last if $_ eq "###\n";
66 if ($output eq $expected) {
70 print "Expected\n========\n$expected\nOutput\n======\n$output\n";
75 # Below the marker are bits of POD and corresponding expected output. This is
76 # used to test specific features or problems with Pod::Text::Termcap. The
77 # input and output are separated by lines containing only ###.
84 B<I<Do>> I<B<not>> B<I<include>> B<I<formatting codes when>> B<I<wrapping>>.
87 \e[1m
\e[33mDo
\e[0m
\e[0m
\e[33m
\e[1mnot
\e[0m
\e[0m
\e[1m
\e[33minclude
\e[0m
\e[0m
\e[1m
\e[33mformatting codes when
\e[0m
\e[0m
\e[1m
\e[33mwrapping
\e[0m
\e[0m.