1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-30 19:22:14 +00:00
This commit is contained in:
Lars Müller 2025-09-24 07:25:47 +08:00 committed by GitHub
commit 1275ae2b6f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 165 additions and 20 deletions

View file

@ -342,3 +342,27 @@ local function test_ipc_poll(cb)
print("delta: " .. (core.get_us_time() - t0) .. "us")
end
unittests.register("test_ipc_poll", test_ipc_poll)
do
local t = require(".require")
assert(t.foo == "bar")
assert(t == require("unittests.require"))
package.unload(".require")
assert(t ~= require(".require"))
package.set(".require", "test")
assert(require(".require") == "test")
end
do
local status, err = xpcall(function()
table.insert(package.loaders, function()
return function()
return 42
end
end)
local answer = require("the_answer_to_life_the_universe_and_all_the_rest")
assert(answer == 42)
end, debug.traceback)
table.remove(package.loaders)
assert(status, err)
end