diff --git a/src/tests/task/defer.luau b/src/tests/task/defer.luau index 11e164e..22ba647 100644 --- a/src/tests/task/defer.luau +++ b/src/tests/task/defer.luau @@ -1,3 +1,8 @@ +-- Deferring a task should return the thread that can then be cancelled + +local thread = task.defer(function() end) +assert(type(thread) == "thread", "Defer should return the thread spawned") + -- Deferred functions should run after other threads local flag: boolean = false diff --git a/src/tests/task/delay.luau b/src/tests/task/delay.luau index b5c9f2c..fa0327e 100644 --- a/src/tests/task/delay.luau +++ b/src/tests/task/delay.luau @@ -1,3 +1,8 @@ +-- Delaying a task should return the thread that can then be cancelled + +local thread = task.delay(0, function() end) +assert(type(thread) == "thread", "Delay should return the thread spawned") + -- Delayed functions should never run right away local flag: boolean = false diff --git a/src/tests/task/spawn.luau b/src/tests/task/spawn.luau index 99cb7bd..24f8c00 100644 --- a/src/tests/task/spawn.luau +++ b/src/tests/task/spawn.luau @@ -1,3 +1,8 @@ +-- Spawning a task should return the thread that can then be cancelled + +local thread = task.spawn(function() end) +assert(type(thread) == "thread", "Spawn should return the thread spawned") + -- Spawned functions should run right away local flag: boolean = false