Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


cancel colours by adding reset at the end #1

merged 1 commit into from

2 participants


Failure is bold

also free 12 bytes (last line is padded with spaces for beauty)


Clever! Changing false to !0, that %w(setup teardown)&[m][0] trick (my favorite)!
Congratulations :)

@txus txus merged commit 18c9139 into txus:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 7, 2011
  1. @pitr
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 6 deletions.
  1. +6 −6 lib/a.rb
12 lib/a.rb
@@ -1,6 +1,6 @@
-$;$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\{|t|;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#{$n} s.\n#{$t.size} tests, #{$a} assertions, #{$f.size} failures\n\n"+
-${|f|"\e[31mFailure\e[0m \e[97m@\e[33m #{f}"}.join("\n");exit -1 if $f[0]}
+at_exit{${|t|;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",$n,$t.size,$a,$f
+.size,${|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 =; $f = []; $c = []; $a = 0
Something went wrong with that request. Please try again.