Ukendio / jecs

A fast, portable Entity Component System for Luau
https://ukendio.github.io/jecs/
MIT License
121 stars 20 forks source link

Add null query unit tests #69

Closed EncodedVenom closed 2 months ago

EncodedVenom commented 2 months ago

Adds the following unit test in response to #67:

do CASE "should not iterate when nothing matches query"
    local world = jecs.World.new()
    local A = world:component()
    local B = world:component()

    local e1 = world:entity()
    world:add(e1, A)

    local count = 0
    for id in world:query(B) do
        count += 1
    end

    CHECK(count == 0)
end