Debian Codegraph @

tests/wplua/scripts/async-activation.lua

raw
1 Script.async_activation = true
2
3 tags = {}
4
5 function checkpoint(x)
6 Log.info(x)
7 table.insert(tags, x)
8 end
9
10 Core.timeout_add(100, function()
11 checkpoint("timeout1")
12 return false
13 end)
14
15 Core.timeout_add(200, function()
16 checkpoint("timeout2")
17 return false
18 end)
19
20 Core.timeout_add(300, function()
21 checkpoint("timeout3")
22 assert(#tags == 3)
23 assert(tags[1] == "timeout1")
24 assert(tags[2] == "timeout2")
25 assert(tags[3] == "timeout3")
26 Script:finish_activation()
27 return false
28 end)
29
30 assert(#tags == 0)