Add luacov, test_node.lua
parent
ec3c822597
commit
f736eaae99
|
@ -0,0 +1 @@
|
|||
config.local.lua
|
|
@ -1,7 +1,7 @@
|
|||
local Node = { __type = "Node" }
|
||||
|
||||
function Node.__call(self, pos)
|
||||
assert(pos.__type == "stressedPosition", "pos must be of type NodePosition")
|
||||
assert(pos.__type == "Position", "pos must be of type Position")
|
||||
self = {
|
||||
pos = pos
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ stressEvents = {
|
|||
local myPath = minetest.get_modpath(minetest.get_current_modname())
|
||||
|
||||
dofile(myPath .. "/config.lua")
|
||||
dofile(myPath .. "/config.local.lua")
|
||||
|
||||
if Stress.config.debug then
|
||||
print("Stress.config.debug is enabled. *Never* use this in production!")
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
return {
|
||||
["statsfile"] = "luacov.stats.out",
|
||||
["reportfile"] = "luacov.report.out",
|
||||
runreport = false,
|
||||
deletestats = false,
|
||||
["include"] = {
|
||||
"games%.minimal%.mods%.stress",
|
||||
},
|
||||
["exclude"] = {
|
||||
"games%.minimal%.mods%.stress%.tests",
|
||||
}
|
||||
}
|
|
@ -33,7 +33,11 @@ local stress_root = minetest.get_modpath(minetest.get_current_modname())
|
|||
local function test()
|
||||
package.path = package.path .. ";" .. stress_root .. "/tests/?.lua"
|
||||
|
||||
-- "hack" to make Minetest load some blocks into memory
|
||||
VoxelManip():read_from_map({x=-16, y=-16, z=-16}, {x=15, y=15, z=15})
|
||||
|
||||
lunatest.suite("test_position")
|
||||
lunatest.suite("test_node")
|
||||
lunatest.run()
|
||||
|
||||
minetest.request_shutdown()
|
||||
|
|
|
@ -8,5 +8,8 @@ wget http://minetest.ru/bin/minimal.tar.gz
|
|||
tar xf minimal.tar.gz
|
||||
cd minimal
|
||||
ln -s $STRESS_DIR $DIR/minimal/games/minimal/mods/stress
|
||||
echo "Stress.config.debug = true" >> $STRESS_DIR/config.lua
|
||||
echo "Stress.config.debug = true" > $STRESS_DIR/config.local.lua
|
||||
./bin/minetestserver --gameid minimal
|
||||
|
||||
lua luacov_s -c=$STRESS_DIR/tests/luacov.lua
|
||||
cat luacov.report.out
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
module(..., package.seeall)
|
||||
|
||||
function test_set()
|
||||
_({0, 0, 0}):name("default:mese")
|
||||
assert_equal("default:mese", minetest.env:get_node({x=0, y=0, z=0}).name)
|
||||
end
|
Loading…
Reference in New Issue