Make cleanup more robust
Signed-off-by: Rahix <rahix@rahix.de>
This commit is contained in:
parent
af97600952
commit
0d852d7aac
3 changed files with 43 additions and 3 deletions
|
|
@ -11,11 +11,14 @@ function test_clean_simple()
|
|||
bc:close()
|
||||
|
||||
local bc = BaseControl:finalize()
|
||||
assert_true(network.get_callback(addr) ~= nil, "callback not registered")
|
||||
bc:close()
|
||||
|
||||
assert_error(function()
|
||||
bc:nouns()
|
||||
end)
|
||||
|
||||
assert_nil(network.get_callback(addr), "callback still in network")
|
||||
end
|
||||
|
||||
function test_clean_network()
|
||||
|
|
@ -66,3 +69,25 @@ function test_clean_network2()
|
|||
bc2:get("cln3")
|
||||
end)
|
||||
end
|
||||
|
||||
function test_unclean_deregister()
|
||||
local bc = BaseControl:new()
|
||||
local addr = network.get_scene()
|
||||
|
||||
network.set_scene("UNCL-DEREG")
|
||||
network.send(
|
||||
addr,
|
||||
BaseControl.Network.default_port,
|
||||
serialization.serialize{ty=BaseControl.Message.Hello}
|
||||
)
|
||||
|
||||
assert_true(network.get_callback(addr) ~= nil, "callback not registered")
|
||||
bc = nil
|
||||
collectgarbage()
|
||||
network.send(
|
||||
addr,
|
||||
BaseControl.Network.default_port,
|
||||
serialization.serialize{ty=BaseControl.Message.Hello}
|
||||
)
|
||||
assert_nil(network.get_callback(addr), "callback still in network")
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue