Skip to content

Commit

Permalink
Add --stdout-on-failure, the reverse of --stderr-on-failure
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Jul 5, 2022
1 parent 1b34bd0 commit 5921bfc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tool/lib/test/unit.rb
Expand Up @@ -1182,15 +1182,20 @@ module OutputOption # :nodoc: all
def setup_options(parser, options)
super
parser.separator "output options:"

options[:failed_output] = $stdout
parser.on '--stderr-on-failure', 'Use stderr to print failure messages' do
options[:stderr_on_failure] = true
options[:failed_output] = $stderr
end
parser.on '--stdout-on-failure', 'Use stdout to print failure messages', '(default)' do
options[:failed_output] = $stdout
end
end

def process_args(args = [])
return @options if @options
options = super
@failed_output = options[:stderr_on_failure] ? $stderr : $stdout
@failed_output = options[:failed_output]
options
end
end
Expand Down

0 comments on commit 5921bfc

Please sign in to comment.