diff options
author | Nobuyoshi Nakada <[email protected]> | 2019-06-05 13:02:38 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2019-06-05 13:31:09 +0900 |
commit | 1624d77f3ee0a536a6ab37da014d85d16fcd1de2 (patch) | |
tree | d7c75edc564a30f3fcf4d3d3719d2bd11c7d63fe /test/ruby/test_exception.rb | |
parent | b2fe7484e7e7c7741f33bfb02c2fc91f03763ab4 (diff) |
error.c: avoid infinite recursion at inspecting the frozen object
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 |