diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-11-26 22:31:38 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-08-12 11:19:09 +0900 |
commit | b377793b6e445ab007e14b51e38260e8613ce843 (patch) | |
tree | c435082d281ace5021eab941287eaf0bf5471191 /spec | |
parent | 7740526b1ccf62a027984e35375bb30ccbc0a000 (diff) |
Fold dotted outputs from test-spec
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/8210
Diffstat (limited to 'spec')
-rw-r--r-- | spec/default.mspec | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/spec/default.mspec b/spec/default.mspec index b928a2c9aa..f97bcc690e 100644 --- a/spec/default.mspec +++ b/spec/default.mspec @@ -70,3 +70,51 @@ end class MSpecScript prepend JobServer end + + +require 'mspec/runner/formatters/dotted' + +class DottedFormatter + prepend Module.new { + BASE = __dir__ + "/ruby/" + + def initialize(out = nil) + super + if out + @columns = nil + else + columns = ENV["COLUMNS"] + @columns = columns ? columns.to_i : 80 + end + @dotted = 0 + @loaded = false + end + + def register + super + MSpec.register :load, self + MSpec.register :unload, self + end + + def after(*) + super + if !@loaded and @columns and (@dotted += 1) >= @columns + print "\n" + @dotted = 0 + end + end + + def load(*) + print "#{MSpec.file.delete_prefix(BASE)}: " + @loaded = true + end + + def unload + super + if @loaded + print "\n" + @dotted = 0 + end + end + } +end |