From 462e9a4f5a5d54d4b51f4697e8f4becb0e18dcca Mon Sep 17 00:00:00 2001 From: Filip Tibell Date: Tue, 3 Oct 2023 21:21:13 -0500 Subject: [PATCH] Expand typeof global test suite --- tests/globals/typeof.luau | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/globals/typeof.luau b/tests/globals/typeof.luau index 6cbf198..f42defe 100644 --- a/tests/globals/typeof.luau +++ b/tests/globals/typeof.luau @@ -1,3 +1,6 @@ +-- NOTE: luau-lsp warns without this for the roblox types below +--!nolint UnknownType + local task = require("@lune/task") local function f() end @@ -14,3 +17,13 @@ assert( assert(typeof(thread2) == "thread", "Calling typeof() did not return 'thread' after task.spawn") assert(typeof(thread3) == "thread", "Calling typeof() did not return 'thread' after task.defer") assert(typeof(thread4) == "thread", "Calling typeof() did not return 'thread' after delay") + +local roblox = require("@lune/roblox") + +local rbx1 = roblox.Instance.new("Part") +local rbx2 = (roblox :: any).Vector3.zero +local rbx3 = (roblox :: any).Enum.KeyCode.A + +assert(typeof(rbx1) == "Instance", "Calling typeof() did not return 'Instance' for Instance.new") +assert(typeof(rbx2) == "Vector3", "Calling typeof() did not return 'Vector3' for Vector3.zero") +assert(typeof(rbx3) == "EnumItem", "Calling typeof() did not return 'EnumItem' for Enum.KeyCode.A")