diff options
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 |