diff options
author | marcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-02-06 23:52:30 +0000 |
---|---|---|
committer | marcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-02-06 23:52:30 +0000 |
commit | b16eaf86324b000c4c349e072e15b97dde701e48 (patch) | |
tree | 5abb4a0ceccc04c9f3fd0e3450be26aca0740e75 /test | |
parent | d3513d313e5026dd7d9d93b7a0ea4c4dd52f5e92 (diff) | |
download | ruby-b16eaf86324b000c4c349e072e15b97dde701e48.tar.gz |
lib/ostruct.rb: Use `FrozenError` instead of `RuntimeError`.
Patch by Yuuji Yaginuma. [Fixes GH-1808]
In other classes, `FrozenError` will be raised if change the frozen
object.
In order to match the behavior, I think that `FrozenError` should
use in `OpenStruct`.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ostruct/test_ostruct.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/test/ostruct/test_ostruct.rb b/test/ostruct/test_ostruct.rb index 19f06a85a7..a15de36c23 100644 --- a/test/ostruct/test_ostruct.rb +++ b/test/ostruct/test_ostruct.rb @@ -66,15 +66,15 @@ class TC_OpenStruct < Test::Unit::TestCase o = OpenStruct.new(foo: 42) o.a = 'a' o.freeze - assert_raise(RuntimeError) {o.b = 'b'} + assert_raise(FrozenError) {o.b = 'b'} assert_not_respond_to(o, :b) - assert_raise(RuntimeError) {o.a = 'z'} + assert_raise(FrozenError) {o.a = 'z'} assert_equal('a', o.a) assert_equal(42, o.foo) o = OpenStruct.new :a => 42 def o.frozen?; nil end o.freeze - assert_raise(RuntimeError, '[ruby-core:22559]') {o.a = 1764} + assert_raise(FrozenError, '[ruby-core:22559]') {o.a = 1764} end def test_delete_field |