summaryrefslogtreecommitdiff
path: root/tests/lexparse.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-03-02 11:54:57 +0100
committerBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-03-02 11:54:57 +0100
commit57de149902761c4ed5d9c199fd0818aad781bde3 (patch)
tree61fcda8980b66be200e66b021d3b8416233c389f /tests/lexparse.js
parentaee0f65dea0456635e96b4496f6597188526e647 (diff)
downloadfengari-57de149902761c4ed5d9c199fd0818aad781bde3.tar.gz
fengari-57de149902761c4ed5d9c199fd0818aad781bde3.tar.bz2
fengari-57de149902761c4ed5d9c199fd0818aad781bde3.zip
[Parsing tests] SELF
Diffstat (limited to 'tests/lexparse.js')
-rw-r--r--tests/lexparse.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/lexparse.js b/tests/lexparse.js
index e819c3c..500ef76 100644
--- a/tests/lexparse.js
+++ b/tests/lexparse.js
@@ -644,4 +644,38 @@ test('SETTABUP, GETTABUP', function (t) {
"world",
"Program output is correct"
);
+});
+
+
+test('SELF', function (t) {
+ let luaCode = `
+ local t = {}
+
+ t.value = "hello"
+ t.get = function (self)
+ return self.value
+ end
+
+ return t:get()
+ `, 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