diff options
Diffstat (limited to 't')
-rwxr-xr-x | t/conf/fail.t | 20 | ||||
-rwxr-xr-x | t/conf/parse/fail.t | 3 | ||||
-rwxr-xr-x | t/conf/parse/success.t | 4 | ||||
-rwxr-xr-x | t/conf/use.t | 10 | ||||
-rwxr-xr-x | t/fail.t | 8 |
5 files changed, 26 insertions, 19 deletions
diff --git a/t/conf/fail.t b/t/conf/fail.t index 9e16a49..0a16f8e 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 = 8; +my $tests = 10; my $run_program_fail = sub { @@ -39,14 +39,16 @@ SKIP: { my $infile = $write_to_tmpfile->(''); my @set = ( - [ 'attr=:', 'attr conf option must be provided a string' ], - [ 'attr=bold:underscore', 'attr conf option must have strings separated by ,' ], - [ 'attr=b0ld', 'attr conf option attribute \'b0ld\' is not valid' ], - [ 'attr=b0ld,underscore', 'attr conf option attribute \'b0ld\' is not valid' ], # handle comma - [ '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' ], + [ 'attr=:', 'attr conf option must be provided a string' ], + [ 'attr=bold:underscore', 'attr conf option must have strings separated by ,' ], + [ 'attr=b0ld', 'attr conf option attribute \'b0ld\' is not valid' ], + [ 'attr=b0ld,underscore', 'attr conf option attribute \'b0ld\' is not valid' ], # handle comma + [ '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' ], + [ 'rainbow-bg=unsure', 'rainbow-bg conf option is not valid' ], + [ "rainbow-fg=yes\nrainbow-bg=no", 'mutually exclusive' ], ); foreach my $set (@set) { open(my $fh, '>', $conf_file) or die "Cannot open `$conf_file' for writing: $!\n"; diff --git a/t/conf/parse/fail.t b/t/conf/parse/fail.t index 13f27ff..f3aef48 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 = 10; +my $tests = 11; my $run_program_fail = sub { @@ -47,6 +47,7 @@ SKIP: { [ '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' ], + [ 'rainbow-bg1=no', 'option \'rainbow-bg1\' 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 1ce06b0..9dd4937 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 = 23; +my $tests = 25; my $conf = <<'EOT'; # comment @@ -31,6 +31,7 @@ color=green exclude-random=black omit-color-empty=yes rainbow-fg=no +rainbow-bg=no attr=bold # comment attr=bold # comment attr= @@ -38,6 +39,7 @@ color= exclude-random= omit-color-empty= rainbow-fg= +rainbow-bg= EOT my $run_program_succeed = sub diff --git a/t/conf/use.t b/t/conf/use.t index 5132afa..8c0586e 100755 --- a/t/conf/use.t +++ b/t/conf/use.t @@ -12,9 +12,9 @@ my $tests = 21; my $conf = <<'EOT'; attr=underscore -color=yellow # tested also in color.t +color=yellow/black # tested also in color.t omit-color-empty=yes -rainbow-fg=yes +rainbow-bg=yes EOT plan tests => $tests; @@ -37,11 +37,11 @@ EOT close($fh); is(qx($program $infile1), <<"EOT", 'use config'); -\e[4;33mfoo\e[0m +\e[40m\e[4;33mfoo\e[0m -\e[4;34mbar\e[0m +\e[41m\e[4;33mbar\e[0m -\e[4;35mbaz\e[0m +\e[42m\e[4;33mbaz\e[0m EOT my $infile2 = $write_to_tmpfile->('foo'); @@ -12,7 +12,7 @@ use IPC::Open3 qw(open3); use Symbol qw(gensym); use Test::More; -my $tests = 29; +my $tests = 31; my $run_program_fail = sub { @@ -65,10 +65,12 @@ SKIP: { [ 'random/default', 'cannot be combined with' ], [ 'none/random', 'cannot be combined with' ], [ 'default/random', 'cannot be combined with' ], + [ '--rainbow-fg --rainbow-bg', 'mutually exclusive' ], + [ 'green --rainbow-bg', 'background color required with' ], [ 'white/none --rainbow-fg', 'cannot be used with --rainbow-fg' ], - [ 'white/default --rainbow-fg', 'cannot be used with --rainbow-fg' ], + [ 'white/default --rainbow-bg', 'cannot be used with --rainbow-bg' ], [ 'none/white --rainbow-fg', 'cannot be used with --rainbow-fg' ], - [ 'default/white --rainbow-fg', 'cannot be used with --rainbow-fg' ], + [ 'default/white --rainbow-bg', 'cannot be used with --rainbow-bg' ], ); foreach my $set (@set) { ok($run_program_fail->($program, $set->[0], $set->[1]), $set->[1]); |