diff options
author | Steven Schubiger <stsc@refcnt.org> | 2024-08-03 23:00:20 +0200 |
---|---|---|
committer | Steven Schubiger <stsc@refcnt.org> | 2024-08-03 23:00:20 +0200 |
commit | eb322687409127e0519f1305ce1763fab10508ce (patch) | |
tree | 8c0430cf0e5717f9496bc12ec70492a825f8c827 /test.pl | |
parent | 1d13bd538f5d903213639db98ff1c7268f9a2ea7 (diff) | |
download | colorize-eb322687409127e0519f1305ce1763fab10508ce.tar.gz colorize-eb322687409127e0519f1305ce1763fab10508ce.tar.bz2 |
Diffstat (limited to 'test.pl')
-rwxr-xr-x | test.pl | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -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; |