mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-25 01:20:04 +00:00
Amend test
This commit is contained in:
parent
059a3f9bed
commit
1844b0cfd8
1 changed files with 18 additions and 21 deletions
|
@ -25,12 +25,23 @@ local N = 10
|
|||
type World = jecs.WorldShim
|
||||
|
||||
TEST("world", function()
|
||||
do CASE "should not error when removing a component that entity doesn't have"
|
||||
local world = jecs.World.new() :: World
|
||||
local A = world:component()
|
||||
local e = world:entity()
|
||||
world:remove(e, A)
|
||||
CHECK(true)
|
||||
do CASE "should allow remove a component that doesn't exist on entity"
|
||||
local world = jecs.World.new()
|
||||
|
||||
local Health = world:entity()
|
||||
local Poison = world:component()
|
||||
|
||||
local id = world:entity()
|
||||
do
|
||||
world:remove(id, Poison)
|
||||
CHECK(true) -- Didn't error
|
||||
end
|
||||
|
||||
world:set(id, Health, 50)
|
||||
world:remove(id, Poison)
|
||||
|
||||
CHECK(world:get(id, Poison) == nil)
|
||||
CHECK(world:get(id, Health) == 50)
|
||||
end
|
||||
do CASE("should find every component id")
|
||||
local world = jecs.World.new() :: World
|
||||
|
@ -231,20 +242,6 @@ TEST("world", function()
|
|||
CHECK(world:get(id1, Health) == 50)
|
||||
end
|
||||
|
||||
do CASE("should allow remove that doesn't exist on entity")
|
||||
local world = jecs.World.new()
|
||||
|
||||
local Health = world:entity()
|
||||
local Poison = world:component()
|
||||
|
||||
local id = world:entity()
|
||||
world:set(id, Health, 50)
|
||||
world:remove(id, Poison)
|
||||
|
||||
CHECK(world:get(id, Poison) == nil)
|
||||
CHECK(world:get(id, Health) == 50)
|
||||
end
|
||||
|
||||
do CASE("should increment generation")
|
||||
local world = jecs.World.new()
|
||||
local e = world:entity()
|
||||
|
|
Loading…
Reference in a new issue