summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbootstraptest/runner.rb6
-rw-r--r--lib/test/unit.rb8
-rwxr-xr-xsample/test.rb6
3 files changed, 13 insertions, 7 deletions
diff --git a/bootstraptest/runner.rb b/bootstraptest/runner.rb
index 965c335..c36c5a2 100755
--- a/bootstraptest/runner.rb
+++ b/bootstraptest/runner.rb
@@ -127,8 +127,10 @@ End
@tty = true
end
if @color
- @passed = "\e[#{ENV['PASSED_COLOR']||'32'}m"
- @failed = "\e[#{ENV['FAILED_COLOR']||'31'}m"
+ # dircolors-like style
+ colors = (colors = ENV['TEST_COLORS']) ? Hash[colors.scan(/(\w)=([^:]*)/)] : {}
+ @passed = "\e[#{colors["pass"] || "32"}m"
+ @failed = "\e[#{colors["fail"] || "31"}m"
@reset = "\e[m"
else
@passed = @failed = @reset = ""
diff --git a/lib/test/unit.rb b/lib/test/unit.rb
index 33bc93a..70cd942 100644
--- a/lib/test/unit.rb
+++ b/lib/test/unit.rb
@@ -676,11 +676,13 @@ module Test
color = false
end
if color
- @passed_color = "\e[#{ENV['PASSED_COLOR']||'32'}m"
- @failed_color = "\e[#{ENV['FAILED_COLOR']||'31'}m"
+ # dircolors-like style
+ colors = (colors = ENV['TEST_COLORS']) ? Hash[colors.scan(/(\w)=([^:]*)/)] : {}
+ @passed_color = "\e[#{colors["pass"] || "32"}m"
+ @failed_color = "\e[#{colors["fail"] || "31"}m"
@reset_color = "\e[m"
else
- @failed_color = @reset_color = ""
+ @passed_color = @failed_color = @reset_color = ""
end
if color or @options[:job_status] == :replace
@options[:job_status] ||= :replace unless @verbose
diff --git a/sample/test.rb b/sample/test.rb
index 839343e..ee8bc4a 100755
--- a/sample/test.rb
+++ b/sample/test.rb
@@ -23,8 +23,10 @@ PROGRESS.instance_eval do
@tty = true
end
if @color
- @passed = "\e[#{ENV['PASSED_COLOR']||'32'}m"
- @failed = "\e[#{ENV['FAILED_COLOR']||'31'}m"
+ # dircolors-like style
+ colors = (colors = ENV['TEST_COLORS']) ? Hash[colors.scan(/(\w)=([^:]*)/)] : {}
+ @passed = "\e[#{colors["pass"] || "32"}m"
+ @failed = "\e[#{colors["fail"] || "31"}m"
@reset = "\e[m"
else
@passed = @failed = @reset = ""