From 1eb44b000ff02e4a94986a2a8d936dd6566676d6 Mon Sep 17 00:00:00 2001 From: EncodedVenom Date: Mon, 8 Jul 2024 08:19:31 -0400 Subject: [PATCH] Add null query unit test --- tests/world.luau | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/world.luau b/tests/world.luau index 178650a..63f4930 100644 --- a/tests/world.luau +++ b/tests/world.luau @@ -471,6 +471,22 @@ TEST("world", function() CHECK(world:get(e, B) == false) CHECK(world:get(e, C) == "hello world") end + + 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 end) FINISH()