# HG changeset patch # User Kim Alvefur # Date 1521756904 -3600 # Node ID 2aa85b0cd2b84efe13967d292a3df58969411de9 # Parent 31c5abd49dfe9d8a8391ee12eb0f059fab4dae11 util.async: Use wrapper for once runner (thanks luacheck) diff -r 31c5abd49dfe -r 2aa85b0cd2b8 spec/util_async_spec.lua --- a/spec/util_async_spec.lua Thu Mar 22 21:54:59 2018 +0000 +++ b/spec/util_async_spec.lua Thu Mar 22 23:15:04 2018 +0100 @@ -601,6 +601,7 @@ end); async.once(f); assert.spy(f).was.called(); + assert.spy(f).was.called_with(); end); it("should propagate errors", function () local function should_error() diff -r 31c5abd49dfe -r 2aa85b0cd2b8 util/async.lua --- a/util/async.lua Thu Mar 22 21:54:59 2018 +0000 +++ b/util/async.lua Thu Mar 22 23:15:04 2018 +0100 @@ -231,7 +231,7 @@ }; local function once_runner(func) func(); end function once(func) - local r = runner(func, once_watchers); + local r = runner(once_runner, once_watchers); return r:run(func); end end