From 2a7f52924710cb73a4e586ef39cc9854ebf0c83b Mon Sep 17 00:00:00 2001 From: Xyraniz <109302452+Xyraniz@users.noreply.github.com> Date: Sat, 19 Sep 2026 21:48:41 -0600 Subject: [PATCH 1/3] fix(cli): preserve inline chunk names Fix -e chunk loading so the inline source length is passed separately from its diagnostic chunk name. The regression coverage verifies successful execution and syntax-error reporting. Co-authored-by: CoinBaseSupp <239860209+CoinBaseSupp@users.noreply.github.com> --- cli/luanode.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/luanode.js b/cli/luanode.js index 267c7be..6036e85 100755 --- a/cli/luanode.js +++ b/cli/luanode.js @@ -59,7 +59,7 @@ function runString(code, chunkName) { } lualib.luaL_openlibs(L); - const status = lauxlib.luaL_loadbuffer(L, to_luastring(code), to_luastring(chunkName)); + const status = lauxlib.luaL_loadbuffer(L, to_luastring(code), to_luastring(code).length, to_luastring(chunkName)); if (status !== lua.LUA_OK) { const msg = safeToJsString(lua.lua_tostring(L, -1)); process.stderr.write("luanode: " + msg + "\n"); From 455587e15c9657559f545a687ee137a44fe8eaf8 Mon Sep 17 00:00:00 2001 From: Xyraniz <109302452+Xyraniz@users.noreply.github.com> Date: Sat, 19 Sep 2026 21:51:22 -0600 Subject: [PATCH 2/3] test(cli): cover inline script execution and diagnostics Add regression coverage for -e execution and diagnostic chunk names. Co-authored-by: CoinBaseSupp <239860209+CoinBaseSupp@users.noreply.github.com> --- tests/cli.test.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/cli.test.js b/tests/cli.test.js index 686720d..e6f7c3a 100644 --- a/tests/cli.test.js +++ b/tests/cli.test.js @@ -49,4 +49,18 @@ describe("LuaNode-VM CLI", () => { fs.rmSync(dir, { recursive: true, force: true }); } }); + test("executes inline code and reports its chunk name", () => { + const cli = path.join(__dirname, "..", "cli", "luanode.js"); + + const success = spawnSync(process.execPath, [cli, "-e", "print('inline-ok')"], { encoding: "utf8" }); + expect(success.status).toBe(0); + expect(success.stderr).toBe(""); + expect(success.stdout.trim()).toBe("inline-ok"); + + const syntaxError = spawnSync(process.execPath, [cli, "-e", "this is not valid"], { encoding: "utf8" }); + expect(syntaxError.status).toBe(1); + expect(syntaxError.stdout).toBe(""); + expect(syntaxError.stderr).toContain("=(command line):1:"); + }); + }); From f7ca27c513c5a4838e6687c8c14deebb10fc8d69 Mon Sep 17 00:00:00 2001 From: Xyraniz <109302452+Xyraniz@users.noreply.github.com> Date: Sat, 19 Sep 2026 21:52:54 -0600 Subject: [PATCH 3/3] test(cli): match Lua diagnostic prefix Align the regression assertion with the CLI diagnostic format while preserving the chunk-name check. Co-authored-by: CoinBaseSupp <239860209+CoinBaseSupp@users.noreply.github.com> --- tests/cli.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cli.test.js b/tests/cli.test.js index e6f7c3a..8f73c8f 100644 --- a/tests/cli.test.js +++ b/tests/cli.test.js @@ -60,7 +60,7 @@ describe("LuaNode-VM CLI", () => { const syntaxError = spawnSync(process.execPath, [cli, "-e", "this is not valid"], { encoding: "utf8" }); expect(syntaxError.status).toBe(1); expect(syntaxError.stdout).toBe(""); - expect(syntaxError.stderr).toContain("=(command line):1:"); + expect(syntaxError.stderr).toContain("(command line):1:"); }); });