Use 'shareable' with an 'e' [ci skip]
This commit is contained in:
parent
8376cae25a
commit
9c8f0a34df
@ -420,7 +420,7 @@ assert_equal 'no _dump_data is defined for class Thread', %q{
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
# send sharable and unsharable objects
|
# send shareable and unshareable objects
|
||||||
assert_equal "ok", %q{
|
assert_equal "ok", %q{
|
||||||
echo_ractor = Ractor.new do
|
echo_ractor = Ractor.new do
|
||||||
loop do
|
loop do
|
||||||
@ -702,7 +702,7 @@ assert_equal 'ArgumentError', %q{
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
# ivar in sharable-objects are not allowed to access from non-main Ractor
|
# ivar in shareable-objects are not allowed to access from non-main Ractor
|
||||||
assert_equal 'can not access instance variables of classes/modules from non-main Ractors', %q{
|
assert_equal 'can not access instance variables of classes/modules from non-main Ractors', %q{
|
||||||
class C
|
class C
|
||||||
@iv = 'str'
|
@iv = 'str'
|
||||||
@ -722,7 +722,7 @@ assert_equal 'can not access instance variables of classes/modules from non-main
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
# ivar in sharable-objects are not allowed to access from non-main Ractor
|
# ivar in shareable-objects are not allowed to access from non-main Ractor
|
||||||
assert_equal 'can not access instance variables of shareable objects from non-main Ractors', %q{
|
assert_equal 'can not access instance variables of shareable objects from non-main Ractors', %q{
|
||||||
shared = Ractor.new{}
|
shared = Ractor.new{}
|
||||||
shared.instance_variable_set(:@iv, 'str')
|
shared.instance_variable_set(:@iv, 'str')
|
||||||
@ -738,7 +738,7 @@ assert_equal 'can not access instance variables of shareable objects from non-ma
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
# But a sharable object is frozen, it is allowed to access ivars from non-main Ractor
|
# But a shareable object is frozen, it is allowed to access ivars from non-main Ractor
|
||||||
assert_equal '11', %q{
|
assert_equal '11', %q{
|
||||||
[Object.new, [], ].map{|obj|
|
[Object.new, [], ].map{|obj|
|
||||||
obj.instance_variable_set('@a', 1)
|
obj.instance_variable_set('@a', 1)
|
||||||
@ -750,7 +750,7 @@ assert_equal '11', %q{
|
|||||||
}.join
|
}.join
|
||||||
}
|
}
|
||||||
|
|
||||||
# cvar in sharable-objects are not allowed to access from non-main Ractor
|
# cvar in shareable-objects are not allowed to access from non-main Ractor
|
||||||
assert_equal 'can not access class variables from non-main Ractors', %q{
|
assert_equal 'can not access class variables from non-main Ractors', %q{
|
||||||
class C
|
class C
|
||||||
@@cv = 'str'
|
@@cv = 'str'
|
||||||
@ -769,8 +769,8 @@ assert_equal 'can not access class variables from non-main Ractors', %q{
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
# Getting non-sharable objects via constants by other Ractors is not allowed
|
# Getting non-shareable objects via constants by other Ractors is not allowed
|
||||||
assert_equal 'can not access non-sharable objects in constant C::CONST by non-main Ractor.', %q{
|
assert_equal 'can not access non-shareable objects in constant C::CONST by non-main Ractor.', %q{
|
||||||
class C
|
class C
|
||||||
CONST = 'str'
|
CONST = 'str'
|
||||||
end
|
end
|
||||||
@ -784,7 +784,7 @@ assert_equal 'can not access non-sharable objects in constant C::CONST by non-ma
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
# Setting non-sharable objects into constants by other Ractors is not allowed
|
# Setting non-shareable objects into constants by other Ractors is not allowed
|
||||||
assert_equal 'can not set constants with non-shareable objects by non-main Ractors', %q{
|
assert_equal 'can not set constants with non-shareable objects by non-main Ractors', %q{
|
||||||
class C
|
class C
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user