summaryrefslogtreecommitdiff
path: root/test/test_delegate.rb
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-12 00:46:34 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-12 00:46:34 +0000
commitb57915eddc91ce0369ae8bcf82d8c4364f42ea05 (patch)
treec5296c8fd95c9ee041fe66455eb0744c3212b5c5 /test/test_delegate.rb
parent0b31ce0047513d1eb8f9902286215025a3742bf5 (diff)
Add FrozenError as a subclass of RuntimeError
FrozenError will be used instead of RuntimeError for exceptions raised when there is an attempt to modify a frozen object. The reason for this change is to differentiate exceptions related to frozen objects from generic exceptions such as those generated by Kernel#raise without an exception class. From: Jeremy Evans <code@jeremyevans.net> Signed-off-by: Urabe Shyouhei <shyouhei@ruby-lang.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/test_delegate.rb')
-rw-r--r--test/test_delegate.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/test_delegate.rb b/test/test_delegate.rb
index 48bf9cd..5320520 100644
--- a/test/test_delegate.rb
+++ b/test/test_delegate.rb
@@ -100,7 +100,7 @@ class TestDelegateClass < Test::Unit::TestCase
a = [42, :hello].freeze
d = SimpleDelegator.new(a)
assert_nothing_raised(bug2679) {d.dup[0] += 1}
- assert_raise(RuntimeError) {d.clone[0] += 1}
+ assert_raise(FrozenError) {d.clone[0] += 1}
d.freeze
assert(d.clone.frozen?)
assert(!d.dup.frozen?)
@@ -109,7 +109,7 @@ class TestDelegateClass < Test::Unit::TestCase
def test_frozen
d = SimpleDelegator.new([1, :foo])
d.freeze
- assert_raise(RuntimeError, '[ruby-dev:40314]#1') {d.__setobj__("foo")}
+ assert_raise(FrozenError, '[ruby-dev:40314]#1') {d.__setobj__("foo")}
assert_equal([1, :foo], d)
end