1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

Add unittests for entity lifecycle and callbacks

This commit is contained in:
sfan5 2022-06-14 12:40:17 +02:00
parent e9e721b937
commit 46e7b51352
2 changed files with 136 additions and 3 deletions

View file

@ -112,7 +112,7 @@ local function wait_for_map(player, callback)
if core.get_node_or_nil(player:get_pos()) ~= nil then
callback()
else
minetest.after(0, check)
core.after(0, check)
end
end
check()
@ -170,12 +170,13 @@ end
--------------
local modpath = minetest.get_modpath("unittests")
local modpath = core.get_modpath("unittests")
dofile(modpath .. "/misc.lua")
dofile(modpath .. "/player.lua")
dofile(modpath .. "/crafting.lua")
dofile(modpath .. "/itemdescription.lua")
dofile(modpath .. "/async_env.lua")
dofile(modpath .. "/entity.lua")
--------------
@ -184,7 +185,7 @@ if core.settings:get_bool("devtest_unittests_autostart", false) then
coroutine.wrap(unittests.run_all)()
end)
else
minetest.register_chatcommand("unittests", {
core.register_chatcommand("unittests", {
privs = {basic_privs=true},
description = "Runs devtest unittests (may modify player or map state)",
func = function(name, param)