aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-03-02 09:33:31 +0100
committerBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-03-02 09:49:35 +0100
commit7ad7432bcf5e0666b719c768c3c0041fbb574feb (patch)
tree92d21ef0c1cbe08e988c0339a51f122c378e52b1 /tests
parent5a0db9d250115470589d23cd8ad4b28982cabe06 (diff)
downloadfengari-7ad7432bcf5e0666b719c768c3c0041fbb574feb.tar.gz
fengari-7ad7432bcf5e0666b719c768c3c0041fbb574feb.tar.bz2
fengari-7ad7432bcf5e0666b719c768c3c0041fbb574feb.zip
[Parsing tests] TESTSET
Diffstat (limited to 'tests')
-rw-r--r--tests/lexparse.js60
1 files changed, 60 insertions, 0 deletions
diff --git a/tests/lexparse.js b/tests/lexparse.js
index 2b0cc46..2470e5d 100644
--- a/tests/lexparse.js
+++ b/tests/lexparse.js
@@ -373,4 +373,64 @@ test('EQ', function (t) {
true,
"Program output is correct"
);
+});
+
+
+test('TESTSET (and)', function (t) {
+ let luaCode = `
+ local a = true
+ local b = "hello"
+
+ return a and 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_tostring(L, -1),
+ "hello",
+ "Program output is correct"
+ );
+});
+
+
+test('TESTSET (or)', function (t) {
+ let luaCode = `
+ local a = false
+ local b = "hello"
+
+ return a or 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_tostring(L, -1),
+ "hello",
+ "Program output is correct"
+ );
}); \ No newline at end of file