2023-06-23 14:18:11 +00:00
|
|
|
-- Run tests with `lua5.4 test/lua/run.lua`
|
2024-04-01 06:53:58 +00:00
|
|
|
-- Can only run under Linux
|
2023-06-23 14:18:11 +00:00
|
|
|
|
|
|
|
---@diagnostic disable: lowercase-global
|
|
|
|
|
|
|
|
package.path = package.path .. ";./test/lua/lib/?.lua"
|
|
|
|
|
|
|
|
lu = require('luaunit')
|
|
|
|
fk = require('fk')
|
2024-04-01 06:53:58 +00:00
|
|
|
function fk.GetDisabledPacks()
|
|
|
|
local pkgs = fk.QmlBackend_ls("packages")
|
|
|
|
table.removeOne(pkgs, "test")
|
|
|
|
return json.encode(pkgs)
|
|
|
|
end
|
|
|
|
fk.os = os
|
|
|
|
fk.io = io
|
2023-06-23 14:18:11 +00:00
|
|
|
|
2024-04-01 06:53:58 +00:00
|
|
|
-- load FreeKill core
|
2023-06-23 14:18:11 +00:00
|
|
|
dofile 'lua/freekill.lua'
|
2024-04-01 06:53:58 +00:00
|
|
|
fk.qlist = ipairs
|
|
|
|
dofile 'lua/client/i18n/init.lua'
|
2023-06-23 14:18:11 +00:00
|
|
|
|
2024-04-01 06:53:58 +00:00
|
|
|
-- load test cases
|
|
|
|
dofile 'test/lua/core/util.lua'
|
|
|
|
dofile 'test/lua/core/pattern.lua'
|
|
|
|
dofile 'test/lua/core/testmode.lua'
|
|
|
|
|
|
|
|
-- server tests
|
|
|
|
dofile 'lua/server/scheduler.lua'
|
|
|
|
Room = require 'server.room'
|
|
|
|
fk.Room = require 'test/lua/lib/room'
|
|
|
|
fk.ServerPlayer = require 'test/lua/lib/serverplayer'
|
|
|
|
|
|
|
|
dofile 'test/lua/server/scheduler.lua'
|
|
|
|
dofile 'test/lua/server/logic.lua'
|
|
|
|
|
|
|
|
fk.os.exit( lu.LuaUnit.run() )
|