From 1b34bd07c18068228188a72f94662cceac50f30e Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 5 Jul 2022 09:31:32 +0900 Subject: Separate failed output option It is unrelated to `GlobOption` at all. --- tool/lib/test/unit.rb | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'tool/lib') diff --git a/tool/lib/test/unit.rb b/tool/lib/test/unit.rb index ba3685d1ef..ade0e62f6f 100644 --- a/tool/lib/test/unit.rb +++ b/tool/lib/test/unit.rb @@ -200,8 +200,6 @@ module Test " " + (s =~ /[\s|&<>$()]/ ? s.inspect : s) }.join("\n") - @failed_output = options[:stderr_on_failure] ? $stderr : $stdout - @options = options end @@ -1121,9 +1119,6 @@ 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 @@ -1183,6 +1178,23 @@ module Test end end + module OutputOption # :nodoc: all + def setup_options(parser, options) + super + parser.separator "output options:" + parser.on '--stderr-on-failure', 'Use stderr to print failure messages' do + options[:stderr_on_failure] = true + end + end + + def process_args(args = []) + return @options if @options + options = super + @failed_output = options[:stderr_on_failure] ? $stderr : $stdout + options + end + end + module GCOption # :nodoc: all def setup_options(parser, options) super @@ -1668,6 +1680,7 @@ module Test prepend Test::Unit::Statistics prepend Test::Unit::Skipping prepend Test::Unit::GlobOption + prepend Test::Unit::OutputOption prepend Test::Unit::RepeatOption prepend Test::Unit::LoadPathOption prepend Test::Unit::GCOption -- cgit v1.2.3