+ my @values = (@fg_colors, @bg_colors, @bold_colors, 0);
+
+ my $ok = true;
+ foreach my $value (@values) {
+ $ok &= qx(printf %s "\e[${value}m" | $valgrind_cmd$program --clean) eq '';
+ }
+ ok($ok, 'clean color sequences');
+ }
+
+ my $check_clean = sub
+ {
+ my ($type) = @_;
+
+ my $switch = "--$type";
+
+ is(qx(printf %s "\e[35mhello\e[0m \e[36mworld\e[0m" | $valgrind_cmd$program $switch), 'hello world', "$type colored words");
+ 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");
+
+ {
+ my $ok = true;
+ foreach my $option (qw(--attr=bold --exclude-random=black --omit-color-empty)) {
+ $ok &= qx($valgrind_cmd$program $option $switch $infile1 2>&1 >/dev/null) =~ /switch has no meaning with/;
+ }
+ ok($ok, "$type strict options");
+ }
+ };