summaryrefslogtreecommitdiff
path: root/bootstraptest
diff options
context:
space:
mode:
authorMarc-Andre Lafortune <github@marc-andre.ca>2020-10-23 17:42:48 -0400
committerMarc-André Lafortune <github@marc-andre.ca>2020-12-08 17:49:14 -0500
commit27b6df9653e88e83c6a524149ef44070802770c5 (patch)
tree21e5d27935dab6ad3931fc67662760c650f2aea0 /bootstraptest
parent2553c5f94a5d51c2c5876b31e4c1521ad9be12f6 (diff)
Add test that `Ractor.make_shareable` calls user defined `#freeze`
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3694
Diffstat (limited to 'bootstraptest')
-rw-r--r--bootstraptest/test_ractor.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/bootstraptest/test_ractor.rb b/bootstraptest/test_ractor.rb
index d89bf108c1..125b51bf4f 100644
--- a/bootstraptest/test_ractor.rb
+++ b/bootstraptest/test_ractor.rb
@@ -926,7 +926,13 @@ assert_equal 'true', %q{
@a = 'foo'
@b = 'bar'
end
- attr_reader :a, :b
+
+ def freeze
+ @c = [:freeze_called]
+ super
+ end
+
+ attr_reader :a, :b, :c
end
S = Struct.new(:s1, :s2)
str = "hello"
@@ -967,6 +973,7 @@ assert_equal 'true', %q{
when C
raise o.a.inspect unless o.a.frozen?
raise o.b.inspect unless o.b.frozen?
+ raise o.c.inspect unless o.c.frozen? && o.c == [:freeze_called]
when Rational
raise o.numerator.inspect unless o.numerator.frozen?
when Complex