[Groonga-commit] groonga/grntest [master] Fix over width progress

Back to archive index

Kouhei Sutou null+****@clear*****
Sat Aug 11 16:37:49 JST 2012


Kouhei Sutou	2012-08-11 16:37:49 +0900 (Sat, 11 Aug 2012)

  New Revision: 64a690678f564397bb1ba4a2577bd0778e359767
  https://github.com/groonga/grntest/commit/64a690678f564397bb1ba4a2577bd0778e359767

  Log:
    Fix over width progress

  Modified files:
    lib/groonga/tester.rb

  Modified: lib/groonga/tester.rb (+7 -2)
===================================================================
--- lib/groonga/tester.rb    2012-08-11 16:30:50 +0900 (2f50257)
+++ lib/groonga/tester.rb    2012-08-11 16:37:49 +0900 (298339c)
@@ -1535,10 +1535,15 @@ EOF
         progress_width -= start_mark.bytesize
         progress_width -= finish_mark.bytesize
         progress_width -= statistics.bytesize
+        finished_mark = "="
         if n_done_tests == @n_tests
-          progress = "=" * progress_width
+          progress = finished_mark * progress_width
         else
-          progress = "=" * (progress_width * finished_test_ratio).ceil + ">"
+          current_mark = ">"
+          finished_marks_width = (progress_width * finished_test_ratio).ceil
+          finished_marks_width -= current_mark.bytesize
+          finished_marks_width = [0, finished_marks_width].max
+          progress = finished_mark * finished_marks_width + current_mark
           progress = progress.ljust(progress_width)
         end
         puts("#{start_mark}#{progress}#{finish_mark}#{statistics}")
-------------- next part --------------
HTML����������������������������...
Download 



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