mirror of
https://github.com/centau/vide.git
synced 2026-10-21 03:36:10 +00:00
Fix effect updating its own source looping in strict mode
This commit is contained in:
parent
bafdd3b243
commit
a74452f46e
2 changed files with 16 additions and 1 deletions
|
|
@ -3171,6 +3171,21 @@ TEST("strict", wrap_root(function()
|
|||
CHECK(count == 4)
|
||||
end
|
||||
|
||||
do CASE "effect updating its own source"
|
||||
local src = source(0)
|
||||
local count = 0
|
||||
|
||||
effect(function()
|
||||
count += 1
|
||||
if count > 100 then return end
|
||||
local v = src()
|
||||
if v > 0 then src(v + 1) end
|
||||
end)
|
||||
|
||||
CHECK(not pcall(src, 1))
|
||||
CHECK(count < 100)
|
||||
end
|
||||
|
||||
do CASE "destruction of active scope"
|
||||
local src = source(false)
|
||||
local count = 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue