mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-25 09:30:03 +00:00
Should test for removing as well
This commit is contained in:
parent
086f7b5b40
commit
6ab5606846
1 changed files with 6 additions and 7 deletions
|
@ -389,23 +389,22 @@ TEST("world", function()
|
||||||
CHECK(count == 2)
|
CHECK(count == 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
do CASE "infinite"
|
do CASE "should be able to add matching entity during iteration"
|
||||||
local world = jecs.World.new()
|
local world = jecs.World.new()
|
||||||
local Name = world:component()
|
local Name = world:component()
|
||||||
for i = 1, 5 do
|
for i = 1, 5 do
|
||||||
local e = world:entity()
|
local e = world:entity()
|
||||||
world:set(e, Name, i)
|
world:set(e, Name, tostring(e))
|
||||||
end
|
end
|
||||||
local count = 0
|
local count = 0
|
||||||
for _ in world:query(Name) do
|
for id, name in world:query(Name) do
|
||||||
count += 1
|
count += 1
|
||||||
|
CHECK(id == tonumber(name))
|
||||||
|
|
||||||
|
world:remove(id, Name)
|
||||||
print(count)
|
|
||||||
local e = world:entity()
|
local e = world:entity()
|
||||||
world:set(e, Name, e)
|
world:set(e, Name, tostring(e))
|
||||||
end
|
end
|
||||||
print(count)
|
|
||||||
CHECK(count == 5)
|
CHECK(count == 5)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
Loading…
Reference in a new issue