3
0
mirror of https://github.com/britzl/monarch.git synced 2025-09-27 18:12:22 +02:00

Added callback tracker tests

This commit is contained in:
Björn Ritzl
2019-07-31 18:20:06 +02:00
parent f5879a5f63
commit d74efaf186
3 changed files with 77 additions and 0 deletions

View File

@@ -18,9 +18,15 @@ function M.create()
-- @return Callback function
function instance.track()
callback_count = callback_count + 1
local done = false
return function()
if done then
return false, "The callback has already been invoked once"
end
done = true
callback_count = callback_count - 1
invoke_if_done()
return true
end
end