aboutsummaryrefslogtreecommitdiffstats
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
commit44589137199985a5cd31aa79a1794233ca2a5656 (patch)
treedb25efefd03979afe2c264cab4d5e713aafdb230 /test/optparse
parent1756d9a7656417f2008495e06cccebfd55587084 (diff)
downloadruby-44589137199985a5cd31aa79a1794233ca2a5656.tar.gz
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 dd38f8ec7a..5c3fbdb10c 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)