diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-06-15 00:56:39 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-06-15 00:56:39 +0000 |
commit | 0243943aad4302c1565c09d5a149fe1b96efd1ff (patch) | |
tree | 267621255fb3f67054b5e958d7672bd3d9a1afe8 /lib/test/unit.rb | |
parent | 65672e63f52dc09c62eb2b75d5d24f710a30ee6e (diff) | |
download | ruby-0243943aad4302c1565c09d5a149fe1b96efd1ff.tar.gz |
test: TEST_COLORS
* bootstraptest/runner.rb (main): customize colors by dircolors-like
style environment variable TEST_COLORS.
* lib/test/unit.rb (Test::Unit::Runner#_prepare_run): ditto.
* sample/test.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/test/unit.rb')
-rw-r--r-- | lib/test/unit.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/test/unit.rb b/lib/test/unit.rb index 33bc93add1..70cd942b48 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 |