From a39f24f204a15cb4587e75b38424952fe444d9d2 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Thu, 11 Jan 2018 23:33:34 +1100 Subject: Move fengari specific things to src/fengaricore.js String manipulation functions now get exposed on 'fengari' object itself at top level --- tests/test-suite/utf8.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'tests/test-suite/utf8.js') diff --git a/tests/test-suite/utf8.js b/tests/test-suite/utf8.js index 91941bf..173dffd 100644 --- a/tests/test-suite/utf8.js +++ b/tests/test-suite/utf8.js @@ -5,7 +5,7 @@ const test = require('tape'); const lua = require('../../src/lua.js'); const lauxlib = require('../../src/lauxlib.js'); const lualib = require('../../src/lualib.js'); - +const {to_luastring} = require("../../src/fengaricore.js"); const prefix = ` local function checkerror (msg, f, ...) @@ -107,7 +107,7 @@ test("[test-suite] utf8: offset", function (t) { t.doesNotThrow(function () { L = lauxlib.luaL_newstate(); lualib.luaL_openlibs(L); - if (lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)) === lua.LUA_ERRSYNTAX) + if (lauxlib.luaL_loadstring(L, to_luastring(luaCode)) === lua.LUA_ERRSYNTAX) throw new SyntaxError(lua.lua_tojsstring(L, -1)); }, "Lua program loaded without error"); @@ -136,7 +136,7 @@ test("[test-suite] utf8: error indication in utf8.len", function (t) { t.doesNotThrow(function () { L = lauxlib.luaL_newstate(); lualib.luaL_openlibs(L); - if (lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)) === lua.LUA_ERRSYNTAX) + if (lauxlib.luaL_loadstring(L, to_luastring(luaCode)) === lua.LUA_ERRSYNTAX) throw new SyntaxError(lua.lua_tojsstring(L, -1)); }, "Lua program loaded without error"); @@ -162,7 +162,7 @@ test("[test-suite] utf8: error in initial position for offset", function (t) { t.doesNotThrow(function () { L = lauxlib.luaL_newstate(); lualib.luaL_openlibs(L); - if (lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)) === lua.LUA_ERRSYNTAX) + if (lauxlib.luaL_loadstring(L, to_luastring(luaCode)) === lua.LUA_ERRSYNTAX) throw new SyntaxError(lua.lua_tojsstring(L, -1)); }, "Lua program loaded without error"); @@ -206,7 +206,7 @@ test("[test-suite] utf8: codepoints", function (t) { t.doesNotThrow(function () { L = lauxlib.luaL_newstate(); lualib.luaL_openlibs(L); - if (lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)) === lua.LUA_ERRSYNTAX) + if (lauxlib.luaL_loadstring(L, to_luastring(luaCode)) === lua.LUA_ERRSYNTAX) throw new SyntaxError(lua.lua_tojsstring(L, -1)); }, "Lua program loaded without error"); @@ -226,7 +226,7 @@ test("[test-suite] utf8: UTF-8 representation for 0x11ffff (value out of valid r t.doesNotThrow(function () { L = lauxlib.luaL_newstate(); lualib.luaL_openlibs(L); - if (lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)) === lua.LUA_ERRSYNTAX) + if (lauxlib.luaL_loadstring(L, to_luastring(luaCode)) === lua.LUA_ERRSYNTAX) throw new SyntaxError(lua.lua_tojsstring(L, -1)); }, "Lua program loaded without error"); @@ -249,7 +249,7 @@ test("[test-suite] utf8: overlong sequences", function (t) { t.doesNotThrow(function () { L = lauxlib.luaL_newstate(); lualib.luaL_openlibs(L); - if (lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)) === lua.LUA_ERRSYNTAX) + if (lauxlib.luaL_loadstring(L, to_luastring(luaCode)) === lua.LUA_ERRSYNTAX) throw new SyntaxError(lua.lua_tojsstring(L, -1)); }, "Lua program loaded without error"); @@ -272,7 +272,7 @@ test("[test-suite] utf8: invalid bytes", function (t) { t.doesNotThrow(function () { L = lauxlib.luaL_newstate(); lualib.luaL_openlibs(L); - if (lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)) === lua.LUA_ERRSYNTAX) + if (lauxlib.luaL_loadstring(L, to_luastring(luaCode)) === lua.LUA_ERRSYNTAX) throw new SyntaxError(lua.lua_tojsstring(L, -1)); }, "Lua program loaded without error"); @@ -292,7 +292,7 @@ test("[test-suite] utf8: empty strings", function (t) { t.doesNotThrow(function () { L = lauxlib.luaL_newstate(); lualib.luaL_openlibs(L); - if (lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)) === lua.LUA_ERRSYNTAX) + if (lauxlib.luaL_loadstring(L, to_luastring(luaCode)) === lua.LUA_ERRSYNTAX) throw new SyntaxError(lua.lua_tojsstring(L, -1)); }, "Lua program loaded without error"); @@ -339,7 +339,7 @@ test("[test-suite] utf8: minimum and maximum values for each sequence size", fun t.doesNotThrow(function () { L = lauxlib.luaL_newstate(); lualib.luaL_openlibs(L); - if (lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)) === lua.LUA_ERRSYNTAX) + if (lauxlib.luaL_loadstring(L, to_luastring(luaCode)) === lua.LUA_ERRSYNTAX) throw new SyntaxError(lua.lua_tojsstring(L, -1)); }, "Lua program loaded without error"); -- cgit v1.2.3-54-g00ecf