Changeset

8669:2aa85b0cd2b8

util.async: Use wrapper for once runner (thanks luacheck)
author Kim Alvefur <zash@zash.se>
date Thu, 22 Mar 2018 23:15:04 +0100
parents 8668:31c5abd49dfe
children 8670:800c648827e3
files spec/util_async_spec.lua util/async.lua
diffstat 2 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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