aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbootstraptest/runner.rb8
-rwxr-xr-xsample/test.rb8
-rw-r--r--test/colors3
-rw-r--r--test/lib/test/unit.rb8
4 files changed, 24 insertions, 3 deletions
diff --git a/bootstraptest/runner.rb b/bootstraptest/runner.rb
index fa5e8537e8..d9711fef38 100755
--- a/bootstraptest/runner.rb
+++ b/bootstraptest/runner.rb
@@ -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"
diff --git a/sample/test.rb b/sample/test.rb
index 85a11e0d4d..14f4d4a0f1 100755
--- a/sample/test.rb
+++ b/sample/test.rb
@@ -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"
diff --git a/test/colors b/test/colors
new file mode 100644
index 0000000000..a65c326ade
--- /dev/null
+++ b/test/colors
@@ -0,0 +1,3 @@
+pass=36;7
+fail=31;1;7
+skip=33;1
diff --git a/test/lib/test/unit.rb b/test/lib/test/unit.rb
index 996134eaf3..9d9ff4bdf3 100644
--- a/test/lib/test/unit.rb
+++ b/test/lib/test/unit.rb
@@ -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"