forked from luvit/luv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-req.lua
34 lines (28 loc) · 841 Bytes
/
test-req.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
return require('lib/tap')(function (test)
test("cancel", function (print, p, expect, uv)
-- might need to try a few times since cancel can fail with EBUSY
for _=1,5 do
local req = assert(uv.fs_stat('.', expect(function(err)
if err then
assert(err:match("^ECANCELED"))
else
assert(not err, err)
end
end)))
local _, cancel_err = req:cancel()
if cancel_err == nil then
break
end
end
end)
test("get type", function (print, p, expect, uv)
local req = uv.fs_stat('.', expect(function(err)
assert(not err, err)
end))
local typename, typeid = req:get_type()
assert(typename == "fs")
local typename_, typeid_ = uv.req_get_type(req)
assert(typename == typename_)
assert(typeid == typeid_)
end, "1.19.0")
end)