exclude tests from releases

This commit is contained in:
OgelGames 2024-05-20 13:25:39 +10:00
parent 971c40ea76
commit 91d6fdaed8
2 changed files with 8 additions and 3 deletions

3
.gitattributes vendored
View File

@ -2,4 +2,5 @@
* text=auto
# Exclusions for release export.
* export-ignore
.* export-ignore
tests.lua export-ignore

View File

@ -32,13 +32,17 @@ end
dofile(path.."/misc.lua")
if minetest.is_singleplayer() then
-- Tests are not included in releases, so check for them before registering the command.
local tests = loadfile(path.."/tests.lua")
if tests and minetest.is_singleplayer() then
minetest.register_chatcommand("fakelib_test", {
description = "Test fakelib's API.",
params = "[<run error tests>]",
func = function(_, param)
local start_time = minetest.get_us_time()
local success = loadfile(path.."/tests.lua")(param == "true")
local success = tests(param == "true")
local end_time = minetest.get_us_time()
if success then
return true, string.format("Testing completed in %i us", end_time - start_time)