diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-07-05 09:31:32 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-07-05 14:40:19 +0900 |
commit | 1b34bd07c18068228188a72f94662cceac50f30e (patch) | |
tree | 211bda79c47360d9f3ce2ed290ee11f12ffe78bd /tool/lib/test | |
parent | babdb158d14a626b570db6d42599f1ac2decbed3 (diff) |
Separate failed output option
It is unrelated to `GlobOption` at all.
Diffstat (limited to 'tool/lib/test')
-rw-r--r-- | tool/lib/test/unit.rb | 23 |
1 files changed, 18 insertions, 5 deletions
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 |