diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-02-11 19:33:46 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-02-11 19:33:46 +0000 |
commit | a1992e25b91d77866cd32f4b16fb666f5e89adf5 (patch) | |
tree | 01aaa9f1441d20e8b742ffa3fe41438837058835 /test | |
parent | ecbc694f4458fd6a434dab299bcf3bc5f2499fc9 (diff) | |
download | ruby-a1992e25b91d77866cd32f4b16fb666f5e89adf5.tar.gz |
* compar.c (cmp_equal): no more error hiding for Comparable#==.
It now behaves as other Comparable methods. See #7688.
* test/ruby/test_comparable.rb: update related test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_comparable.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/test/ruby/test_comparable.rb b/test/ruby/test_comparable.rb index efa630f8d9..dab6be5b27 100644 --- a/test/ruby/test_comparable.rb +++ b/test/ruby/test_comparable.rb @@ -17,12 +17,18 @@ class TestComparable < Test::Unit::TestCase assert_equal(true, @o == nil) cmp->(x) do 1; end assert_equal(false, @o == nil) + cmp->(x) do nil; end + assert_equal(false, @o == nil) + cmp->(x) do raise NotImplementedError, "Not a RuntimeError" end assert_raise(NotImplementedError) { @o == nil } - bug7688 = '[ruby-core:51389] [Bug #7688]' - cmp->(x) do raise StandardError, "A standard error should be rescued"; end - warn = /Comparable#== will no more rescue exceptions .+ in the next release/ - assert_warn(warn, bug7688) { @o == nil } + + bug7688 = 'Comparable#== should not silently rescue' \ + 'any Exception [ruby-core:51389] [Bug #7688]' + cmp->(x) do raise StandardError end + assert_raise(StandardError, bug7688) { @o == nil } + cmp->(x) do "bad value"; end + assert_raise(ArgumentError, bug7688) { @o == nil } end def test_gt |