[前][次][番号順一覧][スレッド一覧]

ruby-changes:64032

From: Marc-Andre <ko1@a...>
Date: Wed, 9 Dec 2020 07:49:36 +0900 (JST)
Subject: [ruby-changes:64032] 27b6df9653 (master): Add test that `Ractor.make_shareable` calls user defined `#freeze`

https://git.ruby-lang.org/ruby.git/commit/?id=27b6df9653

From 27b6df9653e88e83c6a524149ef44070802770c5 Mon Sep 17 00:00:00 2001
From: Marc-Andre Lafortune <github@m...>
Date: Fri, 23 Oct 2020 17:42:48 -0400
Subject: Add test that `Ractor.make_shareable` calls user defined `#freeze`


diff --git a/bootstraptest/test_ractor.rb b/bootstraptest/test_ractor.rb
index d89bf10..125b51b 100644
--- a/bootstraptest/test_ractor.rb
+++ b/bootstraptest/test_ractor.rb
@@ -926,7 +926,13 @@ assert_equal 'true', %q{ https://github.com/ruby/ruby/blob/trunk/bootstraptest/test_ractor.rb#L926
       @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{ https://github.com/ruby/ruby/blob/trunk/bootstraptest/test_ractor.rb#L973
     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
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]