From d2062d6e110a5c97850820bcba12fd3aff041806 Mon Sep 17 00:00:00 2001 From: eregon Date: Tue, 25 Apr 2017 11:42:20 +0000 Subject: 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 --- test/ruby/test_numeric.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'test') 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 -- cgit v1.2.3