Add a test for c2.later

This commit is contained in:
Mm2PL 2024-10-10 13:41:49 +02:00
parent 53ae8ab8ca
commit 22646608f9
No known key found for this signature in database
GPG key ID: 94AC9B80EFA15ED9

View file

@ -547,4 +547,28 @@ TEST_F(PluginTest, requireNoData)
)lua"));
}
TEST_F(PluginTest, testTimerRec)
{
configure();
RequestWaiter waiter;
lua->set("done", [&] {
waiter.requestDone();
});
sol::protected_function fn = lua->script(R"lua(
local i = 0
f = function()
i = i + 1
c2.log(c2.LogLevel.Debug, "cb", i)
if i < 1024 then
c2.later(f, 1)
else
done()
end
end
c2.later(f, 1)
)lua");
waiter.waitForRequest();
}
#endif