diff options
author | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-11-30 22:45:53 +0000 |
---|---|---|
committer | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-11-30 22:45:53 +0000 |
commit | 3632f4cf1cfda24d81e1dbe0576fbce52fcb85af (patch) | |
tree | d7611612bb67be13478acb5a8e4146b3a348b692 /lib/minitest/pride.rb | |
parent | 715ec08107c4b96175049efb288925a5bd463ec2 (diff) | |
download | ruby-3632f4cf1cfda24d81e1dbe0576fbce52fcb85af.tar.gz |
Imported minitest 2.0.0 r5952
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/minitest/pride.rb')
-rw-r--r-- | lib/minitest/pride.rb | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/minitest/pride.rb b/lib/minitest/pride.rb new file mode 100644 index 0000000000..3cb4e1564c --- /dev/null +++ b/lib/minitest/pride.rb @@ -0,0 +1,41 @@ +############################################################ +# This file is imported from a different project. +# DO NOT make modifications in this repo. +# File a patch instead and assign it to Ryan Davis +############################################################ + +require "minitest/unit" + +## +# Show your testing pride! + +class PrideIO + attr_reader :io + + # stolen from /System/Library/Perl/5.10.0/Term/ANSIColor.pm + COLORS = (31..36).to_a + CHARS = ["*"] + + def initialize io + @io = io + @colors = COLORS.cycle + @chars = CHARS.cycle + end + + def print o + case o + when "." then + io.print "\e[#{@colors.next}m#{@chars.next}\e[0m" + when "E", "F" then + io.print "\e[41m\e[37m#{o}\e[0m" + else + io.print o + end + end + + def method_missing msg, *args + io.send(msg, *args) + end +end + +MiniTest::Unit.output = PrideIO.new(MiniTest::Unit.output) |