mirror of
https://github.com/lune-org/lune.git
synced 2024-12-12 13:00:37 +00:00
Ensure threads get returned from task lib in unit tests
This commit is contained in:
parent
f22ef577cf
commit
276200225b
3 changed files with 15 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue