diff options
author | Benoit Giannangeli <giann008@gmail.com> | 2017-02-17 23:17:35 +0100 |
---|---|---|
committer | Benoit Giannangeli <giann008@gmail.com> | 2017-02-17 23:17:35 +0100 |
commit | de7046f938975dbdcd6cfaba6f535dec53dfc263 (patch) | |
tree | a68589e7ff126c8f62cf20773b6b531c5b833f59 /tests/lapi.js | |
parent | 06ec7904c37b897b2e87f4321198926ff22da1d9 (diff) | |
download | fengari-de7046f938975dbdcd6cfaba6f535dec53dfc263.tar.gz fengari-de7046f938975dbdcd6cfaba6f535dec53dfc263.tar.bz2 fengari-de7046f938975dbdcd6cfaba6f535dec53dfc263.zip |
Load std lib, can call print
Diffstat (limited to 'tests/lapi.js')
-rw-r--r-- | tests/lapi.js | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/lapi.js b/tests/lapi.js index 2f5f459..b7ba8ed 100644 --- a/tests/lapi.js +++ b/tests/lapi.js @@ -13,6 +13,7 @@ const ldo = require("../src/ldo.js"); const lapi = require("../src/lapi.js"); const lauxlib = require("../src/lauxlib.js"); const lua = require('../src/lua.js'); +const linit = require('../src/linit.js'); const CT = lua.constant_types; test('luaL_newstate, lua_pushnil, lua_gettop, luaL_typename', function (t) { @@ -566,13 +567,22 @@ test('lua_settable, lua_gettable', function (t) { test('print', function (t) { let luaCode = ` - print("hello world"); + print("hello world") `, L; t.plan(1); t.doesNotThrow(function () { - L = getState(luaCode); - lapi.lua_call(L, 0, -1); - }, "Program executed without errors"); + + let bc = toByteCode(luaCode).dataView; + + L = lauxlib.luaL_newstate(); + + linit.luaL_openlibs(L); + + lapi.lua_load(L, bc, "test-lua_load") + + lapi.lua_call(L, 0, 1); + + }, "JS Lua program ran without error"); });
\ No newline at end of file |