Merge branch 'main' into space-lua-fixtures

This commit is contained in:
Zef Hemel
2026-02-25 10:36:32 +01:00
committed by GitHub
23 changed files with 3712 additions and 107 deletions
+41
View File
@@ -57,6 +57,10 @@ Deno.test("[Lua] String tests", async () => {
await runLuaTest("./stdlib/string_test.lua");
});
Deno.test("[Lua] String pack/unpack/packsize tests", async () => {
await runLuaTest("./stdlib/string_pack_test.lua");
});
Deno.test("[Lua] Space Lua tests", async () => {
await runLuaTest("./stdlib/space_lua_test.lua");
});
@@ -89,7 +93,44 @@ Deno.test("[Lua] Lume functions tests", async () => {
await runLuaTest("./lume_test.lua");
});
Deno.test("[Lua] Lua Integrated Query tests", async () => {
await runLuaTest("./query_test.lua");
});
async function runLuaTest(luaPath: string) {
if (
typeof globalThis.client !== "undefined" &&
globalThis.client &&
typeof globalThis.client === "object"
) {
if (
!globalThis.client.config ||
typeof globalThis.client.config.get !== "function"
) {
try {
Object.defineProperty(globalThis.client, "config", {
value: {
get(_key: string, fallback: unknown) {
return fallback ?? {};
},
},
configurable: true,
writable: true,
});
} catch {
// ignore
}
}
} else {
(globalThis as any).client = {
config: {
get(_key: string, fallback: unknown) {
return fallback ?? {};
},
},
};
}
const luaFile = await Deno.readTextFile(
fileURLToPath(new URL(luaPath, import.meta.url)),
);