1
0
mirror of https://github.com/D00Med/scifi_nodes.git synced 2024-12-23 00:20:17 +01:00
scifi_nodes/test/test_mod/init.lua
2020-05-13 17:55:37 +02:00

41 lines
896 B
Lua

minetest.log("warning", "[TEST] integration-test enabled!")
-- those mods have to be present
local assert_mods = {
"scifi_nodes"
}
-- those nodes have to be present
local assert_nodes = {
"scifi_nodes:crate",
"scifi_nodes:door1a"
}
minetest.register_on_mods_loaded(function()
minetest.after(0, function()
-- check mods
for _, modname in ipairs(assert_mods) do
if not minetest.get_modpath(modname) then
error("Mod not present: " .. modname)
end
end
-- check nodes
for _, nodename in ipairs(assert_nodes) do
if not minetest.registered_nodes[nodename] then
error("Node not present: " .. nodename)
end
end
local data = minetest.write_json({ success = true }, true);
local file = io.open(minetest.get_worldpath().."/integration_test.json", "w" );
if file then
file:write(data)
file:close()
end
minetest.request_shutdown("success")
end)
end)