Mercurial > prosody-hg
comparison spec/util_async_spec.lua @ 8649:9246f64d6f1e
util.async: Add once() to create temporary runners
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 22 Mar 2018 07:56:01 +0000 |
| parents | ca710a71d730 |
| children | 2f133b6e8740 |
comparison
equal
deleted
inserted
replaced
| 8648:ca710a71d730 | 8649:9246f64d6f1e |
|---|---|
| 591 r:run(true); | 591 r:run(true); |
| 592 assert.spy(r.func).was.called(); | 592 assert.spy(r.func).was.called(); |
| 593 assert.spy(r.watchers.error).was_not.called(); | 593 assert.spy(r.watchers.error).was_not.called(); |
| 594 end); | 594 end); |
| 595 end); | 595 end); |
| 596 | |
| 597 describe("#once()", function () | |
| 598 it("should work", function () | |
| 599 local f = spy.new(function () | |
| 600 assert.truthy(async.ready()); | |
| 601 end); | |
| 602 async.once(f); | |
| 603 assert.spy(f).was.called(); | |
| 604 end); | |
| 605 end); | |
| 596 end); | 606 end); |
