mirror of
https://github.com/lune-org/lune.git
synced 2024-12-13 13:30:38 +00:00
Add tests for datamodel & collectionservice
This commit is contained in:
parent
4b793bf2f9
commit
8799c26191
3 changed files with 64 additions and 0 deletions
|
@ -116,13 +116,18 @@ create_tests! {
|
||||||
roblox_datatype_vector2int16: "roblox/datatypes/Vector2int16",
|
roblox_datatype_vector2int16: "roblox/datatypes/Vector2int16",
|
||||||
roblox_datatype_vector3: "roblox/datatypes/Vector3",
|
roblox_datatype_vector3: "roblox/datatypes/Vector3",
|
||||||
roblox_datatype_vector3int16: "roblox/datatypes/Vector3int16",
|
roblox_datatype_vector3int16: "roblox/datatypes/Vector3int16",
|
||||||
|
|
||||||
roblox_files_read_model: "roblox/files/readModelFile",
|
roblox_files_read_model: "roblox/files/readModelFile",
|
||||||
roblox_files_read_place: "roblox/files/readPlaceFile",
|
roblox_files_read_place: "roblox/files/readPlaceFile",
|
||||||
roblox_files_write_model: "roblox/files/writeModelFile",
|
roblox_files_write_model: "roblox/files/writeModelFile",
|
||||||
roblox_files_write_place: "roblox/files/writePlaceFile",
|
roblox_files_write_place: "roblox/files/writePlaceFile",
|
||||||
|
|
||||||
roblox_instance_attributes: "roblox/instance/attributes",
|
roblox_instance_attributes: "roblox/instance/attributes",
|
||||||
|
roblox_instance_datamodel: "roblox/instance/datamodel",
|
||||||
roblox_instance_new: "roblox/instance/new",
|
roblox_instance_new: "roblox/instance/new",
|
||||||
roblox_instance_properties: "roblox/instance/properties",
|
roblox_instance_properties: "roblox/instance/properties",
|
||||||
|
roblox_instance_tags: "roblox/instance/tags",
|
||||||
|
|
||||||
roblox_instance_methods_clear_all_children: "roblox/instance/methods/ClearAllChildren",
|
roblox_instance_methods_clear_all_children: "roblox/instance/methods/ClearAllChildren",
|
||||||
roblox_instance_methods_clone: "roblox/instance/methods/Clone",
|
roblox_instance_methods_clone: "roblox/instance/methods/Clone",
|
||||||
roblox_instance_methods_destroy: "roblox/instance/methods/Destroy",
|
roblox_instance_methods_destroy: "roblox/instance/methods/Destroy",
|
||||||
|
|
24
tests/roblox/instance/datamodel.luau
Normal file
24
tests/roblox/instance/datamodel.luau
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
local roblox = require("@lune/roblox") :: any
|
||||||
|
local Instance = roblox.Instance
|
||||||
|
|
||||||
|
local game = Instance.new("DataModel")
|
||||||
|
|
||||||
|
assert(game:FindService("Workspace") == nil)
|
||||||
|
assert(game:GetService("Workspace") ~= nil)
|
||||||
|
assert(game:FindService("Workspace") ~= nil)
|
||||||
|
|
||||||
|
assert(game:FindService("CSGDictionaryService") == nil)
|
||||||
|
assert(game:GetService("CSGDictionaryService") ~= nil)
|
||||||
|
assert(game:FindService("CSGDictionaryService") ~= nil)
|
||||||
|
|
||||||
|
assert(not pcall(function()
|
||||||
|
game:GetService("wrorokspacey")
|
||||||
|
end))
|
||||||
|
|
||||||
|
assert(not pcall(function()
|
||||||
|
game:GetService("work-space")
|
||||||
|
end))
|
||||||
|
|
||||||
|
assert(not pcall(function()
|
||||||
|
game:GetService("workspac")
|
||||||
|
end))
|
35
tests/roblox/instance/tags.luau
Normal file
35
tests/roblox/instance/tags.luau
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
local roblox = require("@lune/roblox") :: any
|
||||||
|
local Instance = roblox.Instance
|
||||||
|
|
||||||
|
local game = Instance.new("DataModel")
|
||||||
|
local cs = game:GetService("CollectionService")
|
||||||
|
|
||||||
|
local model = Instance.new("Model")
|
||||||
|
local part = Instance.new("Part")
|
||||||
|
part.Parent = model
|
||||||
|
|
||||||
|
local TAG_NAME = "InstanceTagName"
|
||||||
|
|
||||||
|
assert(cs:HasTag(model, TAG_NAME) == false)
|
||||||
|
assert(cs:HasTag(part, TAG_NAME) == false)
|
||||||
|
|
||||||
|
cs:AddTag(part, TAG_NAME)
|
||||||
|
|
||||||
|
assert(cs:HasTag(model, TAG_NAME) == false)
|
||||||
|
assert(cs:HasTag(part, TAG_NAME) == true)
|
||||||
|
|
||||||
|
cs:RemoveTag(part, TAG_NAME)
|
||||||
|
|
||||||
|
assert(cs:HasTag(model, TAG_NAME) == false)
|
||||||
|
assert(cs:HasTag(part, TAG_NAME) == false)
|
||||||
|
|
||||||
|
assert(#cs:GetTags(model) == 0)
|
||||||
|
assert(#cs:GetTags(part) == 0)
|
||||||
|
|
||||||
|
cs:AddTag(model, TAG_NAME)
|
||||||
|
cs:AddTag(part, TAG_NAME)
|
||||||
|
|
||||||
|
assert(#cs:GetTags(model) == 1)
|
||||||
|
assert(#cs:GetTags(part) == 1)
|
||||||
|
assert(cs:GetTags(model)[1] == TAG_NAME)
|
||||||
|
assert(cs:GetTags(part)[1] == TAG_NAME)
|
Loading…
Reference in a new issue