diff options
author | Steven Schubiger <stsc@refcnt.org> | 2024-07-25 14:35:26 +0200 |
---|---|---|
committer | Steven Schubiger <stsc@refcnt.org> | 2024-07-25 14:35:26 +0200 |
commit | 369e45fece49bb8487b8924a0851cc0ef8c6fbb8 (patch) | |
tree | d59932c0ba5c338e06490c3fab762836d16c1616 /test.pl | |
parent | 743e75340d0882c7338eee51e03148984774a532 (diff) | |
download | colorize-369e45fece49bb8487b8924a0851cc0ef8c6fbb8.tar.gz colorize-369e45fece49bb8487b8924a0851cc0ef8c6fbb8.tar.bz2 |
Add initial implementation of foreground color rainbow mode
Diffstat (limited to 'test.pl')
-rwxr-xr-x | test.pl | 16 |
1 files changed, 14 insertions, 2 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 = 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'); |