add integration-test

This commit is contained in:
BuckarooBanzay
2020-05-11 10:38:12 +02:00
committed by Buckaroo Banzai
parent 242dbde0e6
commit 6d6432940f
5 changed files with 83 additions and 0 deletions

40
test/test_mod/init.lua Normal file
View File

@ -0,0 +1,40 @@
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)

2
test/test_mod/mod.conf Normal file
View File

@ -0,0 +1,2 @@
name = scifi_nodes_test
depends = scifi_nodes