Skip to content

Commit

Permalink
add reset in the end to cancel colours
Browse files Browse the repository at this point in the history
  • Loading branch information
pitr committed Jul 7, 2011
1 parent 745e356 commit e118e5a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/a.rb
@@ -1,6 +1,6 @@
$n=Time.now;$f=[];$c=[];$a=0;class A;def a c;$a+=1;print c ?"\e[32m.\e[0m":($f\
<<caller[0];"\e[31mF\e[0m");end;def self.inherited(b);$c<<b;end;end;at_exit{$c\
.map{|t|i=t.new;i.setup rescue nil;$t=t.instance_methods(false).map{|m|i.send\
m if !%w(setup teardown).include? m}.compact;i.teardown rescue nil};print "\n#{
Time.now-$n} s.\n#{$t.size} tests, #{$a} assertions, #{$f.size} failures\n\n"+
$f.map{|f|"\e[31mFailure\e[0m \e[97m@\e[33m #{f}"}.join("\n");exit -1 if $f[0]}
at_exit{$c.map{|t|i=t.new;i.setup rescue 0;$t=t.instance_methods(!0).map{|m|i.\
send m if !(%w(setup teardown)&[m])[0]}.compact;i.teardown rescue 0};printf"\e\
[0m\n%fs\n%d tests, %d assertions, %d failures\n\n%s",Time.now-$n,$t.size,$a,$f
.size,$f.map{|f|"\e[1;31mFailure\e[0m \e[97m@\e[33m #{f}\e[0m"}.join(?\n);exit\
1 if$f[0]};class A;def a c;$a+=1;print"\e[3"+(c ?"2m.":"1mF");$f<<caller[0]if !
c;end;def A.inherited(b);$c<<b;end;end; $n = Time.now; $f = []; $c = []; $a = 0

0 comments on commit e118e5a

Please sign in to comment.