mirror of
https://github.com/ruby/ruby.git
synced 2025-08-25 14:05:02 +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
|
class DottedFormatter
|
||||||
prepend Module.new {
|
prepend Module.new {
|
||||||
BASE = __dir__ + "/ruby/" unless defined?(BASE)
|
BASE = __dir__ + "/ruby/" unless defined?(BASE)
|
||||||
|
COUNT_WIDTH = 6
|
||||||
|
|
||||||
def initialize(out = nil)
|
def initialize(out = nil)
|
||||||
super
|
super
|
||||||
|
@ -97,7 +98,10 @@ class DottedFormatter
|
||||||
@columns = nil
|
@columns = nil
|
||||||
else
|
else
|
||||||
columns = ENV["COLUMNS"]&.to_i
|
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
|
end
|
||||||
@dotted = 0
|
@dotted = 0
|
||||||
@loaded = false
|
@loaded = false
|
||||||
|
@ -113,7 +117,7 @@ class DottedFormatter
|
||||||
def after(*)
|
def after(*)
|
||||||
if @columns
|
if @columns
|
||||||
if @dotted == 0
|
if @dotted == 0
|
||||||
s = sprintf("%6d ", @count)
|
s = sprintf("%*d ", COUNT_WIDTH, @count)
|
||||||
print(s)
|
print(s)
|
||||||
@dotted += s.size
|
@dotted += s.size
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue