summaryrefslogtreecommitdiff
path: root/tests/lapi.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-02-15 17:52:46 +0100
committerBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-02-15 17:57:10 +0100
commit43474e4c411709e3c1ab1b1d13283d2bc4789d1d (patch)
treede0e6767f9a5348ddcd58d1ac80c24688125d262 /tests/lapi.js
parentc428f1241ebd5194a37c37d9d5376b326b78ee37 (diff)
downloadfengari-43474e4c411709e3c1ab1b1d13283d2bc4789d1d.tar.gz
fengari-43474e4c411709e3c1ab1b1d13283d2bc4789d1d.tar.bz2
fengari-43474e4c411709e3c1ab1b1d13283d2bc4789d1d.zip
lapi tests
Diffstat (limited to 'tests/lapi.js')
-rw-r--r--tests/lapi.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/lapi.js b/tests/lapi.js
new file mode 100644
index 0000000..2f493c9
--- /dev/null
+++ b/tests/lapi.js
@@ -0,0 +1,32 @@
+/*jshint esversion: 6 */
+"use strict";
+
+const test = require('tape');
+const beautify = require('js-beautify').js_beautify;
+
+const getState = require("./tests.js").getState;
+
+const VM = require("../src/lvm.js");
+const ldo = require("../src/ldo.js");
+const lapi = require("../src/lapi.js");
+const CT = require('../src/lua.js').constant_types;
+
+test('lua_pushnil', function (t) {
+ let L;
+
+ t.plan(3);
+
+ t.doesNotThrow(function () {
+ L = getState(`return "dummy"`);
+ }, "New Lua State initiliazed");
+
+ // t.doesNotThrow(function () {
+ lapi.lua_pushnil(L);
+ // }, "Pushed nil on the stack");
+
+ t.strictEqual(
+ L.stack[L.top - 1].type,
+ CT.LUA_TNIL,
+ "nil is on the stack"
+ );
+}); \ No newline at end of file