blob: 56c936bc0d1aa9e7eb284cb26c36dbdb935a22e9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
if not package.preload.fixture then
error "can't be run outside of UnitTest framework"
end
local fixture = require "fixture"
local lanes = require "lanes".configure{shutdown_timeout = 0.001, on_state_create = fixture.on_state_create}
-- launch lanes that blocks forever
local lane = function()
local fixture = require "fixture"
fixture.forever()
end
-- the generator
local g1 = lanes.gen("*", {name = "auto"}, lane)
-- launch lane
local h1 = g1()
-- wait until the lane is running
repeat until h1.status == "running"
-- let the script end, Lanes should throw std::logic_error because the lane did not gracefully terminate
lanes.finally(fixture.throwing_finalizer)
|