aboutsummaryrefslogtreecommitdiff
path: root/tests/ldebug.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2018-04-02 22:44:25 +1000
committerdaurnimator <quae@daurnimator.com>2018-04-14 16:52:26 +1000
commitce9fd9bdca0caa6a33ce37a01f41593ca42ba95b (patch)
tree946b66efd1f265c9ccb143b61d6c480929267673 /tests/ldebug.js
parentd67a6ab6688d315f521b3a2ebc0e018969213b21 (diff)
downloadfengari-ce9fd9bdca0caa6a33ce37a01f41593ca42ba95b.tar.gz
fengari-ce9fd9bdca0caa6a33ce37a01f41593ca42ba95b.tar.bz2
fengari-ce9fd9bdca0caa6a33ce37a01f41593ca42ba95b.zip
Start moving test suite from tape => jest
Diffstat (limited to 'tests/ldebug.js')
-rw-r--r--tests/ldebug.js194
1 files changed, 0 insertions, 194 deletions
diff --git a/tests/ldebug.js b/tests/ldebug.js
deleted file mode 100644
index 49474e9..0000000
--- a/tests/ldebug.js
+++ /dev/null
@@ -1,194 +0,0 @@
-"use strict";
-
-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");
-
-test('luaG_typeerror', function (t) {
- let luaCode = `
- local a = true
- return #a
- `, L;
-
- t.plan(2);
-
- t.doesNotThrow(function () {
-
- L = lauxlib.luaL_newstate();
-
- lualib.luaL_openlibs(L);
-
- lauxlib.luaL_loadstring(L, to_luastring(luaCode));
-
- lua.lua_pcall(L, 0, -1, 0);
-
- }, "JS Lua program ran without error");
-
-
- t.ok(
- lua.lua_tojsstring(L, -1).endsWith("attempt to get length of a boolean value (local 'a')"),
- "Correct error was thrown"
- );
-});
-
-
-test('luaG_typeerror', function (t) {
- let luaCode = `
- local a = true
- return a.yo
- `, L;
-
- t.plan(2);
-
- t.doesNotThrow(function () {
-
- L = lauxlib.luaL_newstate();
-
- lualib.luaL_openlibs(L);
-
- lauxlib.luaL_loadstring(L, to_luastring(luaCode));
-
- lua.lua_pcall(L, 0, -1, 0);
-
- }, "JS Lua program ran without error");
-
- t.ok(
- lua.lua_tojsstring(L, -1).endsWith("attempt to index a boolean value (local 'a')"),
- "Correct error was thrown"
- );
-});
-
-
-test('luaG_typeerror', function (t) {
- let luaCode = `
- local a = true
- return a.yo
- `, L;
-
- t.plan(2);
-
- t.doesNotThrow(function () {
-
- L = lauxlib.luaL_newstate();
-
- lualib.luaL_openlibs(L);
-
- lauxlib.luaL_loadstring(L, to_luastring(luaCode));
-
- lua.lua_pcall(L, 0, -1, 0);
-
- }, "JS Lua program ran without error");
-
- t.ok(
- lua.lua_tojsstring(L, -1).endsWith("attempt to index a boolean value (local 'a')"),
- "Correct error was thrown"
- );
-});
-
-
-test('luaG_typeerror', function (t) {
- let luaCode = `
- local a = true
- a.yo = 1
- `, L;
-
- t.plan(2);
-
- t.doesNotThrow(function () {
-
- L = lauxlib.luaL_newstate();
-
- lualib.luaL_openlibs(L);
-
- lauxlib.luaL_loadstring(L, to_luastring(luaCode));
-
- lua.lua_pcall(L, 0, -1, 0);
-
- }, "JS Lua program ran without error");
-
- t.ok(
- lua.lua_tojsstring(L, -1).endsWith("attempt to index a boolean value (local 'a')"),
- "Correct error was thrown"
- );
-});
-
-
-test('luaG_concaterror', function (t) {
- let luaCode = `
- return {} .. 'hello'
- `, L;
-
- t.plan(2);
-
- t.doesNotThrow(function () {
-
- L = lauxlib.luaL_newstate();
-
- lualib.luaL_openlibs(L);
-
- lauxlib.luaL_loadstring(L, to_luastring(luaCode));
-
- lua.lua_pcall(L, 0, -1, 0);
-
- }, "JS Lua program ran without error");
-
- t.ok(
- lua.lua_tojsstring(L, -1).endsWith("attempt to concatenate a table value"),
- "Correct error was thrown"
- );
-});
-
-
-test('luaG_opinterror', function (t) {
- let luaCode = `
- return {} + 'hello'
- `, L;
-
- t.plan(2);
-
- t.doesNotThrow(function () {
-
- L = lauxlib.luaL_newstate();
-
- lualib.luaL_openlibs(L);
-
- lauxlib.luaL_loadstring(L, to_luastring(luaCode));
-
- lua.lua_pcall(L, 0, -1, 0);
-
- }, "JS Lua program ran without error");
-
- t.ok(
- lua.lua_tojsstring(L, -1).endsWith("attempt to perform arithmetic on a table value"),
- "Correct error was thrown"
- );
-});
-
-
-test('luaG_tointerror', function (t) {
- let luaCode = `
- return 123.5 & 12
- `, L;
-
- t.plan(2);
-
- t.doesNotThrow(function () {
-
- L = lauxlib.luaL_newstate();
-
- lualib.luaL_openlibs(L);
-
- lauxlib.luaL_loadstring(L, to_luastring(luaCode));
-
- lua.lua_pcall(L, 0, -1, 0);
-
- }, "JS Lua program ran without error");
-
- t.ok(
- lua.lua_tojsstring(L, -1).endsWith("number has no integer representation"),
- "Correct error was thrown"
- );
-});