diff options
Diffstat (limited to 'tests/lexparse.js')
-rw-r--r-- | tests/lexparse.js | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/tests/lexparse.js b/tests/lexparse.js index 36dbf97..2b0cc46 100644 --- a/tests/lexparse.js +++ b/tests/lexparse.js @@ -286,4 +286,91 @@ test('VARARG', function (t) { [1, 2, 3], "Program output is correct" ); +}); + + +test('LE, JMP', function (t) { + let luaCode = ` + local a, b = 1, 1 + + return a >= b + `, 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_toboolean(L, -1), + true, + "Program output is correct" + ); +}); + + +test('LT', function (t) { + let luaCode = ` + local a, b = 1, 1 + + return a > b + `, 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_toboolean(L, -1), + false, + "Program output is correct" + ); +}); + + +test('EQ', function (t) { + let luaCode = ` + local a, b = 1, 1 + + return a == b + `, 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_toboolean(L, -1), + true, + "Program output is correct" + ); });
\ No newline at end of file |