summaryrefslogtreecommitdiff
path: root/test/optparse/test_reqarg.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/optparse/test_reqarg.rb')
-rw-r--r--test/optparse/test_reqarg.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/optparse/test_reqarg.rb b/test/optparse/test_reqarg.rb
index d5686d13aa..31d4fef417 100644
--- a/test/optparse/test_reqarg.rb
+++ b/test/optparse/test_reqarg.rb
@@ -6,6 +6,7 @@ module TestOptionParserReqArg
super
@opt.def_option "--with_underscore=VAL" do |x| @flag = x end
@opt.def_option "--with-hyphen=VAL" do |x| @flag = x end
+ @opt.def_option("--lambda=VAL", &->(x) {@flag = x})
end
class Def1 < TestOptionParser
@@ -81,6 +82,11 @@ module TestOptionParserReqArg
assert_equal("foo4", @flag)
end
+ def test_lambda
+ assert_equal(%w"", no_error {@opt.parse!(%w"--lambda=lambda1")})
+ assert_equal("lambda1", @flag)
+ end
+
class TestOptionParser::WithPattern < TestOptionParser
def test_pattern
pat = num = nil