1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

default colors

* bootstraptest/runner.rb, sample/test.rb, test/lib/test/unit.rb:
  shared the default colors from test/colors file.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-05-17 00:50:11 +00:00
parent 75a865406f
commit a9ca74cd70
4 changed files with 24 additions and 3 deletions

View file

@ -136,7 +136,13 @@ End
@tty &&= !@verbose
if @color
# dircolors-like style
colors = (colors = ENV['TEST_COLORS']) ? Hash[colors.scan(/(\w+)=([^:]*)/)] : {}
colors = (colors = ENV['TEST_COLORS']) ? Hash[colors.scan(/(\w+)=([^:\n]*)/)] : {}
begin
File.read(File.join(__dir__, "../test/colors")).scan(/(\w+)=([^:\n]*)/) do |n, c|
colors[n] ||= c
end
rescue
end
@passed = "\e[;#{colors["pass"] || "32"}m"
@failed = "\e[;#{colors["fail"] || "31"}m"
@reset = "\e[m"

View file

@ -33,7 +33,13 @@ class Progress
end
if @color
# dircolors-like style
colors = (colors = ENV['TEST_COLORS']) ? Hash[colors.scan(/(\w+)=([^:]*)/)] : {}
colors = (colors = ENV['TEST_COLORS']) ? Hash[colors.scan(/(\w+)=([^:\n]*)/)] : {}
begin
File.read(File.join(__dir__, "../test/colors")).scan(/(\w+)=([^:\n]*)/) do |n, c|
colors[n] ||= c
end
rescue
end
@passed = "\e[;#{colors["pass"] || "32"}m"
@failed = "\e[;#{colors["fail"] || "31"}m"
@reset = "\e[m"

3
test/colors Normal file
View file

@ -0,0 +1,3 @@
pass=36;7
fail=31;1;7
skip=33;1

View file

@ -596,7 +596,13 @@ module Test
end
if color
# dircolors-like style
colors = (colors = ENV['TEST_COLORS']) ? Hash[colors.scan(/(\w+)=([^:]*)/)] : {}
colors = (colors = ENV['TEST_COLORS']) ? Hash[colors.scan(/(\w+)=([^:\n]*)/)] : {}
begin
File.read(File.join(__dir__, "../../colors")).scan(/(\w+)=([^:\n]*)/) do |n, c|
colors[n] ||= c
end
rescue
end
@passed_color = "\e[;#{colors["pass"] || "32"}m"
@failed_color = "\e[;#{colors["fail"] || "31"}m"
@skipped_color = "\e[;#{colors["skip"] || "33"}m"