aboutsummaryrefslogtreecommitdiffstats
path: root/test.pl
diff options
context:
space:
mode:
Diffstat (limited to 'test.pl')
-rwxr-xr-xtest.pl16
1 files changed, 14 insertions, 2 deletions
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');