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

tests: customizable colors

* bootstraptest/runner.rb, lib/test/unit.rb, sample/test.rb:
  customizable colors.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-05-08 00:25:47 +00:00
parent 1af101f8ed
commit 779922622b
3 changed files with 5 additions and 5 deletions

View file

@ -114,8 +114,8 @@ End
@progress_bs = "\b" * @progress[0].size
@tty = !@verbose && $stderr.tty?
if @tty and /mswin|mingw/ !~ RUBY_PLATFORM and /dumb/ !~ ENV["TERM"]
@passed = "\e[32m"
@failed = "\e[31m"
@passed = "\e[#{ENV['PASSED_COLOR']||'32'}m"
@failed = "\e[#{ENV['FAILED_COLOR']||'31'}m"
@reset = "\e[m"
else
@passed = @failed = @reset = ""

View file

@ -713,7 +713,7 @@ module Test
super
@tty = $stdout.tty?
if @tty and /mswin|mingw/ !~ RUBY_PLATFORM and /dumb/ !~ ENV["TERM"]
@failed_color = "\e[31m"
@failed_color = "\e[#{ENV['FAILED_COLOR']||'31'}m"
@reset_color = "\e[m"
else
@failed_color = @reset_color = ""

4
sample/test.rb Normal file → Executable file
View file

@ -11,8 +11,8 @@ PROGRESS.instance_eval do
@bs = "\b" * @rotator[0].size
@tty = STDERR.tty?
if @tty and /mswin|mingw/ !~ RUBY_PLATFORM and /dumb/ !~ ENV["TERM"]
@passed = "\e[32m"
@failed = "\e[31m"
@passed = "\e[#{ENV['PASSED_COLOR']||'32'}m"
@failed = "\e[#{ENV['FAILED_COLOR']||'31'}m"
@reset = "\e[m"
else
@passed = @failed = @reset = ""