mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/optparse] DidYouMean::PlainFormatter is deprecated
https://github.com/ruby/optparse/commit/0ac9957696
This commit is contained in:
parent
92630e2346
commit
743a41f7e3
1 changed files with 11 additions and 3 deletions
|
@ -12,12 +12,20 @@ class TestOptionParser::DidYouMean < TestOptionParser
|
|||
@opt.def_option("--foo", Integer) { |v| @foo = v }
|
||||
@opt.def_option("--bar", Integer) { |v| @bar = v }
|
||||
@opt.def_option("--baz", Integer) { |v| @baz = v }
|
||||
@formatter = ::DidYouMean.formatter
|
||||
::DidYouMean.formatter = ::DidYouMean::Formatter
|
||||
unless ::DidYouMean::Formatter.respond_to?(:message_for)
|
||||
@formatter = ::DidYouMean.formatter
|
||||
case @formatter
|
||||
when ::DidYouMean::PlainFormatter
|
||||
else
|
||||
::DidYouMean.formatter = ::DidYouMean::PlainFormatter.new
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def teardown
|
||||
::DidYouMean.formatter = @formatter
|
||||
unless ::DidYouMean::Formatter.respond_to?(:message_for)
|
||||
::DidYouMean.formatter = @formatter
|
||||
end
|
||||
end
|
||||
|
||||
def test_no_suggestion
|
||||
|
|
Loading…
Reference in a new issue