diff options
author | Kouhei Yanagita <yanagi@shakenbu.org> | 2023-01-22 18:53:02 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-22 18:53:02 +0900 |
commit | 20a85ab6119964d1ff129f9c6676fa2a7b2a2be4 (patch) | |
tree | a484952f92a62b17e1666639cbf1680d0afe4e7f /test/ruby/test_integer.rb | |
parent | cad09f7098d11ae32e5c10fa3726399621b4f8bd (diff) |
Fix Integer#ceildiv to respect #coerce (#7118)
Fixes [Bug #19343]
Notes
Notes:
Merged-By: mrkn <mrkn@ruby-lang.org>
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 dd177090ab..a3e64ddb38 100644 --- a/test/ruby/test_integer.rb +++ b/test/ruby/test_integer.rb @@ -725,5 +725,9 @@ class TestInteger < Test::Unit::TestCase assert_equal(10, (10**100-11).ceildiv(10**99-1)) assert_equal(11, (10**100-9).ceildiv(10**99-1)) + + o = Object.new + def o.coerce(other); [other, 10]; end + assert_equal(124, 1234.ceildiv(o)) end end |