[前][次][番号順一覧][スレッド一覧]

ruby-changes:59585

From: Nobuyoshi <ko1@a...>
Date: Wed, 1 Jan 2020 04:39:18 +0900 (JST)
Subject: [ruby-changes:59585] 8caeef7c1d (master): Fix the exception to be raised

https://git.ruby-lang.org/ruby.git/commit/?id=8caeef7c1d

From 8caeef7c1d70757b6196b8444991cb1ea61943ee Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Tue, 31 Dec 2019 18:04:08 +0900
Subject: Fix the exception to be raised

`NoMethodError` has been raised instead of `FrozenError`.

diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb
index 79ac11a..8445f85 100644
--- a/test/ruby/test_exception.rb
+++ b/test/ruby/test_exception.rb
@@ -837,9 +837,9 @@ end.join https://github.com/ruby/ruby/blob/trunk/test/ruby/test_exception.rb#L837
 
   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
 
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]