B3D test: Close stream as early as possible

This commit is contained in:
Lars Mueller 2022-02-20 01:39:52 +01:00
parent eef3ea9c57
commit e8722e3dac

@ -477,9 +477,9 @@ local tests = {
liquid_raycast = false
}
if tests.b3d then
local stream = io.open(mod.get_resource("player_api", "models", "character.b3d"), "r")
assert(stream)
local stream = assert(io.open(mod.get_resource("player_api", "models", "character.b3d"), "r"))
local b3d = b3d.read(stream)
stream:close()
--! dirty helper method to create truncate tables with 10+ number keys
local function _b3d_truncate(table)
local count = 1
@ -502,7 +502,6 @@ if tests.b3d then
return table
end
file.write(mod.get_resource"character.b3d.lua", "return " .. dump(_b3d_truncate(table.copy(b3d))))
stream:close()
end
local vector, minetest, ml_mt = _G.vector, _G.minetest, minetest
if tests.liquid_dir then