Mercurial > prosody-hg
comparison spec/util_async_spec.lua @ 8608:a2e6caf5848d
util.async: Add test to ensure waiters throw an error outside async contexts
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Fri, 16 Mar 2018 22:19:33 +0000 |
| parents | 62bb06cf8a43 |
| children | 9f6ab206d741 |
comparison
equal
deleted
inserted
replaced
| 8607:62bb06cf8a43 | 8608:a2e6caf5848d |
|---|---|
| 82 assert.equal(last_processed_item, "world"); | 82 assert.equal(last_processed_item, "world"); |
| 83 end); | 83 end); |
| 84 end); | 84 end); |
| 85 end); | 85 end); |
| 86 describe("#waiter", function() | 86 describe("#waiter", function() |
| 87 it("should error outside of async context", function () | |
| 88 assert.has_error(function () | |
| 89 async.waiter(); | |
| 90 end); | |
| 91 end); | |
| 87 it("should work", function () | 92 it("should work", function () |
| 88 local wait, done; | 93 local wait, done; |
| 89 | 94 |
| 90 local r, l = new(function (item) | 95 local r, l = new(function (item) |
| 91 assert(type(item) == "number") | 96 assert(type(item) == "number") |
