diff options
Diffstat (limited to 'test/optparse/test_optparse.rb')
-rw-r--r-- | test/optparse/test_optparse.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/optparse/test_optparse.rb b/test/optparse/test_optparse.rb index fec14fc318..5f5ea183b0 100644 --- a/test/optparse/test_optparse.rb +++ b/test/optparse/test_optparse.rb @@ -97,4 +97,12 @@ class TestOptionParser < Test::Unit::TestCase assert_raise(OptionParser::InvalidOption) {@opt.parse(%w(-zr foo))} assert_raise(OptionParser::InvalidOption) {@opt.parse(%w(-z foo))} end + + def test_nonopt_pattern + @opt.def_option(/^[^-]/) do |arg| + assert(false, "Never gets called") + end + e = assert_raise(OptionParser::InvalidOption) {@opt.parse(%w(-t))} + assert_equal(["-t"], e.args) + end end |