1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

DO NOT CORRUPT TYPE FLAGS

This commit is contained in:
Nobuyoshi Nakada 2020-05-03 00:11:47 +09:00
parent 9998161b10
commit 717680f197
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6

View file

@ -56,20 +56,23 @@ describe :rbasic, shared: true do
it "supports user flags" do it "supports user flags" do
obj, _ = @data.call obj, _ = @data.call
@specs.get_flags(obj).should == 0 initial = @specs.get_flags(obj)
@specs.set_flags(obj, 1 << 14 | 1 << 16).should == 1 << 14 | 1 << 16 initial.should_not == 0
@specs.get_flags(obj).should == 1 << 14 | 1 << 16 @specs.set_flags(obj, 1 << 14 | 1 << 16 | initial).should == 1 << 14 | 1 << 16 | initial
@specs.set_flags(obj, 0).should == 0 @specs.get_flags(obj).should == 1 << 14 | 1 << 16 | initial
@specs.set_flags(obj, initial).should == initial
end end
it "supports copying the flags from one object over to the other" do it "supports copying the flags from one object over to the other" do
obj1, obj2 = @data.call 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.copy_flags(obj2, obj1)
@specs.get_flags(obj2).should == @taint | 1 << 14 | 1 << 16 @specs.get_flags(obj2).should == @taint | 1 << 14 | 1 << 16 | initial
@specs.set_flags(obj1, 0) @specs.set_flags(obj1, initial)
@specs.copy_flags(obj2, obj1) @specs.copy_flags(obj2, obj1)
@specs.get_flags(obj2).should == 0 @specs.get_flags(obj2).should == initial
end end
it "supports retrieving the (meta)class" do it "supports retrieving the (meta)class" do