diff options
author | daurnimator <quae@daurnimator.com> | 2018-01-11 23:33:34 +1100 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2018-01-11 23:35:56 +1100 |
commit | a39f24f204a15cb4587e75b38424952fe444d9d2 (patch) | |
tree | 5047cd8b5b73bda87142405273c0dcc3203e71f4 /tests/lapi.js | |
parent | b0b0b21f4394fabf41d6e3556f455a0a740f3f08 (diff) | |
download | fengari-a39f24f204a15cb4587e75b38424952fe444d9d2.tar.gz fengari-a39f24f204a15cb4587e75b38424952fe444d9d2.tar.bz2 fengari-a39f24f204a15cb4587e75b38424952fe444d9d2.zip |
Move fengari specific things to src/fengaricore.js
String manipulation functions now get exposed on 'fengari' object itself at top level
Diffstat (limited to 'tests/lapi.js')
-rw-r--r-- | tests/lapi.js | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/tests/lapi.js b/tests/lapi.js index a63ae66..56859d8 100644 --- a/tests/lapi.js +++ b/tests/lapi.js @@ -5,8 +5,9 @@ const test = require('tape'); const tests = require("./tests.js"); const toByteCode = tests.toByteCode; -const lauxlib = require("../src/lauxlib.js"); const lua = require('../src/lua.js'); +const lauxlib = require("../src/lauxlib.js"); +const {to_luastring} = require("../src/fengaricore.js"); test('luaL_newstate, lua_pushnil, luaL_typename', function (t) { let L; @@ -369,7 +370,7 @@ test('lua_load with no chunkname', function (t) { t.doesNotThrow(function () { L = lauxlib.luaL_newstate(); - lua.lua_load(L, function(L, s) { let r = s.code; s.code = null; return r; }, {code: lua.to_luastring("return 'hello'")}, null, null); + lua.lua_load(L, function(L, s) { let r = s.code; s.code = null; return r; }, {code: to_luastring("return 'hello'")}, null, null); lua.lua_call(L, 0, 1); }, "JS Lua program ran without error"); @@ -395,7 +396,7 @@ test('lua_load and lua_call it', function (t) { L = lauxlib.luaL_newstate(); - lua.lua_load(L, function(L, s) { let r = s.bc; s.bc = null; return r; }, {bc: bc}, lua.to_luastring("test-lua_load"), lua.to_luastring("binary")); + lua.lua_load(L, function(L, s) { let r = s.bc; s.bc = null; return r; }, {bc: bc}, to_luastring("test-lua_load"), to_luastring("binary")); lua.lua_call(L, 0, 1); @@ -420,10 +421,10 @@ test('lua script reads js upvalues', function (t) { L = lauxlib.luaL_newstate(); - lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)); + lauxlib.luaL_loadstring(L, to_luastring(luaCode)); lua.lua_pushliteral(L, "hello"); - lua.lua_setglobal(L, lua.to_luastring("js")); + lua.lua_setglobal(L, to_luastring("js")); lua.lua_call(L, 0, 1); @@ -518,7 +519,7 @@ test('lua_atnativeerror', function(t) { lua.lua_atnativeerror(L, function(L) { let e = lua.lua_touserdata(L, 1); t.strictEqual(e, errob); - lua.lua_pushstring(L, lua.to_luastring("runtime error!")); + lua.lua_pushstring(L, to_luastring("runtime error!")); return 1; }); lua.lua_pushcfunction(L, function(L) { @@ -532,7 +533,7 @@ test('lua_atnativeerror', function(t) { lua.lua_atnativeerror(L, function(L) { let e = lua.lua_touserdata(L, 1); t.strictEqual(e, errob); - lauxlib.luaL_error(L, lua.to_luastring("runtime error!")); + lauxlib.luaL_error(L, to_luastring("runtime error!")); }); lua.lua_pushcfunction(L, function(L) { throw errob; |