diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-04-25 11:42:20 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-04-25 11:42:20 +0000 |
commit | d2062d6e110a5c97850820bcba12fd3aff041806 (patch) | |
tree | b4253353c069b5d15ded64f1b97b2dbde2570e95 /test/ruby | |
parent | e0fe5a6b34a2a82c198d6ef2985cc48e5019f62c (diff) | |
download | ruby-d2062d6e110a5c97850820bcba12fd3aff041806.tar.gz |
no longer rescue exceptions in numeric comparison operations
* numeric.c (do_coerce): no more error hiding.
* test/ruby/test_numeric.rb: follow the change.
[Feature #7688]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_numeric.rb | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/test/ruby/test_numeric.rb b/test/ruby/test_numeric.rb index 92717e9f3b..4f4fd5cc3e 100644 --- a/test/ruby/test_numeric.rb +++ b/test/ruby/test_numeric.rb @@ -54,18 +54,16 @@ class TestNumeric < Test::Unit::TestCase bug7688 = '[ruby-core:51389] [Bug #7688]' a = Class.new(Numeric) do - def coerce(x); raise StandardError; end + def coerce(x); raise StandardError, "my error"; end end.new - assert_raise_with_message(TypeError, /can't be coerced into /) { 1 + a } - warn = /will no more rescue exceptions of #coerce.+ in the next release/m - assert_warn(warn, bug7688) { assert_raise(ArgumentError) { 1 < a } } + assert_raise_with_message(StandardError, "my error") { 1 + a } + assert_raise_with_message(StandardError, "my error") { 1 < a } a = Class.new(Numeric) do def coerce(x); :bad_return_value; end end.new assert_raise_with_message(TypeError, "coerce must return [x, y]") { 1 + a } - warn = /Bad return value for #coerce.+next release will raise an error/m - assert_warn(warn, bug7688) { assert_raise(ArgumentError) { 1 < a } } + assert_raise_with_message(TypeError, "coerce must return [x, y]") { 1 < a } end def test_singleton_method |