Commit 34f936c8f04009100b7480b9edaa37bd6a1119c4
1 parent
0668b558
Exists in
master
and in
28 other branches
Revert "Coloring test output"
This reverts commit 93f859662e9f6f4036c20e8e6a9c3ac81a7f8090.
Showing
2 changed files
with
0 additions
and
59 deletions
Show diff stats
test/colors.rb
@@ -1,57 +0,0 @@ | @@ -1,57 +0,0 @@ | ||
1 | -require 'test/unit' | ||
2 | -require 'test/unit/ui/console/testrunner' | ||
3 | - | ||
4 | -module Color | ||
5 | - COLORS = { :clear => 0, :red => 31, :green => 32, :yellow => 33 } | ||
6 | - def self.method_missing(color_name, *args) | ||
7 | - colname = color_name.to_s | ||
8 | - ansi_color = (colname =~ /^light/ ? | ||
9 | - light_color(colname.gsub(/light/, '')) : | ||
10 | - color(colname)) | ||
11 | - ansi_color + args.first + color(:clear) | ||
12 | - end | ||
13 | - def self.color(color) | ||
14 | - "\e[#{COLORS[color.to_sym]}m" | ||
15 | - end | ||
16 | - | ||
17 | - def self.light_color(color) | ||
18 | - "\e[1;#{COLORS[color.to_sym]}m" | ||
19 | - end | ||
20 | -end | ||
21 | - | ||
22 | -class Test::Unit::UI::Console::TestRunner | ||
23 | - def output_single(something, level=NORMAL) | ||
24 | - return unless (output?(level)) | ||
25 | - something = case something | ||
26 | - when '.' then Color.green('.') | ||
27 | - when 'F' then Color.red("F") | ||
28 | - when 'E' then Color.yellow("E") | ||
29 | - else something | ||
30 | - end | ||
31 | - @io.write(something) | ||
32 | - @io.flush | ||
33 | - end | ||
34 | -end | ||
35 | - | ||
36 | -class Test::Unit::TestResult | ||
37 | - alias :old_to_s :to_s | ||
38 | - def to_s | ||
39 | - if old_to_s =~ /\d+ tests, \d+ assertions, (\d+) failures, (\d+) errors/ | ||
40 | - Color.send($1.to_i != 0 || $2.to_i != 0 ? :red : :green, $&) | ||
41 | - end | ||
42 | - end | ||
43 | -end | ||
44 | - | ||
45 | -class Test::Unit::Failure | ||
46 | - alias :old_long_display :long_display | ||
47 | - def long_display | ||
48 | - old_long_display.sub('Failure', Color.red('Failure')) | ||
49 | - end | ||
50 | -end | ||
51 | - | ||
52 | -class Test::Unit::Error | ||
53 | - alias :old_long_display :long_display | ||
54 | - def long_display | ||
55 | - old_long_display.sub('Error', Color.yellow('Error')) | ||
56 | - end | ||
57 | -end |