summaryrefslogtreecommitdiff
path: root/test/optparse
diff options
context:
space:
mode:
authorkonsolebox <konsolebox@gmail.com>2022-06-09 19:43:24 +0800
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2022-07-29 19:10:10 +0900
commit419ad1e13e6287d0b7a6ba1dfeb485d2f889bf9e (patch)
tree7d6140d0fb5f37e91a3330833ff5dadee6f7e6dc /test/optparse
parent3725454161b55681e5b4ec3b7ca23a4126e23736 (diff)
downloadruby-419ad1e13e6287d0b7a6ba1dfeb485d2f889bf9e.tar.gz
[ruby/optparse] Also accept '-' as an optional argument (https://github.com/ruby/optparse/pull/35)
https://github.com/ruby/optparse/commit/f2b8318631
Diffstat (limited to 'test/optparse')
-rw-r--r--test/optparse/test_placearg.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/optparse/test_placearg.rb b/test/optparse/test_placearg.rb
index 94cfb0e819..ed0e4d3e6c 100644
--- a/test/optparse/test_placearg.rb
+++ b/test/optparse/test_placearg.rb
@@ -18,6 +18,8 @@ class TestOptionParserPlaceArg < TestOptionParser
def test_short
assert_equal(%w"", no_error {@opt.parse!(%w"-x -n")})
assert_equal(nil, @flag)
+ assert_equal(%w"", no_error {@opt.parse!(%w"-x -")})
+ assert_equal("-", @flag)
@flag = false
assert_equal(%w"", no_error {@opt.parse!(%w"-x foo")})
assert_equal("foo", @flag)
@@ -30,6 +32,8 @@ class TestOptionParserPlaceArg < TestOptionParser
def test_abbrev
assert_equal(%w"", no_error {@opt.parse!(%w"-o -n")})
assert_equal(nil, @flag)
+ assert_equal(%w"", no_error {@opt.parse!(%w"-o -")})
+ assert_equal("-", @flag)
@flag = false
assert_equal(%w"", no_error {@opt.parse!(%w"-o foo")})
assert_equal("foo", @flag)
@@ -42,6 +46,8 @@ class TestOptionParserPlaceArg < TestOptionParser
def test_long
assert_equal(%w"", no_error {@opt.parse!(%w"--opt -n")})
assert_equal(nil, @flag)
+ assert_equal(%w"", no_error {@opt.parse!(%w"--opt -")})
+ assert_equal("-", @flag)
assert_equal(%w"foo", no_error {@opt.parse!(%w"--opt= foo")})
assert_equal("", @flag)
assert_equal(%w"", no_error {@opt.parse!(%w"--opt=foo")})