From eb322687409127e0519f1305ce1763fab10508ce Mon Sep 17 00:00:00 2001 From: Steven Schubiger Date: Sat, 3 Aug 2024 23:00:20 +0200 Subject: Don't increment rainbow color with partial line --- test.pl | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'test.pl') diff --git a/test.pl b/test.pl index 8294e8f..375df03 100755 --- a/test.pl +++ b/test.pl @@ -13,7 +13,7 @@ use Getopt::Long qw(:config no_auto_abbrev no_ignore_case); use Test::Harness qw(runtests); use Test::More; -my $tests = 36; +my $tests = 38; my $valgrind_cmd = ''; { @@ -135,6 +135,23 @@ SKIP: { is_deeply([split /\n/, qx(cat $infile2 | $valgrind_cmd$program none/none)], [split /\n/, $repeated], "read ${\length $repeated} bytes (BUF_SIZE=$BUF_SIZE{normal})"); + SKIP: { + my $program_buf = tmpnam(); + skip 'compiling failed (short buffer)', 2 unless system("$compiler -DTEST -DBUF_SIZE=$BUF_SIZE{short} -o $program_buf $source") == 0; + + my $short_text = 'foo bar baz' x 2; + + is(qx(printf %s "$short_text" | $valgrind_cmd$program_buf blue --rainbow-fg), + "\e[34mfoo bar ba\e[0m\e[34mzfoo bar b\e[0m\e[34maz\e[0m", + "partial line (BUF_SIZE=$BUF_SIZE{short}, rainbow-fg)"); + + is(qx(printf %s "$short_text" | $valgrind_cmd$program_buf blue/black --rainbow-bg), + "\e[40m\e[34mfoo bar ba\e[0m\e[40m\e[34mzfoo bar b\e[0m\e[40m\e[34maz\e[0m", + "partial line (BUF_SIZE=$BUF_SIZE{short}, rainbow-bg)"); + + unlink $program_buf; + } + { my $colored_text = qx(printf '%s\n' "foo bar baz" | $valgrind_cmd$program red); my $sequences = 0; -- cgit v1.2.3