From 38ac92b0df128fea95cb790f2920d747045598df Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Thu, 22 Mar 2018 07:56:01 +0000 Subject: util.async: Add once() to create temporary runners --- spec/util_async_spec.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'spec') diff --git a/spec/util_async_spec.lua b/spec/util_async_spec.lua index ac71e755..f7e469c9 100644 --- a/spec/util_async_spec.lua +++ b/spec/util_async_spec.lua @@ -593,4 +593,14 @@ describe("util.async", function() assert.spy(r.watchers.error).was_not.called(); end); end); + + describe("#once()", function () + it("should work", function () + local f = spy.new(function () + assert.truthy(async.ready()); + end); + async.once(f); + assert.spy(f).was.called(); + end); + end); end); -- cgit v1.2.3