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

ruby-changes:64362

From: Marc-Andre <ko1@a...>
Date: Sun, 20 Dec 2020 07:13:29 +0900 (JST)
Subject: [ruby-changes:64362] 6343a81129 (master): [ruby/ostruct] Add Ractor test

https://git.ruby-lang.org/ruby.git/commit/?id=6343a81129

From 6343a8112950b12df942f5098edc093bca96ef2d Mon Sep 17 00:00:00 2001
From: Marc-Andre Lafortune <github@m...>
Date: Sat, 19 Dec 2020 12:19:06 -0500
Subject: [ruby/ostruct] Add Ractor test


diff --git a/test/ostruct/test_ostruct.rb b/test/ostruct/test_ostruct.rb
index 9d151c3..3ca98ee 100644
--- a/test/ostruct/test_ostruct.rb
+++ b/test/ostruct/test_ostruct.rb
@@ -300,19 +300,18 @@ class TC_OpenStruct < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ostruct/test_ostruct.rb#L300
     assert_equal 42, o.foo
   end
 
-=begin
-  # now Ractor should not use in test-all process
   def test_ractor
-    obj1 = OpenStruct.new(a: 42, b: 42)
-    obj1.c = 42
-    obj1.freeze
-
-    obj2 = Ractor.new obj1 do |obj|
-      obj
-    end.take
-    assert obj1.object_id == obj2.object_id
-  end if defined?(Ractor)
-=end
+    assert_ractor(<<~RUBY, require: 'ostruct')
+      obj1 = OpenStruct.new(a: 42, b: 42)
+      obj1.c = 42
+      obj1.freeze
+
+      obj2 = Ractor.new obj1 do |obj|
+        obj
+      end.take
+      assert obj1.object_id == obj2.object_id
+    RUBY
+  end
 
   def test_legacy_yaml
     s = "--- !ruby/object:OpenStruct\ntable:\n  :foo: 42\n"
-- 
cgit v0.10.2


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

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