mirror of
https://github.com/ruby/ruby.git
synced 2025-08-24 21:44:30 +02:00
Round down test-spec folding width to a multiple of 20
A prime number 73 is not good for counting.
This commit is contained in:
parent
4dcd7d6240
commit
632115c11e
1 changed files with 6 additions and 2 deletions
|
@ -90,6 +90,7 @@ require 'mspec/runner/formatters/dotted'
|
|||
class DottedFormatter
|
||||
prepend Module.new {
|
||||
BASE = __dir__ + "/ruby/" unless defined?(BASE)
|
||||
COUNT_WIDTH = 6
|
||||
|
||||
def initialize(out = nil)
|
||||
super
|
||||
|
@ -97,7 +98,10 @@ class DottedFormatter
|
|||
@columns = nil
|
||||
else
|
||||
columns = ENV["COLUMNS"]&.to_i
|
||||
@columns = columns&.nonzero? || 80
|
||||
columns = 80 unless columns.nonzero?
|
||||
w = COUNT_WIDTH + 1
|
||||
round = 20
|
||||
@columns = (columns - w) / round * round + w
|
||||
end
|
||||
@dotted = 0
|
||||
@loaded = false
|
||||
|
@ -113,7 +117,7 @@ class DottedFormatter
|
|||
def after(*)
|
||||
if @columns
|
||||
if @dotted == 0
|
||||
s = sprintf("%6d ", @count)
|
||||
s = sprintf("%*d ", COUNT_WIDTH, @count)
|
||||
print(s)
|
||||
@dotted += s.size
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue