test case

This commit is contained in:
lolmanurfunny 2025-03-11 15:39:30 -04:00
parent e2ea71a7fe
commit 03666c9b61

View file

@ -1333,6 +1333,26 @@ TEST("world:target", function()
CHECK(i == 10) CHECK(i == 10)
end end
do CASE("should return correct targets after deletion") -- ISSUE #207
local world = jecs.World.new()
local Attacks = world:component()
local Eats = world:component()
local a = world:entity()
local b = world:entity()
local c = world:entity()
world:add(a, jecs.pair(Attacks, b))
world:add(a, jecs.pair(Attacks, c))
world:add(a, jecs.pair(Eats, c))
world:add(a, jecs.pair(Eats, b))
world:delete(c)
CHECK(world:target(a, Attacks, 0) == b)
CHECK(not world:target(a, Attacks, 1))
CHECK(not world:target(a, Attacks, 2))
end
end) end)
TEST("world:contains", function() TEST("world:contains", function()