mirror of
https://github.com/lune-org/lune.git
synced 2024-12-13 13:30:38 +00:00
Add cloning to attribute test
This commit is contained in:
parent
0c46a82b10
commit
7cbc75f8e9
1 changed files with 24 additions and 0 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue