mirror of
https://github.com/lune-org/lune.git
synced 2025-04-11 22:10:53 +01:00
Add cross-service refs case to serializePlace tests
This commit is contained in:
parent
74d7f3d66f
commit
3e1314a0f3
1 changed files with 43 additions and 18 deletions
|
@ -2,6 +2,8 @@ local fs = require("@lune/fs")
|
|||
local roblox = require("@lune/roblox")
|
||||
local Instance = roblox.Instance
|
||||
|
||||
-- Smoke tests
|
||||
do
|
||||
local game = Instance.new("DataModel")
|
||||
|
||||
local workspace = game:GetService("Workspace")
|
||||
|
@ -29,3 +31,26 @@ assert(savedXml.Name ~= "ROOT")
|
|||
|
||||
assert(savedBinary.ClassName == "DataModel")
|
||||
assert(savedXml.ClassName == "DataModel")
|
||||
end
|
||||
|
||||
-- Ensure Ref properties are preserved across services
|
||||
do
|
||||
local game = Instance.new("DataModel")
|
||||
local ReplicatedStorage = Instance.new("ReplicatedStorage")
|
||||
local Workspace = Instance.new("Workspace")
|
||||
|
||||
Workspace.Parent = game
|
||||
ReplicatedStorage.Parent = game
|
||||
|
||||
local part = Instance.new("Part")
|
||||
part.Parent = ReplicatedStorage
|
||||
|
||||
local objectValue = Instance.new("ObjectValue")
|
||||
objectValue.Value = part
|
||||
objectValue.Parent = Workspace
|
||||
|
||||
local serialized = roblox.serializePlace(game)
|
||||
local deserialized = roblox.deserializePlace(serialized)
|
||||
|
||||
assert(deserialized.Workspace.ObjectValue.Value == deserialized.ReplicatedStorage.Part)
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue