From aa1a44c84f11f97f6614b9c2fd252fddec4067eb Mon Sep 17 00:00:00 2001 From: daurnimator Date: Mon, 20 Nov 2017 16:12:08 +1100 Subject: src/lapi.js: chunkname can be null --- tests/lapi.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests/lapi.js') diff --git a/tests/lapi.js b/tests/lapi.js index 1dbdd5c..b764064 100644 --- a/tests/lapi.js +++ b/tests/lapi.js @@ -361,6 +361,26 @@ test('lua_pop', function (t) { }); +test('lua_load with no chunkname', function (t) { + let L; + + t.plan(2); + + t.doesNotThrow(function () { + L = lauxlib.luaL_newstate(); + + lua.lua_load(L, function(L, s) { let r = s.code; s.code = null; return r; }, {code: lua.to_luastring("return 'hello'")}, null, null); + + lua.lua_call(L, 0, 1); + }, "JS Lua program ran without error"); + + t.strictEqual( + lua.lua_tojsstring(L, -1), + "hello", + "Correct element(s) on the stack" + ); +}); + test('lua_load and lua_call it', function (t) { let luaCode = ` local a = "JS > Lua > JS \o/" -- cgit v1.2.3-54-g00ecf