aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Steven Schubiger <stsc@refcnt.org>2017-10-08 18:19:15 +0200
committerGravatar Steven Schubiger <stsc@refcnt.org>2017-10-08 18:19:15 +0200
commitfd286538c23b3d28dc7aa0165fdb54456042d0fe (patch)
treed9ec5a4be7347b88b7786cb4818690c02218d87b
parent7ee1a09534edb8d84d3172413066d7a76edd0291 (diff)
downloadcolorize-fd286538c23b3d28dc7aa0165fdb54456042d0fe.tar.gz
colorize-fd286538c23b3d28dc7aa0165fdb54456042d0fe.tar.bz2
Test substituting 'none' foreground color
-rwxr-xr-xtest.pl9
1 files changed, 8 insertions, 1 deletions
diff --git a/test.pl b/test.pl
index ddd6288..f0bea0b 100755
--- a/test.pl
+++ b/test.pl
@@ -12,7 +12,7 @@ use Getopt::Long qw(:config no_auto_abbrev no_ignore_case);
use Test::Harness qw(runtests);
use Test::More;
-my $tests = 28;
+my $tests = 29;
my $valgrind_cmd = '';
{
@@ -132,6 +132,13 @@ SKIP: {
is($sequences, 2, 'count of sequences printed');
}
+ {
+ # Check that a 'none' foreground color (with a background color present)
+ # will be substituted by 'default'.
+ my $colored_text = qx(printf '%s' "foo bar baz" | $valgrind_cmd$program none/black);
+ is($colored_text, "\e[40m\e[39mfoo bar baz\e[0m", 'no color sequences printed');
+ }
+
is(qx(printf %s "hello\nworld\r\n" | $valgrind_cmd$program none/none), "hello\nworld\r\n", 'stream mode');
is(system(qq(printf '%s\n' "hello world" | $valgrind_cmd$program random --exclude-random=black >/dev/null)), 0, 'switch exclude-random');