diff options
| author | ruki <[email protected]> | 2020-02-04 00:36:07 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-02-07 22:45:56 +0800 |
| commit | 459ac3d64ed2b78a8b0ba058ca161a38d576dadc (patch) | |
| tree | 9bbafa601fb6ea47ef19e3caa6fe56c6dc5802b7 /tests/modules/scheduler/test.lua | |
| parent | 486cc3bb146e19542991fd2ac3ac385f101bde1a (diff) | |
update scheduler/test
Diffstat (limited to 'tests/modules/scheduler/test.lua')
| -rw-r--r-- | tests/modules/scheduler/test.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/modules/scheduler/test.lua b/tests/modules/scheduler/test.lua index f794c8a3e..d7f09bd96 100644 --- a/tests/modules/scheduler/test.lua +++ b/tests/modules/scheduler/test.lua @@ -30,3 +30,16 @@ function test_sleep(t) scheduler.runloop() end +function test_yield(t) + + local count = 0 + local task = function (a) + scheduler.co_yield() + count = count + 1 + end + for i = 1, 10 do + scheduler.co_start(task) + end + scheduler.runloop() + t:are_equal(count, 10) +end |
