aboutsummaryrefslogtreecommitdiff
path: root/tests/lbaselib.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-15 17:20:06 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-15 17:20:06 +1000
commitf7e5203a20ef41cf9bc59d339b4f85007a7f3764 (patch)
tree3c6f0907231588f528902eec3b2b1d09d19a53e1 /tests/lbaselib.js
parent3947c2cb2fa6193645ac30898064e3d335a63545 (diff)
downloadfengari-f7e5203a20ef41cf9bc59d339b4f85007a7f3764.tar.gz
fengari-f7e5203a20ef41cf9bc59d339b4f85007a7f3764.tar.bz2
fengari-f7e5203a20ef41cf9bc59d339b4f85007a7f3764.zip
Separate ZIO and MBuffer data structures
- lua_load no longer takes a null reader function
Diffstat (limited to 'tests/lbaselib.js')
-rw-r--r--tests/lbaselib.js71
1 files changed, 17 insertions, 54 deletions
diff --git a/tests/lbaselib.js b/tests/lbaselib.js
index bfaac9c..2594cd9 100644
--- a/tests/lbaselib.js
+++ b/tests/lbaselib.js
@@ -2,9 +2,6 @@
const test = require('tape');
-const tests = require("./tests.js");
-const toByteCode = tests.toByteCode;
-
const lua = require('../src/lua.js');
const lauxlib = require('../src/lauxlib.js');
const lualib = require('../src/lualib.js');
@@ -19,13 +16,11 @@ test('print', function (t) {
t.doesNotThrow(function () {
- let bc = toByteCode(luaCode);
-
L = lauxlib.luaL_newstate();
lualib.luaL_openlibs(L);
- lua.lua_load(L, null, bc, lua.to_luastring("test-print"), lua.to_luastring("binary"));
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
lua.lua_call(L, 0, -1);
@@ -53,13 +48,11 @@ test('setmetatable, getmetatable', function (t) {
t.doesNotThrow(function () {
- let bc = toByteCode(luaCode);
-
L = lauxlib.luaL_newstate();
lualib.luaL_openlibs(L);
- lua.lua_load(L, null, bc, lua.to_luastring("test-setmetatable-getmetatable"), lua.to_luastring("binary"));
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
lua.lua_call(L, 0, -1);
@@ -98,13 +91,11 @@ test('rawequal', function (t) {
t.doesNotThrow(function () {
- let bc = toByteCode(luaCode);
-
L = lauxlib.luaL_newstate();
lualib.luaL_openlibs(L);
- lua.lua_load(L, null, bc, lua.to_luastring("test-rawequal"), lua.to_luastring("binary"));
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
lua.lua_call(L, 0, -1);
@@ -144,13 +135,11 @@ test('rawset, rawget', function (t) {
t.doesNotThrow(function () {
- let bc = toByteCode(luaCode);
-
L = lauxlib.luaL_newstate();
lualib.luaL_openlibs(L);
- lua.lua_load(L, null, bc, lua.to_luastring("test-rawequal"), lua.to_luastring("binary"));
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
lua.lua_call(L, 0, -1);
@@ -191,13 +180,11 @@ test('type', function (t) {
t.doesNotThrow(function () {
- let bc = toByteCode(luaCode);
-
L = lauxlib.luaL_newstate();
lualib.luaL_openlibs(L);
- lua.lua_load(L, null, bc, lua.to_luastring("test-type"), lua.to_luastring("binary"));
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
lua.lua_call(L, 0, -1);
@@ -244,13 +231,11 @@ test('error', function (t) {
t.throws(function () {
- let bc = toByteCode(luaCode);
-
L = lauxlib.luaL_newstate();
lualib.luaL_openlibs(L);
- lua.lua_load(L, null, bc, lua.to_luastring("test-error"), lua.to_luastring("binary"));
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
lua.lua_call(L, 0, -1);
@@ -267,13 +252,11 @@ test('error, protected', function (t) {
t.doesNotThrow(function () {
- let bc = toByteCode(luaCode);
-
L = lauxlib.luaL_newstate();
lualib.luaL_openlibs(L);
- lua.lua_load(L, null, bc, lua.to_luastring("test-error"), lua.to_luastring("binary"));
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
lua.lua_pcall(L, 0, -1, 0);
@@ -299,13 +282,11 @@ test('pcall', function (t) {
t.doesNotThrow(function () {
- let bc = toByteCode(luaCode);
-
L = lauxlib.luaL_newstate();
lualib.luaL_openlibs(L);
- lua.lua_load(L, null, bc, lua.to_luastring("test-pcall"), lua.to_luastring("binary"));
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
lua.lua_call(L, 0, -1);
@@ -335,13 +316,11 @@ test('xpcall', function (t) {
t.doesNotThrow(function () {
- let bc = toByteCode(luaCode);
-
L = lauxlib.luaL_newstate();
lualib.luaL_openlibs(L);
- lua.lua_load(L, null, bc, lua.to_luastring("test-pcall"), lua.to_luastring("binary"));
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
lua.lua_call(L, 0, -1);
@@ -377,13 +356,11 @@ test('ipairs', function (t) {
t.doesNotThrow(function () {
- let bc = toByteCode(luaCode);
-
L = lauxlib.luaL_newstate();
lualib.luaL_openlibs(L);
- lua.lua_load(L, null, bc, lua.to_luastring("test-ipairs"), lua.to_luastring("binary"));
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
lua.lua_call(L, 0, -1);
@@ -406,13 +383,11 @@ test('select', function (t) {
t.doesNotThrow(function () {
- let bc = toByteCode(luaCode);
-
L = lauxlib.luaL_newstate();
lualib.luaL_openlibs(L);
- lua.lua_load(L, null, bc, lua.to_luastring("test-select"), lua.to_luastring("binary"));
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
lua.lua_call(L, 0, -1);
@@ -451,13 +426,11 @@ test('tonumber', function (t) {
t.doesNotThrow(function () {
- let bc = toByteCode(luaCode);
-
L = lauxlib.luaL_newstate();
lualib.luaL_openlibs(L);
- lua.lua_load(L, null, bc, lua.to_luastring("test-tonumber"), lua.to_luastring("binary"));
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
lua.lua_call(L, 0, -1);
@@ -503,13 +476,11 @@ test('assert', function (t) {
t.doesNotThrow(function () {
- let bc = toByteCode(luaCode);
-
L = lauxlib.luaL_newstate();
lualib.luaL_openlibs(L);
- lua.lua_load(L, null, bc, lua.to_luastring("test-assert"), lua.to_luastring("binary"));
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
lua.lua_pcall(L, 0, -1, 0);
@@ -531,13 +502,11 @@ test('rawlen', function (t) {
t.doesNotThrow(function () {
- let bc = toByteCode(luaCode);
-
L = lauxlib.luaL_newstate();
lualib.luaL_openlibs(L);
- lua.lua_load(L, null, bc, lua.to_luastring("test-rawlen"), lua.to_luastring("binary"));
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
lua.lua_call(L, 0, -1);
@@ -578,13 +547,11 @@ test('next', function (t) {
t.doesNotThrow(function () {
- let bc = toByteCode(luaCode);
-
L = lauxlib.luaL_newstate();
lualib.luaL_openlibs(L);
- lua.lua_load(L, null, bc, lua.to_luastring("test-next"), lua.to_luastring("binary"));
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
lua.lua_call(L, 0, -1);
@@ -619,13 +586,11 @@ test('pairs', function (t) {
t.doesNotThrow(function () {
- let bc = toByteCode(luaCode);
-
L = lauxlib.luaL_newstate();
lualib.luaL_openlibs(L);
- lua.lua_load(L, null, bc, lua.to_luastring("test-pairs"), lua.to_luastring("binary"));
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
lua.lua_call(L, 0, -1);
@@ -669,13 +634,11 @@ test('pairs with __pairs', function (t) {
t.doesNotThrow(function () {
- let bc = toByteCode(luaCode);
-
L = lauxlib.luaL_newstate();
lualib.luaL_openlibs(L);
- lua.lua_load(L, null, bc, lua.to_luastring("test-pairs"), lua.to_luastring("binary"));
+ lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
lua.lua_call(L, 0, -1);