]>
git.refcnt.org Git - colorize.git/blob - t/conf/color.t
7 use Colorize
::Common
qw(:defaults $write_to_tmpfile);
8 use File::Temp qw(tmpnam);
16 my $program = tmpnam
();
17 my $conf_file = tmpnam
();
19 skip
'compiling failed (color)', $tests unless system(qq($compiler -DTEST
-DCONF_FILE_TEST
=\"$conf_file\" -o
$program $source)) == 0;
21 my $infile = $write_to_tmpfile->('foo');
23 open(my $fh, '>', $conf_file) or die "Cannot open `$conf_file' for writing: $!\n";
24 print {$fh} "color=green\n";
27 is
(qx(printf %s "foo" | $program -), "\e[32mfoo\e[0m", 'color from config (stdin)');
28 is
(qx($program $infile), "\e[32mfoo\e[0m", 'color from config (file)');
29 is
(qx(printf %s "foo" | $program none
/none
), 'foo', 'read from stdin');
30 is
(qx($program none
/none
$infile), 'foo', 'read from file');