aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Steven Schubiger <stsc@refcnt.org> 2017-04-19 18:00:36 +0200
committerGravatar Steven Schubiger <stsc@refcnt.org> 2017-04-19 18:00:36 +0200
commit7642c25f95efc7dc7705592d302c5210a3e83394 (patch)
tree97ebaca4e1306bcdedd651373d4f4771fffaaa42
parent7c04baad866cced3a3171af6bbe9f3ce5696db6f (diff)
downloadcolorize-7642c25f95efc7dc7705592d302c5210a3e83394.tar.gz
colorize-7642c25f95efc7dc7705592d302c5210a3e83394.tar.bz2
Add tests for --attr
-rwxr-xr-xtest.pl23
1 files changed, 22 insertions, 1 deletions
diff --git a/test.pl b/test.pl
index a44395f..ddd6288 100755
--- a/test.pl
+++ b/test.pl
@@ -12,7 +12,7 @@ use Getopt::Long qw(:config no_auto_abbrev no_ignore_case);
use Test::Harness qw(runtests);
use Test::More;
-my $tests = 24;
+my $tests = 28;
my $valgrind_cmd = '';
{
@@ -82,6 +82,19 @@ SKIP: {
is(qx(printf %s "hello world" | $program Magenta | $valgrind_cmd$program $switch), 'hello world', "$type colored line");
is_deeply([split /\n/, qx($program cyan $infile1 | $valgrind_cmd$program $switch)], [split /\n/, $text], "$type colored text");
+ {
+ my @attrs = qw(bold underscore blink reverse concealed);
+
+ my $ok = true;
+ foreach my $attr (@attrs) {
+ $ok &= qx(printf %s "$attr" | $program green --attr=$attr | $valgrind_cmd$program $switch) eq $attr;
+ }
+ ok($ok, "$type attribute");
+
+ my $attrs = join ',', @attrs;
+ is(qx(printf %s "$attrs" | $program green --attr=$attrs | $valgrind_cmd$program $switch), $attrs, "$type attributes");
+ }
+
ok(qx(printf %s "\e[\e[33m" | $valgrind_cmd$program $switch) eq "\e[", "$type with invalid sequence");
};
@@ -145,6 +158,14 @@ EOT
system(qq(printf '%s\n' "$bold_color" | $program $bold_color));
}
+ print <<'EOT';
+Attributes
+==========
+EOT
+ foreach my $attr (qw(bold underscore blink reverse concealed)) {
+ system(qq(printf '%s\n' "$attr" | $program green --attr=$attr));
+ }
+
unlink $program;
};