diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-07-12 14:06:21 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-07-12 14:06:21 +0000 |
commit | f1306d429cf34cb42d69cf10c6d6ed32af11e517 (patch) | |
tree | 0572a52b44e94e1447d32abfbabc9a4c18a7373c /test | |
parent | 5e645629f3c4dc16931f0c1635565f875b02e12c (diff) |
merge revision(s) 59312: [Backport #13739]
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/branches/ruby_2_4@59316 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/optparse/test_acceptable.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/test/optparse/test_acceptable.rb b/test/optparse/test_acceptable.rb index 0c7590bae3..e8070b2222 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) |