diff options
author | Benoit Giannangeli <benoit.giannangeli@boursorama.fr> | 2017-02-22 13:54:30 +0100 |
---|---|---|
committer | Benoit Giannangeli <benoit.giannangeli@boursorama.fr> | 2017-02-22 13:54:30 +0100 |
commit | b31cc0420e77d34465e4cf7d7ab75df7755b44d6 (patch) | |
tree | 6d908904fc1679549293bbe314550ec7dff82a2a /tests/lbaselib.js | |
parent | 290ec54e13d1dff301465cbfa2fd7b4e1e52962f (diff) | |
download | fengari-b31cc0420e77d34465e4cf7d7ab75df7755b44d6.tar.gz fengari-b31cc0420e77d34465e4cf7d7ab75df7755b44d6.tar.bz2 fengari-b31cc0420e77d34465e4cf7d7ab75df7755b44d6.zip |
assert
Diffstat (limited to 'tests/lbaselib.js')
-rw-r--r-- | tests/lbaselib.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/lbaselib.js b/tests/lbaselib.js index 6dc6bfb..a7b14d9 100644 --- a/tests/lbaselib.js +++ b/tests/lbaselib.js @@ -489,4 +489,33 @@ test('tonumber', function (t) { 2, "Correct element(s) on the stack" ); +}); + + +test('assert', function (t) { + let luaCode = ` + assert(1 < 0, "this doesn't makes sense") + `, L; + + t.plan(2); + + t.doesNotThrow(function () { + + let bc = toByteCode(luaCode).dataView; + + L = lauxlib.luaL_newstate(); + + linit.luaL_openlibs(L); + + lapi.lua_load(L, bc, "test-assert"); + + lapi.lua_pcall(L, 0, -1, 0); + + }, "JS Lua program ran without error"); + + t.ok( + lapi.lua_tostring(L, -1).endsWith("this doesn't makes sense"), + "Error is on the stack" + ); + });
\ No newline at end of file |