diff options
author | Benoit Giannangeli <benoit.giannangeli@boursorama.fr> | 2017-02-14 08:22:57 +0100 |
---|---|---|
committer | Benoit Giannangeli <benoit.giannangeli@boursorama.fr> | 2017-02-14 08:34:01 +0100 |
commit | 97cd23961c8a5b69c4845528a1a494f40127089f (patch) | |
tree | 9c56b4de22c37d296ffc213ccfc110a31d0e9deb /tests | |
parent | 59e549150996ec4c8a049f893dad9ec95a4677e9 (diff) | |
download | fengari-97cd23961c8a5b69c4845528a1a494f40127089f.tar.gz fengari-97cd23961c8a5b69c4845528a1a494f40127089f.tar.bz2 fengari-97cd23961c8a5b69c4845528a1a494f40127089f.zip |
settable, gettable (handle tm)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ltm.js | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/tests/ltm.js b/tests/ltm.js index 8a5ccb7..290ef9c 100644 --- a/tests/ltm.js +++ b/tests/ltm.js @@ -4,23 +4,18 @@ const test = require('tape'); const beautify = require('js-beautify').js_beautify; -const lua_State = require("../src/lstate.js").lua_State; const VM = require("../src/lvm.js"); -const Table = require("../src/lobject.js").Table;; -const getState = require("./tests.js"); +const getState = require("./tests.js").getState; -test('__add', function (t) { +test('__index', function (t) { let luaCode = ` - local t = {} - setmetatable(t, {__add = function () - return "hello" - end}) - return t + 1 + local t = {yo=1} + return t.yo, t.lo `, L; - t.plan(2); + t.plan(3); t.comment("Running following code: \n" + luaCode); @@ -31,7 +26,13 @@ test('__add', function (t) { t.strictEqual( L.stack[L.top - 1].value, - "hello", + null, + "Program output is correct" + ); + + t.strictEqual( + L.stack[L.top - 2].value, + 1, "Program output is correct" ); });
\ No newline at end of file |