]>
git.refcnt.org Git - colorize.git/blob - t/conf/use.t
7 use Colorize
::Common
qw(:defaults $write_to_tmpfile);
8 use File::Temp qw(tmpnam);
15 color=yellow/black # tested also in color.t
23 my $program = tmpnam
();
24 my $conf_file = tmpnam
();
26 skip
'compiling failed (use config)', $tests unless system(qq($compiler -DTEST
-DCONF_FILE_TEST
=\"$conf_file\" -o
$program $source)) == 0;
28 my $infile1 = $write_to_tmpfile->(<<'EOT');
35 open(my $fh, '>', $conf_file) or die "Cannot open `$conf_file' for writing: $!\n";
39 is
(qx($program $infile1), <<"EOT", 'use config');
40 \e[40m\e[4;33mfoo\e[0m
42 \e[41m\e[4;33mbar\e[0m
44 \e[42m\e[4;33mbaz\e[0m
46 my $infile2 = $write_to_tmpfile->('foo');
48 open($fh, '>', $conf_file) or die "Cannot open `$conf_file' for writing: $!\n";
49 print {$fh} "exclude-random=black\n";
52 for (my $i = 1; $i <= 20; $i++) {
53 like
(qx($program random
$infile2), qr/^\e\[3[1-7]mfoo\e\[0m$/, 'use exclude-random');