summaryrefslogtreecommitdiff
path: root/tests/lvm.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-02-11 15:38:14 +0100
committerBenoit Giannangeli <giann008@gmail.com>2017-02-11 15:38:40 +0100
commit4650ac9ab96eadcd5918c56c6eb93618ac054bba (patch)
treee29a16e24c5a245889fff7bf74f701720a8c8227 /tests/lvm.js
parenta7b98a2e62c49a6c0ced2b57ddcea9bb6bab108e (diff)
downloadfengari-4650ac9ab96eadcd5918c56c6eb93618ac054bba.tar.gz
fengari-4650ac9ab96eadcd5918c56c6eb93618ac054bba.tar.bz2
fengari-4650ac9ab96eadcd5918c56c6eb93618ac054bba.zip
SELF
Diffstat (limited to 'tests/lvm.js')
-rw-r--r--tests/lvm.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/lvm.js b/tests/lvm.js
index 1af0c48..3d7325f 100644
--- a/tests/lvm.js
+++ b/tests/lvm.js
@@ -601,4 +601,33 @@ 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()
+ `, vm;
+
+ t.plan(1);
+
+ t.comment("Running following code: \n" + luaCode);
+
+ // t.doesNotThrow(function () {
+ vm = getVM(luaCode);
+ vm.execute();
+ // }, "Program executed without errors");
+
+ t.strictEqual(
+ vm.L.stack[vm.L.top - 1].value,
+ "hello",
+ "Program output is correct"
+ );
}); \ No newline at end of file