aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-03-02 08:18:58 +0100
committerBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-03-02 08:41:10 +0100
commit5a0db9d250115470589d23cd8ad4b28982cabe06 (patch)
tree826abfddef4491068e776bde83b0cc877627389c /tests
parent3e16f28d4eb8691296f4b93588186099474566f4 (diff)
downloadfengari-5a0db9d250115470589d23cd8ad4b28982cabe06.tar.gz
fengari-5a0db9d250115470589d23cd8ad4b28982cabe06.tar.bz2
fengari-5a0db9d250115470589d23cd8ad4b28982cabe06.zip
[Parsing tests] LE, JMP, LT, EQ
Diffstat (limited to 'tests')
-rw-r--r--tests/lexparse.js87
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