summaryrefslogtreecommitdiff
path: root/test/optparse
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-10-18 16:43:40 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-10-18 16:43:40 +0900
commite29e49abf018730d8419b4797ff17942e00d810b (patch)
tree8689c8fa7d4629fc51edc20e2d4d42ef1d3cf302 /test/optparse
parentd4e52f672cf520d6929d22310a340e09fcb0e35d (diff)
Default DidYouMean.formatter to PlainFormatter
Diffstat (limited to 'test/optparse')
-rw-r--r--test/optparse/test_did_you_mean.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/optparse/test_did_you_mean.rb b/test/optparse/test_did_you_mean.rb
index 2d0a9a6..82a086a 100644
--- a/test/optparse/test_did_you_mean.rb
+++ b/test/optparse/test_did_you_mean.rb
@@ -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