1
0
Fork 0
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:
Nobuyoshi Nakada 2022-01-12 19:37:33 +09:00
parent 92630e2346
commit 743a41f7e3
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6

View file

@ -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