* 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
This commit is contained in:
nobu 2012-06-15 00:56:39 +00:00
Родитель 65672e63f5
Коммит 0243943aad
3 изменённых файлов: 13 добавлений и 7 удалений

Просмотреть файл

@ -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 = ""

Просмотреть файл

@ -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

Просмотреть файл

@ -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 = ""