diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-12-31 18:04:08 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-12-31 19:43:36 +0900 |
commit | 8caeef7c1d70757b6196b8444991cb1ea61943ee (patch) | |
tree | 4ebe0767a06fc538d6bdf87e741cb8832b7e1d93 | |
parent | 2e1fd4e2d70172fd91c9722aaa3b114ec6cf2ea1 (diff) |
Fix the exception to be raised
`NoMethodError` has been raised instead of `FrozenError`.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/2800
-rw-r--r-- | test/ruby/test_exception.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb index 79ac11ab26..8445f85ceb 100644 --- a/test/ruby/test_exception.rb +++ b/test/ruby/test_exception.rb @@ -837,9 +837,9 @@ end.join def test_frozen_error_receiver obj = Object.new.freeze - (obj.foo = 1) rescue (e = $!) + e = assert_raise(FrozenError) {def obj.foo; end} assert_same(obj, e.receiver) - obj.singleton_class.const_set(:A, 2) rescue (e = $!) + e = assert_raise(FrozenError) {obj.singleton_class.const_set(:A, 2)} assert_same(obj.singleton_class, e.receiver) end |