1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

add --stderr-on-failure option to test-all

Now all failure messages are printed to stdout. This option
makes all failure messages printed into stderr.
This commit is contained in:
Koichi Sasada 2022-01-26 01:34:57 +09:00
parent 142d5db112
commit cac6fe9023
Notes: git 2022-01-26 09:56:42 +09:00

View file

@ -199,6 +199,9 @@ module Test
@help = "\n" + orig_args.map { |s|
" " + (s =~ /[\s|&<>$()]/ ? s.inspect : s)
}.join("\n")
@failed_output = options[:stderr_on_failure] ? $stderr : $stdout
@options = options
end
@ -1004,7 +1007,7 @@ module Test
end
first, msg = msg.split(/$/, 2)
first = sprintf("%3d) %s", @report_count += 1, first)
$stdout.print(sep, @colorize.decorate(first, color), msg, "\n")
@failed_output.print(sep, @colorize.decorate(first, color), msg, "\n")
sep = nil
end
report.clear
@ -1106,6 +1109,9 @@ module Test
parser.on '-x', '--exclude REGEXP', 'Exclude test files on pattern.' do |pattern|
(options[:reject] ||= []) << pattern
end
parser.on '--stderr-on-failure', 'Use stderr to print failure messages' do
options[:stderr_on_failure] = true
end
end
def complement_test_name f, orig_f