diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-10-27 00:12:33 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-10-27 00:12:33 +0000 |
commit | 9396660a4a1b8bfeb1ae1074e54940660b0c955f (patch) | |
tree | 53603cd367b3610aa46f991b976f9dbadb8fe13b /test/ruby/test_integer.rb | |
parent | 54354c0613c3b7fed08538d792caddf5662a098c (diff) | |
download | ruby-9396660a4a1b8bfeb1ae1074e54940660b0c955f.tar.gz |
object.c: use converted string
* object.c (rb_convert_to_integer): should not drop the converted
string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_integer.rb')
-rw-r--r-- | test/ruby/test_integer.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_integer.rb b/test/ruby/test_integer.rb index 6a9001c698..32c3511576 100644 --- a/test/ruby/test_integer.rb +++ b/test/ruby/test_integer.rb @@ -100,6 +100,10 @@ class TestInteger < Test::Unit::TestCase assert_raise(Encoding::CompatibilityError, bug6192) {Integer("0".encode("iso-2022-jp"))} assert_raise_with_message(ArgumentError, /\u{1f4a1}/) {Integer("\u{1f4a1}")} + + obj = Struct.new(:s).new(%w[42 not-an-integer]) + def obj.to_str; s.shift; end + assert_equal(42, Integer(obj, 10)) end def test_int_p |