From 6ab56068466fc1ea09f0c9f950e6139471b6cdcc Mon Sep 17 00:00:00 2001 From: Ukendio Date: Fri, 5 Jul 2024 16:13:39 +0200 Subject: [PATCH] Should test for removing as well --- tests/world.luau | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/world.luau b/tests/world.luau index 81658be..3d1ec6a 100644 --- a/tests/world.luau +++ b/tests/world.luau @@ -389,23 +389,22 @@ TEST("world", function() CHECK(count == 2) end - do CASE "infinite" + do CASE "should be able to add matching entity during iteration" local world = jecs.World.new() local Name = world:component() for i = 1, 5 do local e = world:entity() - world:set(e, Name, i) + world:set(e, Name, tostring(e)) end local count = 0 - for _ in world:query(Name) do + for id, name in world:query(Name) do count += 1 + CHECK(id == tonumber(name)) - - print(count) + world:remove(id, Name) local e = world:entity() - world:set(e, Name, e) + world:set(e, Name, tostring(e)) end - print(count) CHECK(count == 5) end end)