forked from luvit/luv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-prepare-check-idle-async.lua
49 lines (43 loc) · 1.17 KB
/
test-prepare-check-idle-async.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
return require('lib/tap')(function (test)
test("simple prepare", function (print, p, expect, uv)
local prepare = uv.new_prepare()
uv.prepare_start(prepare, expect(function ()
p("prepare", prepare)
uv.prepare_stop(prepare)
uv.close(prepare, expect(function ()
end))
end))
end)
test("simple check", function (print, p, expect, uv)
local check = uv.new_check()
uv.check_start(check, expect(function ()
p("check", check)
uv.check_stop(check)
uv.close(check, expect(function ()
end))
end))
-- Trigger with a timer
local timer = uv.new_timer()
uv.timer_start(timer, 10, 0, expect(function()
p("timeout", timer)
uv.timer_stop(timer)
uv.close(timer)
end))
end)
test("simple idle", function (print, p, expect, uv)
local idle = uv.new_idle()
uv.idle_start(idle, expect(function ()
p("idle", idle)
uv.idle_stop(idle)
uv.close(idle, expect(function ()
end))
end))
end)
test("simple async", function (print, p, expect, uv)
local async
async = uv.new_async(expect(function ()
uv.close(async)
end))
uv.async_send(async)
end)
end)