[Groonga-commit] groonga/grntest [master] inplace reporter: colorize worker ID

Back to archive index

Kouhei Sutou null+****@clear*****
Sat Aug 11 19:00:17 JST 2012


Kouhei Sutou	2012-08-11 19:00:17 +0900 (Sat, 11 Aug 2012)

  New Revision: 6a1c18593317174153a768364cde4b56fe6c81c9
  https://github.com/groonga/grntest/commit/6a1c18593317174153a768364cde4b56fe6c81c9

  Log:
    inplace reporter: colorize worker ID

  Modified files:
    lib/groonga/tester.rb

  Modified: lib/groonga/tester.rb (+13 -2)
===================================================================
--- lib/groonga/tester.rb    2012-08-11 18:56:34 +0900 (4639fd8)
+++ lib/groonga/tester.rb    2012-08-11 19:00:17 +0900 (403e8bb)
@@ -318,6 +318,16 @@ module Groonga
       def test_not_checked
         @n_not_checked_tests += 1
       end
+
+      def status
+        if n_failed_tests > 0
+          :failure
+        elsif n_not_checked_tests > 0
+          :no_check
+        else
+          :success
+        end
+      end
     end
 
     class Worker
@@ -1676,10 +1686,11 @@ EOF
 
       def draw_status_line(worker)
         clear_line
-        left = "[#{worker.id}] "
+        situation = worker.result.status
+        left = "[#{colorize(worker.id, situation)}] "
         right = " [#{worker.status}]"
         rest_width = @term_width - @current_column
-        center_width = rest_width - left.bytesize - right.bytesize
+        center_width = rest_width - string_width(left) - string_width(right)
         center = justify(worker.suite_name, center_width)
         puts("#{left}#{center}#{right}")
       end
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index