summaryrefslogtreecommitdiff
path: root/test/optparse
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-07-12 02:49:53 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-07-12 02:49:53 +0000
commit89bf90a370992e3906bca56d90835682a895bba0 (patch)
treedb25efefd03979afe2c264cab4d5e713aafdb230 /test/optparse
parent561c253512eb83dba822d50ccc95a90187ab945e (diff)
optparse.rb: get rid of eval
* lib/optparse.rb: try Float() and Integer() instead of eval, which does too much things. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/optparse')
-rw-r--r--test/optparse/test_acceptable.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/optparse/test_acceptable.rb b/test/optparse/test_acceptable.rb
index dd38f8e..5c3fbdb 100644
--- a/test/optparse/test_acceptable.rb
+++ b/test/optparse/test_acceptable.rb
@@ -85,6 +85,9 @@ class TestOptionParser::Acceptable < TestOptionParser
assert_equal(%w"", no_error {@opt.parse!(%w"--numeric 1/2")})
assert_equal(Rational(1, 2), @numeric)
+ assert_equal(%w"", no_error {@opt.parse!(%w"--numeric 010")})
+ assert_equal(8, @numeric)
+
assert_equal(%w"", no_error {@opt.parse!(%w"--numeric 1.2/2.3")})
assert_equal(Rational(12, 23), @numeric)