mirror of
https://github.com/bjc/prosody.git
synced 2025-04-01 20:27:39 +03:00
util.poll: Expand stub tests
Because tests good.
This commit is contained in:
parent
36fbcd4772
commit
d1c2e34e61
1 changed files with 32 additions and 3 deletions
|
@ -1,6 +1,35 @@
|
|||
describe("util.poll", function ()
|
||||
it("loads", function ()
|
||||
require "util.poll"
|
||||
describe("util.poll", function()
|
||||
local poll;
|
||||
setup(function()
|
||||
poll = require "util.poll";
|
||||
end);
|
||||
it("loads", function()
|
||||
assert.is_table(poll);
|
||||
assert.is_function(poll.new);
|
||||
assert.is_string(poll.api);
|
||||
end);
|
||||
describe("new", function()
|
||||
local p;
|
||||
setup(function()
|
||||
p = poll.new();
|
||||
end)
|
||||
it("times out", function ()
|
||||
local fd, err = p:wait(0);
|
||||
assert.falsy(fd);
|
||||
assert.equal("timeout", err);
|
||||
end);
|
||||
it("works", function()
|
||||
-- stdout should be writable, right?
|
||||
assert.truthy(p:add(1, false, true));
|
||||
local fd, r, w = p:wait(1);
|
||||
assert.is_number(fd);
|
||||
assert.is_boolean(r);
|
||||
assert.is_boolean(w);
|
||||
assert.equal(1, fd);
|
||||
assert.falsy(r);
|
||||
assert.truthy(w);
|
||||
assert.truthy(p:del(1));
|
||||
end);
|
||||
end)
|
||||
end);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue