aboutsummaryrefslogtreecommitdiffstats
path: root/conf.d/project
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-06-16 02:16:08 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-07-10 17:12:13 +0200
commit7290d344682d4bf3f02684788d997660500c304e (patch)
treec2ff19f518bf56522abbf92c4bb2e49d7d9d3bef /conf.d/project
parentf5656a80d97ea965b50c7027106b11da81b44f46 (diff)
Execute Callback in assertion is more useful
Indeed we need to be able to execute a callback to improve the assertion so it has to lies in the assert and not the verb Change-Id: Id835d76c1984087fb815db207c89cfe650f6240c Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'conf.d/project')
-rw-r--r--conf.d/project/lua.d/aft.lua12
1 files changed, 6 insertions, 6 deletions
diff --git a/conf.d/project/lua.d/aft.lua b/conf.d/project/lua.d/aft.lua
index ff6d8c7..1d74c08 100644
--- a/conf.d/project/lua.d/aft.lua
+++ b/conf.d/project/lua.d/aft.lua
@@ -84,7 +84,7 @@ function _AFT.requestDaemonEventHandler(eventObj)
local eventName = eventObj.data.message
local log = _AFT.monitored_events[eventName]
local api = nil
- print(log.api, api)
+
if eventObj.daemon then
api = eventObj.daemon.api
elseif eventObj.request then
@@ -114,7 +114,6 @@ function _AFT.bindingEventHandler(eventObj)
end
function _evt_catcher_ (source, action, eventObj)
- print(Dump_Table(eventObj))
if eventObj.type == "event" then
_AFT.bindingEventHandler(eventObj)
elseif eventObj.type == "daemon" or eventObj.type == "request" then
@@ -133,16 +132,17 @@ function _AFT.assertEvtReceived(eventName)
end
_AFT.assertIsTrue(count > 0, "No event '".. eventName .."' received")
+
+ if _AFT.monitored_events[eventName].cb then
+ local data_n = #_AFT.monitored_events[eventName].data
+ _AFT.monitored_events[eventName].cb(eventName, _AFT.monitored_events[eventName].data[data_n])
+ end
end
function _AFT.testEvtReceived(testName, eventName, timeout)
table.insert(_AFT.tests_list, {testName, function()
if timeout then sleep(timeout) end
_AFT.assertEvtReceived(eventName)
- if _AFT.monitored_events[eventName].cb then
- local data_n = #_AFT.monitored_events[eventName].data
- _AFT.monitored_events[eventName].cb(eventName, _AFT.monitored_events[eventName].data[data_n])
- end
end})
end