]> git.refcnt.org Git - colorize.git/commitdiff
Test substituting 'none' foreground color
authorSteven Schubiger <stsc@refcnt.org>
Sun, 8 Oct 2017 16:19:15 +0000 (18:19 +0200)
committerSteven Schubiger <stsc@refcnt.org>
Sun, 8 Oct 2017 16:19:15 +0000 (18:19 +0200)
test.pl

diff --git a/test.pl b/test.pl
index ddd6288d9f47c4fea961757ab1a1245dc1ee526a..f0bea0b706b02a9615f6fdde6dd94587ea4842f5 100755 (executable)
--- 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');