summaryrefslogtreecommitdiff
path: root/test/optparse
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-07-06 11:49:03 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-07-06 11:49:03 +0000
commit8ddf0263bb0a8536e40eb088d8620f13f28c4c52 (patch)
treec7c4b520d2901ee3ae854b2662a0944a69faa887 /test/optparse
parent06a3a10acf1951429e3e2e8d18fd1a283fa5b132 (diff)
Fix DecimalInteger converting to octal bug
Previously if the input started with a '0' then it will be converted as octal even though it has been specified as a decimal. This commit forces the number to be interpreted as a decimal. [ruby-core:81927] [Bug #13722] [Fix GH-1665] Author: william <william.mccumstie@outlook.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/optparse')
-rw-r--r--test/optparse/test_acceptable.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/optparse/test_acceptable.rb b/test/optparse/test_acceptable.rb
index 0c7590b..dd38f8e 100644
--- a/test/optparse/test_acceptable.rb
+++ b/test/optparse/test_acceptable.rb
@@ -108,16 +108,16 @@ class TestOptionParser::Acceptable < TestOptionParser
assert_equal(%w"", no_error {@opt.parse!(%w"--decimal-integer 10")})
assert_equal(10, @decimal_integer)
+ assert_equal(%w"", no_error {@opt.parse!(%w"--decimal-integer 010")})
+ assert_equal(10, @decimal_integer)
+
+ assert_equal(%w"", no_error {@opt.parse!(%w"--decimal-integer 09")})
+ assert_equal(9, @decimal_integer)
+
assert_raise(OptionParser::InvalidArgument) do
@opt.parse!(%w"--decimal-integer 0b1")
end
- e = assert_raise(OptionParser::InvalidArgument) do
- @opt.parse!(%w"--decimal-integer 09")
- end
-
- assert_equal("invalid argument: --decimal-integer 09", e.message)
-
assert_raise(OptionParser::InvalidArgument) do
@opt.parse!(%w"--decimal-integer x")
end