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,13 +12,21 @@ 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 }
unless ::DidYouMean::Formatter.respond_to?(:message_for)
@formatter = ::DidYouMean.formatter
::DidYouMean.formatter = ::DidYouMean::Formatter
case @formatter
when ::DidYouMean::PlainFormatter
else
::DidYouMean.formatter = ::DidYouMean::PlainFormatter.new
end
end
end
def teardown
unless ::DidYouMean::Formatter.respond_to?(:message_for)
::DidYouMean.formatter = @formatter
end
end
def test_no_suggestion
assert_raise_with_message(OptionParser::InvalidOption, "invalid option: --cuz") do