Implement simple verb calling

Signed-off-by: Rahix <rahix@rahix.de>
This commit is contained in:
rahix 2019-04-15 18:27:43 +02:00
parent c6bbdcf984
commit e4f19c3e20
2 changed files with 28 additions and 0 deletions

View file

@ -56,4 +56,22 @@ function test_get_network()
local bc2 = BaseControl:new()
assert_equal(123, bc2:get("getnw1"), "wrong value")
assert_nil(bc2:get("getnw2"), "found non-exisiting")
end
function test_call_network()
local bc1 = BaseControl:new()
local tmp, n = 0, 0
bc1:register("callnw1", function(param, p2)
assert_equal(p2, 1234)
tmp = param
n = n + 1
end)
bc1:finalize()
local bc2 = BaseControl:new()
bc2:call("callnw1", 4321, 1234)
assert_equal(4321, tmp, "call incomplete")
assert_equal(1, n, "call not correct")
end