automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 8/5] tap: support colorization of testsuite progress output


From: Ralf Wildenhues
Subject: Re: [PATCH 8/5] tap: support colorization of testsuite progress output
Date: Fri, 22 Jul 2011 00:22:43 +0200

> On Tuesday 19 July 2011, Ralf Wildenhues wrote:
> Below is what I've squashed in.  OK?

Sure, thanks!

> --- a/lib/tap-driver
> +++ b/lib/tap-driver
> @@ -230,17 +230,24 @@ sub colored ($$)
>  
>  sub decorate_result ($)
>  {
> -  return $_[0] unless $cfg{"color-tests"};
> -  # Best way to simulate a 'switch' construct here.
> -  for (@_)
> +  my $result = shift;
> +  return $result unless $cfg{"color-tests"};
> +  my %color_for_result =
> +    (
> +      "ERROR" => 'mgn',
> +      "PASS"  => 'grn',
> +      "XPASS" => 'red',
> +      "FAIL"  => 'red',
> +      "XFAIL" => 'lgn',
> +      "SKIP"  => 'blu',
> +    );
> +  if (my $color = $color_for_result{$result})
> +    {
> +      return colored ($color, $result);
> +    }
> +  else
>      {
> -      $_ eq "ERROR" and return colored ('mgn', $_);
> -      $_ eq "PASS"  and return colored ('grn', $_);
> -      $_ eq "XPASS" and return colored ('red', $_);
> -      $_ eq "FAIL"  and return colored ('red', $_);
> -      $_ eq "XFAIL" and return colored ('lgn', $_);
> -      $_ eq "SKIP"  and return colored ('blu', $_);
> -      return $_; # Don't colorize unknown stuff.
> +      return $result; # Don't colorize unknown stuff.
>      }
>  }
>  
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]