summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 a8a11e676b..c6dc7abcf9 100644
--- a/test/optparse/test_placearg.rb
+++ b/test/optparse/test_placearg.rb
@@ -7,6 +7,7 @@ class TestOptionParserPlaceArg < TestOptionParser
@opt.def_option("-x [VAL]") {|x| @flag = x}
@opt.def_option("--option [VAL]") {|x| @flag = x}
@opt.def_option("-T [level]", /^[0-4]$/, Integer) {|x| @topt = x}
+ @opt.def_option("--enum [VAL]", [:Alpha, :Bravo, :Charlie]) {|x| @enum = x}
@topt = nil
@opt.def_option("-n") {}
@opt.def_option("--regexp [REGEXP]", Regexp) {|x| @reopt = x}
@@ -93,4 +94,9 @@ class TestOptionParserPlaceArg < TestOptionParser
assert_equal(%w"", no_error {@opt.parse!(%w"--lambda")})
assert_equal(nil, @flag)
end
+
+ def test_enum
+ assert_equal([], no_error {@opt.parse!(%w"--enum=A")})
+ assert_equal(:Alpha, @enum)
+ end
end