import text modules from "pandorabox_custom"
commit
75382f3c50
|
@ -0,0 +1,17 @@
|
|||
name: luacheck
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: apt
|
||||
run: sudo apt-get install -y luarocks
|
||||
- name: luacheck install
|
||||
run: luarocks install --local luacheck
|
||||
- name: luacheck run
|
||||
run: $HOME/.luarocks/bin/luacheck ./
|
|
@ -0,0 +1,14 @@
|
|||
unused_args = false
|
||||
|
||||
globals = {
|
||||
}
|
||||
|
||||
read_globals = {
|
||||
-- Stdlib
|
||||
string = {fields = {"split"}},
|
||||
table = {fields = {"copy", "getn"}},
|
||||
|
||||
-- Minetest
|
||||
"vector", "ItemStack",
|
||||
"dump", "screwdriver"
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
minetest.register_on_mods_loaded(function()
|
||||
minetest.log("warning", "[pandorabox_integration_test] exporting all nodenames")
|
||||
local nodenames = {}
|
||||
for nodename in pairs(minetest.registered_nodes) do
|
||||
table.insert(nodenames, nodename)
|
||||
end
|
||||
local f = io.open(minetest.get_worldpath() .. "/nodenames.dat", "w")
|
||||
f:write(minetest.serialize(nodenames))
|
||||
f:close()
|
||||
end)
|
|
@ -0,0 +1,12 @@
|
|||
local MP = minetest.get_modpath("pandorabox_integration_test")
|
||||
|
||||
dofile(MP.."/export_nodenames.lua")
|
||||
|
||||
if minetest.settings:get_bool("enable_integration_test") then
|
||||
dofile(MP.."/integration_test.lua")
|
||||
end
|
||||
|
||||
if minetest.settings:get_bool("enable_recipe_test") then
|
||||
dofile(MP.."/recipe_test.lua")
|
||||
end
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
|
||||
minetest.log("warning", "[pandorabox_custom] integration-test enabled!")
|
||||
|
||||
local fname = minetest.get_modpath("pandorabox_integration_test") .. "/nodenames.dat"
|
||||
local f = io.open(fname, "r")
|
||||
local assert_nodes = minetest.deserialize(f:read())
|
||||
|
||||
local function test_mobs(callback)
|
||||
-- forceload chunk @ 0,0,0
|
||||
for x = 0, 16*5, 16 do
|
||||
for y = 0, 16*5, 16 do
|
||||
for z = 0, 16*5, 16 do
|
||||
minetest.forceload_block(vector.new(x, y, z))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
minetest.add_entity({x=10,y=10,z=10}, "mobs_monster:mese_monster")
|
||||
|
||||
minetest.after(5, callback)
|
||||
end
|
||||
|
||||
-- defered integration test function
|
||||
minetest.register_on_mods_loaded(function()
|
||||
minetest.log("warning", "[pandorabox_integration_test] all mods loaded, starting delayed test-function")
|
||||
|
||||
minetest.after(1, function()
|
||||
minetest.log("warning", "[pandorabox_integration_test] starting integration test")
|
||||
|
||||
-- export stats
|
||||
local file = io.open(minetest.get_worldpath().."/registered_nodes.txt", "w" );
|
||||
if file then
|
||||
for name in pairs(minetest.registered_nodes) do
|
||||
file:write(name .. '\n')
|
||||
end
|
||||
file:close()
|
||||
end
|
||||
|
||||
-- check nodes
|
||||
for _, nodename in ipairs(assert_nodes) do
|
||||
if not minetest.registered_nodes[nodename] and not minetest.registered_aliases[nodename] then
|
||||
error("Node not present and not aliased: " .. nodename)
|
||||
end
|
||||
end
|
||||
|
||||
test_mobs(function()
|
||||
-- write success flag
|
||||
local data = minetest.write_json({ success = true }, true);
|
||||
file = io.open(minetest.get_worldpath().."/integration_test.json", "w" );
|
||||
if file then
|
||||
file:write(data)
|
||||
file:close()
|
||||
end
|
||||
|
||||
minetest.log("warning", "[pandorabox_integration_test] integration tests done!")
|
||||
minetest.request_shutdown("success")
|
||||
end)
|
||||
end)
|
||||
end)
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,31 @@
|
|||
|
||||
minetest.register_on_mods_loaded(function()
|
||||
minetest.log("warning", "[pandorabox_custom] executing recipe-test")
|
||||
|
||||
local data = {}
|
||||
|
||||
for name in pairs(minetest.registered_nodes) do
|
||||
data[name] = minetest.get_all_craft_recipes(name)
|
||||
end
|
||||
|
||||
-- jsonStr -> output
|
||||
local map = {}
|
||||
for name, recipes in pairs(data) do
|
||||
for _, recipe in ipairs(recipes) do
|
||||
local data_string, err = minetest.write_json(recipe.items)
|
||||
if err then
|
||||
error(err)
|
||||
end
|
||||
|
||||
if map[data_string] and map[data_string] ~= name then
|
||||
minetest.log("warning", "recipe collision for " .. name .. "/" ..
|
||||
map[data_string] ..
|
||||
" recipe: " .. data_string)
|
||||
end
|
||||
|
||||
map[data_string] = name
|
||||
end
|
||||
end
|
||||
|
||||
minetest.log("warning", "[pandorabox_custom] recipe-test done!")
|
||||
end)
|
Loading…
Reference in New Issue