summaryrefslogtreecommitdiff
path: root/test/ruby/test_variable.rb
diff options
context:
space:
mode:
authorPeter Zhu <[email protected]>2023-01-16 09:32:37 -0500
committerPeter Zhu <[email protected]>2023-01-17 04:51:15 -0500
commited6fbb79e19bf401db0e85447fee955fd10a25c7 (patch)
tree3db8408167871d7a674ee6ce788a01510ee17d9f /test/ruby/test_variable.rb
parentf8249eb49a2c3763f27c989eea0d19370dbf7c7b (diff)
Fix crash when defining ivars on special constants
[Bug #19339]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/7129
Diffstat (limited to 'test/ruby/test_variable.rb')
-rw-r--r--test/ruby/test_variable.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_variable.rb b/test/ruby/test_variable.rb
index f8a7c68fd3..9acba39f40 100644
--- a/test/ruby/test_variable.rb
+++ b/test/ruby/test_variable.rb
@@ -261,6 +261,12 @@ class TestVariable < Test::Unit::TestCase
v.instance_variable_set(:@foo, :bar)
end
+ assert_raise_with_message(FrozenError, msg, "[Bug #19339]") do
+ v.instance_eval do
+ @a = 1
+ end
+ end
+
assert_nil EnvUtil.suppress_warning {v.instance_variable_get(:@foo)}
assert_not_send([v, :instance_variable_defined?, :@foo])