summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorruki <[email protected]>2019-12-11 00:46:15 +0800
committerruki <[email protected]>2019-12-10 22:37:34 +0800
commitb6dd6f29f65cab54cfbec2ec234c05abd8ab46bd (patch)
tree2a23fda12bde5a8728a9f918657410512cf39ea1 /tests
parent965ce42e75869cdec94570a5411b4acd163abe20 (diff)
impl scheduler.sleep
Diffstat (limited to 'tests')
-rw-r--r--tests/modules/scheduler/test.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/modules/scheduler/test.lua b/tests/modules/scheduler/test.lua
index 364b87d2d..3e5cb83b1 100644
--- a/tests/modules/scheduler/test.lua
+++ b/tests/modules/scheduler/test.lua
@@ -15,16 +15,20 @@ end
function test_sleep(t)
- --[[
+ local count = 0
local task = function (a)
local dt = os.mclock()
scheduler.sleep(500)
dt = os.mclock() - dt
t:require(dt > 100 and dt < 1000)
+ count = count + 1
+ if count == 3 then
+ scheduler.stop()
+ end
end
for i = 1, 3 do
scheduler.co_start(task)
end
- scheduler.runloop()]]
+ scheduler.runloop()
end