Skip to content

Commit

Permalink
Add difftool for nice results comparing
Browse files Browse the repository at this point in the history
  • Loading branch information
Tadeusz Sośnierz committed Aug 4, 2012
1 parent 75131c9 commit 34e1831
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions difftool
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/usr/bin/env perl6
use v6;
use JSON::Tiny;
use Term::ANSIColor;

sub MAIN($old-results, $new-results) {
my %old = from-json slurp $old-results;
my %new = from-json slurp $new-results;
%old.delete('_statistics');
%new.delete('_statistics');

sub improved($m, $stage) {
my $was = %old{$m}{$stage} // False;
my $is = %new{$m}{$stage} // False;

if !$was and $is {
return True;
}
return False;
}

sub regressed($m, $stage) {
my $was = %old{$m}{$stage} // False;
my $is = %new{$m}{$stage} // False;

if $was and !$is {
return True;
}
return False;
}

sub good($x) {
colored($x, 'bold green')
}
sub bad($x) {
colored($x, 'bold red')
}

for %new.keys.sort -> $m {
if not defined %old{$m} {
say colored "New project: $m", 'bold yellow'
}
}

for %old.keys.sort -> $m {
if improved($m, 'build') {
say good("$m now builds correctly")
} elsif regressed($m, 'build') {
say bad("$m doesn't build anymore");
next;
}

if improved($m, 'test') {
say good("$m now passes its tests")
}
if regressed($m, 'test') {
say bad("$m now fails its tests")
}
}
}

0 comments on commit 34e1831

Please sign in to comment.