From 23d15010edc905a3b7c123e85ef6d1960d3da039 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Tue, 21 Feb 2017 08:46:48 +0100 Subject: luaG_ functions --- tests/ldebug.js | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 tests/ldebug.js (limited to 'tests') diff --git a/tests/ldebug.js b/tests/ldebug.js new file mode 100644 index 0000000..a6fa55f --- /dev/null +++ b/tests/ldebug.js @@ -0,0 +1,42 @@ +/*jshint esversion: 6 */ +"use strict"; + +const test = require('tape'); +const beautify = require('js-beautify').js_beautify; + +const tests = require("./tests.js"); +const getState = tests.getState; +const toByteCode = tests.toByteCode; + +const lvm = require("../src/lvm.js"); +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'); + +test('luaG_typeerror', function (t) { + let luaCode = ` + local a = true + return #a + `, L; + + t.plan(1); + + t.doesNotThrow(function () { + + let bc = toByteCode(luaCode).dataView; + + L = lauxlib.luaL_newstate(); + + linit.luaL_openlibs(L); + + lapi.lua_load(L, bc, "test-typeerror"); + + lapi.lua_pcall(L, 0, -1, 0); + + }, "JS Lua program ran without error"); + + + console.log(lapi.lua_tostring(L, -1)); +}); \ No newline at end of file -- cgit v1.2.3-70-g09d2