diff options
Diffstat (limited to 'test/ruby/test_exception.rb')
-rw-r--r-- | test/ruby/test_exception.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb index 54e39a0f5f..c69d18b0c9 100644 --- a/test/ruby/test_exception.rb +++ b/test/ruby/test_exception.rb @@ -886,6 +886,21 @@ end.join obj.instance_variable_set(:@test, true) } assert_include(e.message, obj.inspect) + + klass = Class.new do + def init + @x = true + end + def inspect + init + super + end + end + obj = klass.new.freeze + e = assert_raise_with_message(FrozenError, /can't modify frozen #{obj.class}/) { + obj.init + } + assert_include(e.message, klass.inspect) end def test_name_error_new_default |