diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/util_async_spec.lua | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/spec/util_async_spec.lua b/spec/util_async_spec.lua index 955e3921..7cd125b7 100644 --- a/spec/util_async_spec.lua +++ b/spec/util_async_spec.lua @@ -8,17 +8,23 @@ describe("util.async", function() else print = function () end end - local function new(func, name) - local log = {}; - return async.runner(func, setmetatable({}, { + + local function mock_watchers() + return setmetatable(mock{ + ready = function () end; + waiting = function () end; + error = function () end; + }, { __index = function (_, event) - return function (runner, err) - print(name or runner.id, "event", event, err) - print "--" - table.insert(log, { event = event, err = err }); - end; + -- Unexpected watcher called + assert(false); end; - })), log; + }) + end + + local function new(func, name) + local log = {}; + return async.runner(func, mock_watchers()), log; end describe("#runner", function() it("should work", function() |