Add cloning to attribute test

This commit is contained in:
Filip Tibell 2023-03-26 11:58:30 +02:00
parent 0c46a82b10
commit 7cbc75f8e9
No known key found for this signature in database

View file

@ -66,6 +66,30 @@ for name, value in ATTRS_EXPECTED do
end end
end end
-- Cloning instances should also clone attributes
local cloned = model:Clone()
ATTRS_ACTUAL = cloned:GetAttributes()
for name, value in ATTRS_EXPECTED do
local actual = ATTRS_ACTUAL[name]
if actual ~= value then
if value ~= value and actual ~= actual then
continue -- NaN
end
error(
string.format(
"Expected cloned attribute '%s' to have value '%s', got value '%s'",
name,
tostring(value),
tostring(actual)
)
)
end
end
-- Writing files with modified attributes should work
local game = Instance.new("DataModel") local game = Instance.new("DataModel")
model.Parent = game model.Parent = game