[前][次][番号順一覧][スレッド一覧]

ruby-changes:38436

From: nobu <ko1@a...>
Date: Sun, 17 May 2015 09:50:27 +0900 (JST)
Subject: [ruby-changes:38436] nobu:r50517 (trunk): default colors

nobu	2015-05-17 09:50:11 +0900 (Sun, 17 May 2015)

  New Revision: 50517

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50517

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

  Added files:
    trunk/test/colors
  Modified files:
    trunk/bootstraptest/runner.rb
    trunk/sample/test.rb
    trunk/test/lib/test/unit.rb
Index: bootstraptest/runner.rb
===================================================================
--- bootstraptest/runner.rb	(revision 50516)
+++ bootstraptest/runner.rb	(revision 50517)
@@ -136,7 +136,13 @@ End https://github.com/ruby/ruby/blob/trunk/bootstraptest/runner.rb#L136
   @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"
Index: sample/test.rb
===================================================================
--- sample/test.rb	(revision 50516)
+++ sample/test.rb	(revision 50517)
@@ -33,7 +33,13 @@ class Progress https://github.com/ruby/ruby/blob/trunk/sample/test.rb#L33
     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"
Index: test/lib/test/unit.rb
===================================================================
--- test/lib/test/unit.rb	(revision 50516)
+++ test/lib/test/unit.rb	(revision 50517)
@@ -596,7 +596,13 @@ module Test https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit.rb#L596
         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"
Index: test/colors
===================================================================
--- test/colors	(revision 0)
+++ test/colors	(revision 50517)
@@ -0,0 +1,3 @@ https://github.com/ruby/ruby/blob/trunk/test/colors#L1
+pass=36;7
+fail=31;1;7
+skip=33;1

Property changes on: test/colors
___________________________________________________________________
Added: svn:eol-style
   + LF


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]