Skip to content

Commit

Permalink
Merge branch 'integration_tests_built_in' into 'master'
Browse files Browse the repository at this point in the history
Enable built-in script in the integration tests

See merge request OpenMW/openmw!4289
  • Loading branch information
psi29a committed Aug 2, 2024
2 parents e8fcdae + 397518e commit 07c89c4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/data/integration_tests/test_lua_api/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ testing.registerLocalTest('findNearestNavMeshPosition',

return {
engineHandlers = {
onUpdate = testing.updateLocal,
onFrame = testing.updateLocal,
},
eventHandlers = testing.eventHandlers
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
GLOBAL: test.lua
PLAYER: player.lua

16 changes: 12 additions & 4 deletions scripts/data/integration_tests/testing_util/testing_util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -181,7 +185,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
Expand All @@ -196,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,
Expand Down

0 comments on commit 07c89c4

Please sign in to comment.