diff options
| author | ruki <[email protected]> | 2019-12-11 00:46:15 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-12-10 22:37:34 +0800 |
| commit | b6dd6f29f65cab54cfbec2ec234c05abd8ab46bd (patch) | |
| tree | 2a23fda12bde5a8728a9f918657410512cf39ea1 /tests/modules/scheduler | |
| parent | 965ce42e75869cdec94570a5411b4acd163abe20 (diff) | |
impl scheduler.sleep
Diffstat (limited to 'tests/modules/scheduler')
| -rw-r--r-- | tests/modules/scheduler/test.lua | 8 |
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 |
