aboutsummaryrefslogtreecommitdiffstats
path: root/spec/util_async_spec.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-03-17 23:00:04 +0100
committerKim Alvefur <zash@zash.se>2018-03-17 23:00:04 +0100
commitf8e818026229579e5201b6225866d8b072ad586a (patch)
treefd2aee303164aa38571d714cd93c861172fbce19 /spec/util_async_spec.lua
parent6c8d196c989a2963c9217da4ce365477e1b70cf6 (diff)
downloadprosody-f8e818026229579e5201b6225866d8b072ad586a.tar.gz
prosody-f8e818026229579e5201b6225866d8b072ad586a.zip
util.async: Trim trailing whitespace in tests [luacheck]
Diffstat (limited to 'spec/util_async_spec.lua')
-rw-r--r--spec/util_async_spec.lua52
1 files changed, 26 insertions, 26 deletions
diff --git a/spec/util_async_spec.lua b/spec/util_async_spec.lua
index ef19c348..955e3921 100644
--- a/spec/util_async_spec.lua
+++ b/spec/util_async_spec.lua
@@ -21,7 +21,7 @@ describe("util.async", function()
})), log;
end
describe("#runner", function()
- it("should work", function()
+ it("should work", function()
local r, l = new(function (item) assert(type(item) == "number") end);
r:run(1);
r:run(2);
@@ -246,7 +246,7 @@ describe("util.async", function()
end);
it("should work", function ()
local wait, done;
-
+
local r, l = new(function (item)
assert(type(item) == "number")
if item == 3 then
@@ -254,7 +254,7 @@ describe("util.async", function()
wait();
end
end);
-
+
r:run(1);
assert(r.state == "ready");
r:run(2);
@@ -265,7 +265,7 @@ describe("util.async", function()
assert(r.state == "ready");
--for k, v in ipairs(l) do print(k,v) end
end);
-
+
it("should work", function ()
--------------------
local wait, done;
@@ -279,7 +279,7 @@ describe("util.async", function()
wait();
end
end);
-
+
r:run(1);
assert(r.state == "ready");
r:run(2);
@@ -305,12 +305,12 @@ describe("util.async", function()
wait();
end
end);
-
+
r:run(1);
assert(r.state == "ready");
r:run(2);
assert(r.state == "ready");
-
+
local dones = {};
r:run(3);
assert(r.state == "waiting");
@@ -320,14 +320,14 @@ describe("util.async", function()
assert(r.state == "waiting");
r:run(4);
assert(r.state == "waiting");
-
+
for i = 1, 3 do
done();
if i < 3 then
assert(r.state == "waiting");
end
end
-
+
assert(r.state == "ready");
--for k, v in ipairs(l) do print(k,v) end
end);
@@ -344,29 +344,29 @@ describe("util.async", function()
wait();
end
end);
-
+
r:run(1);
assert(r.state == "ready");
r:run(2);
assert(r.state == "ready");
-
+
local dones = {};
r:run(3);
assert(r.state == "waiting");
r:run(3);
assert(r.state == "waiting");
-
+
for i = 1, 2 do
done();
if i < 2 then
assert(r.state == "waiting");
end
end
-
+
assert(r.state == "ready");
r:run(4);
assert(r.state == "ready");
-
+
assert(r.state == "ready");
--for k, v in ipairs(l) do print(k,v) end
end);
@@ -384,7 +384,7 @@ describe("util.async", function()
wait1();
end
end, "r1");
-
+
local wait2, done2;
local last_item2 = 0;
local r2, l2 = new(function (item)
@@ -396,51 +396,51 @@ describe("util.async", function()
wait2();
end
end, "r2");
-
+
r1:run(1);
assert(r1.state == "ready");
r1:run(2);
assert(r1.state == "ready");
-
+
local dones = {};
r1:run(3);
assert(r1.state == "waiting");
r1:run(3);
assert(r1.state == "waiting");
-
+
r2:run(1);
assert(r1.state == "waiting");
assert(r2.state == "ready");
-
+
r2:run(2);
assert(r1.state == "waiting");
assert(r2.state == "ready");
-
+
r2:run(3);
assert(r1.state == "waiting");
assert(r2.state == "waiting");
done2();
-
+
r2:run(3);
assert(r1.state == "waiting");
assert(r2.state == "waiting");
done2();
-
+
r2:run(4);
assert(r1.state == "waiting");
assert(r2.state == "ready");
-
+
for i = 1, 2 do
done1();
if i < 2 then
assert(r1.state == "waiting");
end
end
-
+
assert(r1.state == "ready");
r1:run(4);
assert(r1.state == "ready");
-
+
assert(r1.state == "ready");
--for k, v in ipairs(l1) do print(k,v) end
end);
@@ -519,7 +519,7 @@ describe("util.async", function()
assert.equal(r2.state, "ready");
done1();
-
+
assert.equal(r1.state, "ready");
r1:run(4);
assert.equal(r1.state, "ready");