From f5b24efdca2fed78aa49603982df6f7b1bd9bb1e Mon Sep 17 00:00:00 2001 From: elsid Date: Wed, 31 Jul 2024 22:34:27 +0200 Subject: [PATCH 1/3] Enable built-in script in the integration tests --- .../data/integration_tests/test_lua_api/builtin.omwscripts | 1 - scripts/data/integration_tests/test_lua_api/player.lua | 2 +- scripts/data/integration_tests/testing_util/testing_util.lua | 4 +++- 3 files changed, 4 insertions(+), 3 deletions(-) delete mode 100644 scripts/data/integration_tests/test_lua_api/builtin.omwscripts diff --git a/scripts/data/integration_tests/test_lua_api/builtin.omwscripts b/scripts/data/integration_tests/test_lua_api/builtin.omwscripts deleted file mode 100644 index 8b7db327c5..0000000000 --- a/scripts/data/integration_tests/test_lua_api/builtin.omwscripts +++ /dev/null @@ -1 +0,0 @@ -# It is an empty file that overrides builtin.omwscripts and disables builtin scripts diff --git a/scripts/data/integration_tests/test_lua_api/player.lua b/scripts/data/integration_tests/test_lua_api/player.lua index 45a3d1bf2e..95e35e7dd9 100644 --- a/scripts/data/integration_tests/test_lua_api/player.lua +++ b/scripts/data/integration_tests/test_lua_api/player.lua @@ -220,7 +220,7 @@ testing.registerLocalTest('findNearestNavMeshPosition', return { engineHandlers = { - onUpdate = testing.updateLocal, + onFrame = testing.updateLocal, }, eventHandlers = testing.eventHandlers } diff --git a/scripts/data/integration_tests/testing_util/testing_util.lua b/scripts/data/integration_tests/testing_util/testing_util.lua index 4889b40898..4aefc5afe5 100644 --- a/scripts/data/integration_tests/testing_util/testing_util.lua +++ b/scripts/data/integration_tests/testing_util/testing_util.lua @@ -181,7 +181,9 @@ end function M.updateLocal() if localTestRunner and coroutine.status(localTestRunner) ~= 'dead' then - coroutine.resume(localTestRunner) + if not core.isWorldPaused() then + coroutine.resume(localTestRunner) + end else localTestRunner = nil end From a416125cdf073ddd98dfb8929dfb9fd71be4333a Mon Sep 17 00:00:00 2001 From: elsid Date: Wed, 31 Jul 2024 22:37:17 +0200 Subject: [PATCH 2/3] Format Lua code --- .../integration_tests/testing_util/testing_util.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/data/integration_tests/testing_util/testing_util.lua b/scripts/data/integration_tests/testing_util/testing_util.lua index 4aefc5afe5..2fa1892037 100644 --- a/scripts/data/integration_tests/testing_util/testing_util.lua +++ b/scripts/data/integration_tests/testing_util/testing_util.lua @@ -31,8 +31,12 @@ function M.runLocalTest(obj, name) currentLocalTest = name currentLocalTestError = nil obj:sendEvent('runLocalTest', name) - while currentLocalTest do coroutine.yield() end - if currentLocalTestError then error(currentLocalTestError, 2) end + while currentLocalTest do + coroutine.yield() + end + if currentLocalTestError then + error(currentLocalTestError, 2) + end end function M.expect(cond, delta, msg) @@ -198,7 +202,9 @@ M.eventHandlers = { end localTestRunner = coroutine.create(function() local status, err = pcall(fn) - if status then err = nil end + if status then + err = nil + end core.sendGlobalEvent('localTestFinished', {name=name, errMsg=err}) end) end, From 397518e3e76adbe6338eb52725166c24a2e315b0 Mon Sep 17 00:00:00 2001 From: elsid Date: Wed, 31 Jul 2024 22:53:07 +0200 Subject: [PATCH 3/3] Remove redundant line --- scripts/data/integration_tests/test_lua_api/test.omwscripts | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/data/integration_tests/test_lua_api/test.omwscripts b/scripts/data/integration_tests/test_lua_api/test.omwscripts index 97f523afbd..80507392f7 100644 --- a/scripts/data/integration_tests/test_lua_api/test.omwscripts +++ b/scripts/data/integration_tests/test_lua_api/test.omwscripts @@ -1,3 +1,2 @@ GLOBAL: test.lua PLAYER: player.lua -