1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Default DidYouMean.formatter to PlainFormatter

This commit is contained in:
Nobuyoshi Nakada 2019-10-18 16:43:40 +09:00
parent d4e52f672c
commit e29e49abf0
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -9,6 +9,11 @@ class TestOptionParser::DidYouMean < TestOptionParser
@opt.def_option("--bar", Integer) { |v| @bar = v }
@opt.def_option("--baz", Integer) { |v| @baz = v }
@formatter = ::DidYouMean.formatter
case @formatter
when ::DidYouMean::PlainFormatter
else
::DidYouMean.formatter = ::DidYouMean::PlainFormatter.new
end
end
def teardown
@ -22,7 +27,6 @@ class TestOptionParser::DidYouMean < TestOptionParser
end
def test_plain
::DidYouMean.formatter = ::DidYouMean::PlainFormatter.new
assert_raise_with_message(OptionParser::InvalidOption, /invalid option: --baa\nDid you mean\?\s+baz\s+bar\Z/) do
@opt.permute!(%w"--baa")
end