Skip to content

Commit d433f0b

Browse files
kwatchnobu
authored andcommitted
Add new test case for bug #74
1 parent b9df713 commit d433f0b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/optparse/test_optparse.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,16 @@ def test_nonopt_pattern
120120
e = assert_raise(OptionParser::InvalidOption) {@opt.parse(%w(-t))}
121121
assert_equal(["-t"], e.args)
122122
end
123+
124+
def test_default_help_option # bug #74
125+
@opt.require_exact = true # !!!
126+
sout, serr = capture_output() do
127+
assert_raise(SystemExit) do
128+
@opt.parse!(["--help"])
129+
end
130+
end
131+
assert_empty(serr)
132+
assert_match(/\AUsage: \w+ \[options\]\n\z/, sout)
133+
end
134+
123135
end

0 commit comments

Comments
 (0)