diff --git a/packages/lib/src/tests.rs b/packages/lib/src/tests.rs index d9e351c..760ae49 100644 --- a/packages/lib/src/tests.rs +++ b/packages/lib/src/tests.rs @@ -116,13 +116,18 @@ create_tests! { roblox_datatype_vector2int16: "roblox/datatypes/Vector2int16", roblox_datatype_vector3: "roblox/datatypes/Vector3", roblox_datatype_vector3int16: "roblox/datatypes/Vector3int16", + roblox_files_read_model: "roblox/files/readModelFile", roblox_files_read_place: "roblox/files/readPlaceFile", roblox_files_write_model: "roblox/files/writeModelFile", roblox_files_write_place: "roblox/files/writePlaceFile", + roblox_instance_attributes: "roblox/instance/attributes", + roblox_instance_datamodel: "roblox/instance/datamodel", roblox_instance_new: "roblox/instance/new", 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_clone: "roblox/instance/methods/Clone", roblox_instance_methods_destroy: "roblox/instance/methods/Destroy", diff --git a/tests/roblox/instance/datamodel.luau b/tests/roblox/instance/datamodel.luau new file mode 100644 index 0000000..f75e95b --- /dev/null +++ b/tests/roblox/instance/datamodel.luau @@ -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)) diff --git a/tests/roblox/instance/tags.luau b/tests/roblox/instance/tags.luau new file mode 100644 index 0000000..64668df --- /dev/null +++ b/tests/roblox/instance/tags.luau @@ -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)