You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.2 KiB
57 lines
1.2 KiB
require("lunit")
|
|
|
|
local network = require("network")
|
|
local serialization = require("serialization")
|
|
local BaseControl = require("bc")
|
|
|
|
module("timeout", 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(0.1, "toc1v")
|
|
end)
|
|
end
|
|
|
|
function test_timeout_finalize()
|
|
local bc1 = BaseControl:new()
|
|
local addr1 = network.get_scene()
|
|
assert_error_match("timeout", function()
|
|
bc1:finalize({"to_final1"}, 0.1)
|
|
end)
|
|
end
|