From c1824a99035a231172f3c10ae3ee24a3e6330260 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Wed, 22 Feb 2017 07:42:36 +0100 Subject: xpcall calls msgh --- tests/lbaselib.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/lbaselib.js b/tests/lbaselib.js index cca3ebe..85563da 100644 --- a/tests/lbaselib.js +++ b/tests/lbaselib.js @@ -338,7 +338,7 @@ test('xpcall', function (t) { return xpcall(willFail, msgh) `, L; - t.plan(1); + t.plan(3); t.doesNotThrow(function () { @@ -356,8 +356,13 @@ test('xpcall', function (t) { console.log(lapi.lua_tostring(L, -1)); - // t.ok( - // lapi.lua_tostring(L, -1).endsWith("you fucked up"), - // "Error is on the stack" - // ) + t.ok( + lapi.lua_tostring(L, -1).startsWith("Something's wrong:"), + "msgh was called and modified the error" + ) + + t.ok( + lapi.lua_tostring(L, -1).endsWith("you fucked up"), + "msgh was called and modified the error" + ) }); \ No newline at end of file -- cgit v1.2.3-70-g09d2