From 61168b0ab774e7be6deb1573fbcc9b1a53a37f4e Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Thu, 2 Mar 2017 09:53:38 +0100 Subject: [Parsing tests] TEST --- src/lparser.js | 2 +- tests/lexparse.js | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/lparser.js b/src/lparser.js index ff809b9..c21563f 100644 --- a/src/lparser.js +++ b/src/lparser.js @@ -449,7 +449,7 @@ const findgotos = function(ls, lb) { */ const movegotosout = function(fs, bl) { let i = bl.firstgoto; - let gl = fs.ls.dydy.gt; + let gl = fs.ls.dyd.gt; /* correct pending gotos to current block and try to close it with visible labels */ while (i < gl.n) { diff --git a/tests/lexparse.js b/tests/lexparse.js index 2470e5d..7ef5fe3 100644 --- a/tests/lexparse.js +++ b/tests/lexparse.js @@ -433,4 +433,38 @@ test('TESTSET (or)', function (t) { "hello", "Program output is correct" ); +}); + + +test('TEST (false)', function (t) { + let luaCode = ` + local a = false + local b = "hello" + + if a then + return b + end + + return "goodbye" + `, L; + + t.plan(2); + + t.doesNotThrow(function () { + + L = lauxlib.luaL_newstate(); + + linit.luaL_openlibs(L); + + lapi.lua_load(L, null, luaCode, "test", "text"); + + lapi.lua_call(L, 0, -1); + + }, "JS Lua program ran without error"); + + t.strictEqual( + lapi.lua_tostring(L, -1), + "goodbye", + "Program output is correct" + ); }); \ No newline at end of file -- cgit v1.2.3-70-g09d2