Implement finalize

Signed-off-by: Rahix <rahix@rahix.de>
This commit is contained in:
rahix 2019-04-16 22:18:28 +02:00
parent 1b73d0d04c
commit 9f10348b58
3 changed files with 106 additions and 0 deletions

54
tests/timeout.lua Normal file
View file

@ -0,0 +1,54 @@
require("lunit")
local network = require("network")
local serialization = require("serialization")
local BaseControl = require("bc")
module("network", package.seeall, lunit.testcase)
function test_timeout_get()
local bc = BaseControl:new()
local addr = network.get_scene()
-- Fake-register a noun
network.register("TOG1", function()
end)
network.send(
addr,
BaseControl.Network.default_port,
serialization.serialize{
ty=BaseControl.Message.Register,
nouns={"tog1"},
}
)
assert_error_match("timeout", function()
bc:get("tog1", 0.1)
end)
end
function test_timeout_call()
local bc = BaseControl:new()
local addr = network.get_scene()
network.register("TOC1", function()
end)
network.send(
addr,
BaseControl.Network.default_port,
serialization.serialize{
ty=BaseControl.Message.Register,
verbs={"toc1v"},
}
)
assert_error_match("timeout", function()
bc:call_sync("toc1v", 0.1)
end)
end
function test_timeout_finalize()
local bc1 = BaseControl:new()
local addr1 = network.get_scene()
bc1:finalize({"to_final1"}, 0.1)
end