From 29a4a02f30f00984beb3891510b74a017c9e95d8 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Wed, 13 Apr 2016 14:39:39 -0400 Subject: [PATCH] Add tests for postWrap and preWrap. --- spec/tiny_spec.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/spec/tiny_spec.lua b/spec/tiny_spec.lua index 7c1f3eb..b92d4c0 100644 --- a/spec/tiny_spec.lua +++ b/spec/tiny_spec.lua @@ -283,6 +283,27 @@ describe('tiny-ecs:', function() assert.equals(sortsys.entities[3], entity1) end) + it("Runs preWrap and postWrap for systems.", function() + local str = "" + local sys1 = tiny.system() + local sys2 = tiny.system() + function sys1:preWrap(dt) + str = str .. "<" + end + function sys2:preWrap(dt) + str = str .. "{" + end + function sys1:postWrap(dt) + str = str .. ">" + end + function sys2:postWrap(dt) + str = str .. "}" + end + world:add(sys1, sys2) + world:update(1) + assert.equals(str, "{<>}") + end) + end) it("Doesn't pollute the global namespace", function()