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:
parent
d4e52f672c
commit
e29e49abf0
1 changed files with 5 additions and 1 deletions
|
@ -9,6 +9,11 @@ class TestOptionParser::DidYouMean < TestOptionParser
|
||||||
@opt.def_option("--bar", Integer) { |v| @bar = v }
|
@opt.def_option("--bar", Integer) { |v| @bar = v }
|
||||||
@opt.def_option("--baz", Integer) { |v| @baz = v }
|
@opt.def_option("--baz", Integer) { |v| @baz = v }
|
||||||
@formatter = ::DidYouMean.formatter
|
@formatter = ::DidYouMean.formatter
|
||||||
|
case @formatter
|
||||||
|
when ::DidYouMean::PlainFormatter
|
||||||
|
else
|
||||||
|
::DidYouMean.formatter = ::DidYouMean::PlainFormatter.new
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
|
@ -22,7 +27,6 @@ class TestOptionParser::DidYouMean < TestOptionParser
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_plain
|
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
|
assert_raise_with_message(OptionParser::InvalidOption, /invalid option: --baa\nDid you mean\?\s+baz\s+bar\Z/) do
|
||||||
@opt.permute!(%w"--baa")
|
@opt.permute!(%w"--baa")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue