]> git.refcnt.org Git - colorize.git/commitdiff
Test count of sequences being printed
authorSteven Schubiger <stsc@refcnt.org>
Sun, 3 Mar 2013 14:28:31 +0000 (15:28 +0100)
committerSteven Schubiger <stsc@refcnt.org>
Sun, 3 Mar 2013 14:28:31 +0000 (15:28 +0100)
test.pl

diff --git a/test.pl b/test.pl
index c7db5bfca7feba28becea409975f90c4b995f598..ecfe9a9761b1cf1a0bc355df5baf54d7017a3211 100755 (executable)
--- a/test.pl
+++ b/test.pl
@@ -7,7 +7,7 @@ use constant true => 1;
 use File::Temp qw(tempfile tmpnam);
 use Test::More;
 
-my $tests = 14;
+my $tests = 15;
 
 my %BUF_SIZE = (
    normal => 1024,
@@ -69,6 +69,11 @@ SKIP: {
 
     is_deeply([split /\n/, qx(cat $infile2 | $program none/none)], [split /\n/, $repeated], "read ${\length $repeated} bytes (BUF_SIZE=$BUF_SIZE{normal})");
 
+    my $colored_text = qx(echo "foo bar baz" | $program red);
+    my $sequences = 0;
+    $sequences++ while $colored_text =~ /\e\[\d+m/g;
+    is($sequences, 2, 'count of sequences printed');
+
     is(qx(echo -n "hello\nworld\r\n" | $program none/none), "hello\nworld\r\n", 'stream mode');
 
     is(system("echo \"hello world\" | $program random --exclude-random=black >/dev/null 2>&1"), 0, 'switch exclude-random');