diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-07-12 02:49:53 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-07-12 02:49:53 +0000 |
commit | 89bf90a370992e3906bca56d90835682a895bba0 (patch) | |
tree | db25efefd03979afe2c264cab4d5e713aafdb230 /test/optparse/test_acceptable.rb | |
parent | 561c253512eb83dba822d50ccc95a90187ab945e (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/test_acceptable.rb')
-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 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) |