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

ruby-changes:60983

From: Nobuyoshi <ko1@a...>
Date: Sun, 3 May 2020 00:16:22 +0900 (JST)
Subject: [ruby-changes:60983] 717680f197 (master): DO NOT CORRUPT TYPE FLAGS

https://git.ruby-lang.org/ruby.git/commit/?id=717680f197

From 717680f197110c746bbfff599f42aa30d40b4d19 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sun, 3 May 2020 00:11:47 +0900
Subject: DO NOT CORRUPT TYPE FLAGS


diff --git a/spec/ruby/optional/capi/shared/rbasic.rb b/spec/ruby/optional/capi/shared/rbasic.rb
index 1db03c7..c58fa0c 100644
--- a/spec/ruby/optional/capi/shared/rbasic.rb
+++ b/spec/ruby/optional/capi/shared/rbasic.rb
@@ -56,20 +56,23 @@ describe :rbasic, shared: true do https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/shared/rbasic.rb#L56
 
   it "supports user flags" do
     obj, _ = @data.call
-    @specs.get_flags(obj).should == 0
-    @specs.set_flags(obj, 1 << 14 | 1 << 16).should == 1 << 14 | 1 << 16
-    @specs.get_flags(obj).should == 1 << 14 | 1 << 16
-    @specs.set_flags(obj, 0).should == 0
+    initial = @specs.get_flags(obj)
+    initial.should_not == 0
+    @specs.set_flags(obj, 1 << 14 | 1 << 16 | initial).should == 1 << 14 | 1 << 16 | initial
+    @specs.get_flags(obj).should == 1 << 14 | 1 << 16 | initial
+    @specs.set_flags(obj, initial).should == initial
   end
 
   it "supports copying the flags from one object over to the other" do
     obj1, obj2 = @data.call
-    @specs.set_flags(obj1, @taint | 1 << 14 | 1 << 16)
+    initial = @specs.get_flags(obj1)
+    @specs.get_flags(obj2).should == initial
+    @specs.set_flags(obj1, @taint | 1 << 14 | 1 << 16 | initial)
     @specs.copy_flags(obj2, obj1)
-    @specs.get_flags(obj2).should == @taint | 1 << 14 | 1 << 16
-    @specs.set_flags(obj1, 0)
+    @specs.get_flags(obj2).should == @taint | 1 << 14 | 1 << 16 | initial
+    @specs.set_flags(obj1, initial)
     @specs.copy_flags(obj2, obj1)
-    @specs.get_flags(obj2).should == 0
+    @specs.get_flags(obj2).should == initial
   end
 
   it "supports retrieving the (meta)class" do
-- 
cgit v0.10.2


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

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