Comparison

spec/util_async_spec.lua @ 8683:867ac771fb6e

util.async: Remove async.once(), can now be replaced by runner():run(func)
author Matthew Wild <mwild1@gmail.com>
date Fri, 23 Mar 2018 14:22:01 +0000
parent 8681:0c077800cd70
child 10541:6c6ff4509082
comparison
equal deleted inserted replaced
8682:151ecd18d624 8683:867ac771fb6e
611 r:run(true); 611 r:run(true);
612 assert.spy(r.func).was.called(); 612 assert.spy(r.func).was.called();
613 assert.spy(r.watchers.error).was_not.called(); 613 assert.spy(r.watchers.error).was_not.called();
614 end); 614 end);
615 end); 615 end);
616
617 describe("#once()", function ()
618 it("should work", function ()
619 local f = spy.new(function ()
620 assert.truthy(async.ready());
621 end);
622 async.once(f);
623 assert.spy(f).was.called();
624 assert.spy(f).was.called_with();
625 end);
626 it("should propagate errors", function ()
627 local function should_error()
628 async.once(function ()
629 error("hello world");
630 end);
631 end;
632 assert.error_matches(should_error, "hello world");
633 end);
634 end);
635 end); 616 end);