summaryrefslogtreecommitdiff
path: root/bootstraptest
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2021-09-03 16:06:32 -0700
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:39 -0400
commit640b162b51a704d890c44af9c76fffa4eaf28ca9 (patch)
tree94614f3d8f56a4bb13905cfe78d8b9f3ed00845b /bootstraptest
parent376f5ec1a1c744ca6a78726dbf9886e30b3400fa (diff)
Exit when the object is frozen
Exit when the object is frozen, also add tests
Diffstat (limited to 'bootstraptest')
-rw-r--r--bootstraptest/test_yjit.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/bootstraptest/test_yjit.rb b/bootstraptest/test_yjit.rb
index 96141e315c..866d7e2558 100644
--- a/bootstraptest/test_yjit.rb
+++ b/bootstraptest/test_yjit.rb
@@ -1,3 +1,25 @@
+# Check that frozen objects are respected
+assert_equal 'great', %q{
+ class Foo
+ attr_accessor :bar
+ def initialize
+ @bar = 1
+ freeze
+ end
+ end
+
+ foo = Foo.new
+
+ 5.times do
+ begin
+ foo.bar = 2
+ rescue FrozenError
+ end
+ end
+
+ foo.bar == 1 ? "great" : "NG"
+}
+
# Check that global variable set works
assert_equal 'string', %q{
def foo