From 0243943aad4302c1565c09d5a149fe1b96efd1ff Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 15 Jun 2012 00:56:39 +0000 Subject: 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 --- bootstraptest/runner.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'bootstraptest') diff --git a/bootstraptest/runner.rb b/bootstraptest/runner.rb index 965c335315..c36c5a2dd9 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 = "" -- cgit v1.2.3