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:
Nobuyoshi Nakada 2024-05-29 19:49:57 +09:00
parent 4dcd7d6240
commit 632115c11e
No known key found for this signature in database
GPG key ID: 3582D74E1FEE4465

View file

@ -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