-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add difftool for nice results comparing
- 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.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | ||
} | ||
} | ||
} |