#!/usr/bin/perl -w # Simple Perl test suite colorizer # Jonathan Leto # Wed Feb 20 19:30:21 EST 2008 use strict; use Term::ANSIColor qw(:constants); $Term::ANSIColor::AUTORESET = 1; # Example bash alias # function t () { # ./Build test --verbose 1 --test_files $1 |colortest # } while (<>){ if (/SKIP/) { print YELLOW $_; } elsif(/^ok/ || /Result: PASS/ || /All tests successful/){ print BOLD GREEN $_; } elsif( /^not ok/ || /Dubious/ || /Result: FAIL/ || /Bad plan/ || /Failed/ || /Non-zero exit status/ ){ print BOLD RED $_; } elsif( /^1\.\.\d+/ || m!^t/.+! ){ print BOLD BLUE $_; } elsif (/^Files=/){ print BOLD MAGENTA $_; } else { print BOLD $_; } }