aboutsummaryrefslogtreecommitdiffstats
path: root/t/conf
diff options
context:
space:
mode:
authorGravatar Steven Schubiger <stsc@refcnt.org> 2024-07-25 14:35:26 +0200
committerGravatar Steven Schubiger <stsc@refcnt.org> 2024-07-25 14:35:26 +0200
commit369e45fece49bb8487b8924a0851cc0ef8c6fbb8 (patch)
treed59932c0ba5c338e06490c3fab762836d16c1616 /t/conf
parent743e75340d0882c7338eee51e03148984774a532 (diff)
downloadcolorize-369e45fece49bb8487b8924a0851cc0ef8c6fbb8.tar.gz
colorize-369e45fece49bb8487b8924a0851cc0ef8c6fbb8.tar.bz2
Add initial implementation of foreground color rainbow mode
Diffstat (limited to 't/conf')
-rwxr-xr-xt/conf/fail.t3
-rwxr-xr-xt/conf/param.t5
-rwxr-xr-xt/conf/parse/fail.t3
-rwxr-xr-xt/conf/parse/success.t4
-rwxr-xr-xt/conf/use.t5
5 files changed, 13 insertions, 7 deletions
diff --git a/t/conf/fail.t b/t/conf/fail.t
index d3b8852..9e16a49 100755
--- a/t/conf/fail.t
+++ b/t/conf/fail.t
@@ -12,7 +12,7 @@ use IPC::Open3 qw(open3);
use Symbol qw(gensym);
use Test::More;
-my $tests = 7;
+my $tests = 8;
my $run_program_fail = sub
{
@@ -46,6 +46,7 @@ SKIP: {
[ 'attr=bold,bold', 'attr conf option has attribute \'bold\' twice or more' ],
[ 'exclude-random=random', 'exclude-random conf option must be provided a plain color' ],
[ 'omit-color-empty=unsure', 'omit-color-empty conf option is not valid' ],
+ [ 'rainbow-fg=unsure', 'rainbow-fg conf option is not valid' ],
);
foreach my $set (@set) {
open(my $fh, '>', $conf_file) or die "Cannot open `$conf_file' for writing: $!\n";
diff --git a/t/conf/param.t b/t/conf/param.t
index 520df2b..f8f535f 100755
--- a/t/conf/param.t
+++ b/t/conf/param.t
@@ -14,14 +14,15 @@ my $conf = <<'EOT';
attr=bold
color=blue
omit-color-empty=yes
+rainbow-fg=yes
EOT
my $expected = <<"EOT";
\e[1;34mfoo\e[0m
-\e[1;34mbar\e[0m
+\e[1;35mbar\e[0m
-\e[1;34mbaz\e[0m
+\e[1;36mbaz\e[0m
EOT
plan tests => $tests;
diff --git a/t/conf/parse/fail.t b/t/conf/parse/fail.t
index d2988e4..13f27ff 100755
--- a/t/conf/parse/fail.t
+++ b/t/conf/parse/fail.t
@@ -12,7 +12,7 @@ use IPC::Open3 qw(open3);
use Symbol qw(gensym);
use Test::More;
-my $tests = 9;
+my $tests = 10;
my $run_program_fail = sub
{
@@ -46,6 +46,7 @@ SKIP: {
[ 'color1=magenta', 'option \'color1\' not recognized' ],
[ 'exclude-random1=black', 'option \'exclude-random1\' not recognized' ],
[ 'omit-color-empty1=yes', 'option \'omit-color-empty1\' not recognized' ],
+ [ 'rainbow-fg1=no', 'option \'rainbow-fg1\' not recognized' ],
[ 'attr', 'option \'attr\' not followed by =' ],
[ 'attr#', 'option \'attr\' not followed by =' ],
[ 'attr bold', 'option \'attr\' not followed by =' ],
diff --git a/t/conf/parse/success.t b/t/conf/parse/success.t
index fe2d46d..1ce06b0 100755
--- a/t/conf/parse/success.t
+++ b/t/conf/parse/success.t
@@ -12,7 +12,7 @@ use IPC::Open3 qw(open3);
use Symbol qw(gensym);
use Test::More;
-my $tests = 21;
+my $tests = 23;
my $conf = <<'EOT';
# comment
@@ -30,12 +30,14 @@ color=green
color=green
exclude-random=black
omit-color-empty=yes
+rainbow-fg=no
attr=bold # comment
attr=bold # comment
attr=
color=
exclude-random=
omit-color-empty=
+rainbow-fg=
EOT
my $run_program_succeed = sub
diff --git a/t/conf/use.t b/t/conf/use.t
index 0a695df..5132afa 100755
--- a/t/conf/use.t
+++ b/t/conf/use.t
@@ -14,6 +14,7 @@ my $conf = <<'EOT';
attr=underscore
color=yellow # tested also in color.t
omit-color-empty=yes
+rainbow-fg=yes
EOT
plan tests => $tests;
@@ -38,9 +39,9 @@ EOT
is(qx($program $infile1), <<"EOT", 'use config');
\e[4;33mfoo\e[0m
-\e[4;33mbar\e[0m
+\e[4;34mbar\e[0m
-\e[4;33mbaz\e[0m
+\e[4;35mbaz\e[0m
EOT
my $infile2 = $write_to_tmpfile->('foo');