Skip to content

Instantly share code, notes, and snippets.

@yaotti
Created December 19, 2010 12:06
Show Gist options
  • Save yaotti/747289 to your computer and use it in GitHub Desktop.
Save yaotti/747289 to your computer and use it in GitHub Desktop.
Print the result of last tests
#!/usr/bin/env perl
use strict;
use warnings;
use Cwd;
use YAML::Any;
use Term::ANSIColor;
my $prove_file = Cwd::getcwd() . "/.prove";
if (-f $prove_file) {
my $test_results = YAML::Any::LoadFile($prove_file)->{tests};
my $failed_tests = [];
for my $file (keys %$test_results) {
push @$failed_tests, $file if $test_results->{$file}->{last_result} > 0;
}
if (@$failed_tests) {
print colored 'NG: ', 'red';
print join ", ", map { sprintf "%s", $_ } @$failed_tests;
}else {
print colored 'OK', 'green';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment