From 369e45fece49bb8487b8924a0851cc0ef8c6fbb8 Mon Sep 17 00:00:00 2001 From: Steven Schubiger Date: Thu, 25 Jul 2024 14:35:26 +0200 Subject: Add initial implementation of foreground color rainbow mode --- test.pl | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'test.pl') diff --git a/test.pl b/test.pl index 928c698..5467722 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 = 32; +my $tests = 34; my $valgrind_cmd = ''; { @@ -101,7 +101,7 @@ SKIP: { { my $ok = true; - foreach my $option (qw(--attr=bold --exclude-random=black --omit-color-empty)) { + foreach my $option (qw(--attr=bold --exclude-random=black --omit-color-empty --rainbow-fg)) { $ok &= qx($valgrind_cmd$program $option $switch $infile1 2>&1 >/dev/null) =~ /switch has no meaning with/; } ok($ok, "$type strict options"); @@ -160,6 +160,18 @@ SKIP: { 'switch omit-color-empty'); } + { + my $infile = $write_to_tmpfile->("foo\nbar\nbaz"); + + is_deeply([split /\n/, qx($valgrind_cmd$program black/black --rainbow-fg $infile)], + [split /\n/, "\e[40m\e[31mfoo\e[0m\n\e[40m\e[32mbar\e[0m\n\e[40m\e[33mbaz\e[0m"], + 'switch rainbow-fg (init)'); + + is_deeply([split /\n/, qx($valgrind_cmd$program white --rainbow-fg $infile)], + [split /\n/, "\e[37mfoo\e[0m\n\e[30mbar\e[0m\n\e[31mbaz\e[0m"], + 'switch rainbow-fg (reset)'); + } + SKIP: { skip 'valgrind not found', 1 unless system('which valgrind >/dev/null 2>&1') == 0; like(qx(valgrind $program none/none $infile1 2>&1 >/dev/null), qr/no leaks are possible/, 'valgrind memleaks'); -- cgit v1.2.3