aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-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
-rwxr-xr-xt/fail.t56
6 files changed, 43 insertions, 33 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');
diff --git a/t/fail.t b/t/fail.t
index 10378c4..c44cb7a 100755
--- a/t/fail.t
+++ b/t/fail.t
@@ -12,7 +12,7 @@ use IPC::Open3 qw(open3);
use Symbol qw(gensym);
use Test::More;
-my $tests = 25;
+my $tests = 29;
my $run_program_fail = sub
{
@@ -40,31 +40,35 @@ SKIP: {
my $dir = tempdir(CLEANUP => true);
my @set = (
- [ '--attr=:', 'must be provided a string' ],
- [ '--attr=bold:underscore', 'must have strings separated by ,' ],
- [ '--attr=b0ld', 'attribute \'b0ld\' is not valid' ],
- [ '--attr=b0ld,underscore', 'attribute \'b0ld\' is not valid' ], # handle comma
- [ '--attr=bold,bold', 'has attribute \'bold\' twice or more' ],
- [ '--exclude-random=random', 'must be provided a plain color' ],
- [ '--clean --clean-all', 'mutually exclusive' ],
- [ '--clean file1 file2', 'more than one file' ],
- [ '--clean-all file1 file2', 'more than one file' ],
- [ '- file', 'hyphen cannot be used as color string' ],
- [ '-', 'hyphen must be preceded by color string' ],
- [ "$file file", 'cannot be used as color string' ],
- [ "$file", 'must be preceded by color string' ],
- [ "$dir", 'is not a valid file type' ],
- [ '/black', 'foreground color missing' ],
- [ 'white/', 'background color missing' ],
- [ 'white/black/yellow', 'one color pair allowed only' ],
- [ 'y3llow', 'cannot be made of non-alphabetic characters' ],
- [ 'yEllow', 'cannot be in mixed lower/upper case' ],
- [ 'None', 'cannot be bold' ],
- [ 'white/Black', 'cannot be bold' ],
- [ 'random/none', 'cannot be combined with' ],
- [ 'random/default', 'cannot be combined with' ],
- [ 'none/random', 'cannot be combined with' ],
- [ 'default/random', 'cannot be combined with' ],
+ [ '--attr=:', 'must be provided a string' ],
+ [ '--attr=bold:underscore', 'must have strings separated by ,' ],
+ [ '--attr=b0ld', 'attribute \'b0ld\' is not valid' ],
+ [ '--attr=b0ld,underscore', 'attribute \'b0ld\' is not valid' ], # handle comma
+ [ '--attr=bold,bold', 'has attribute \'bold\' twice or more' ],
+ [ '--exclude-random=random', 'must be provided a plain color' ],
+ [ '--clean --clean-all', 'mutually exclusive' ],
+ [ '--clean file1 file2', 'more than one file' ],
+ [ '--clean-all file1 file2', 'more than one file' ],
+ [ '- file', 'hyphen cannot be used as color string' ],
+ [ '-', 'hyphen must be preceded by color string' ],
+ [ "$file file", 'cannot be used as color string' ],
+ [ "$file", 'must be preceded by color string' ],
+ [ "$dir", 'is not a valid file type' ],
+ [ '/black', 'foreground color missing' ],
+ [ 'white/', 'background color missing' ],
+ [ 'white/black/yellow', 'one color pair allowed only' ],
+ [ 'y3llow', 'cannot be made of non-alphabetic characters' ],
+ [ 'yEllow', 'cannot be in mixed lower/upper case' ],
+ [ 'None', 'cannot be bold' ],
+ [ 'white/Black', 'cannot be bold' ],
+ [ 'random/none', 'cannot be combined with' ],
+ [ 'random/default', 'cannot be combined with' ],
+ [ 'none/random', 'cannot be combined with' ],
+ [ 'default/random', 'cannot be combined with' ],
+ [ 'white/none --rainbow-fg', 'cannot be used with --rainbow-fg' ],
+ [ 'white/default --rainbow-fg', 'cannot be used with --rainbow-fg' ],
+ [ 'none/white --rainbow-fg', 'cannot be used with --rainbow-fg' ],
+ [ 'default/white --rainbow-fg', 'cannot be used with --rainbow-fg' ],
);
foreach my $set (@set) {
ok($run_program_fail->($program, $set->[0], $set->[1]), $set->[1]);