util.async: Use wrapper for once runner (thanks luacheck)
authorKim Alvefur <zash@zash.se>
Thu, 22 Mar 2018 23:15:04 +0100
changeset 8672 2aa85b0cd2b8
parent 8671 31c5abd49dfe
child 8673 800c648827e3
util.async: Use wrapper for once runner (thanks luacheck)
spec/util_async_spec.lua
util/async.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()
--- 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