TEST_F(LuaFunctionTest, ErrorFunctionNoReturnValues) { ScopedLuaStackTest stackTest(L); LuaFunction func = LuaFunction::createFromCode(L, "invalid()"); func.setErrorFunction(LuaFunction::createFromCFunction(L, &testErrorFunctionNoRetVals)); try { func(); FAIL(); } catch (const LuaException& err) { ASSERT_STREQ("Invalid lua value on stack!", err.what()); } }
TEST_F(LuaFunctionTest, SetErrorFunction) { { ScopedLuaStackTest stackTest(L); LuaFunction func = LuaFunction::createFromCode(L, "invalid()"); func.setErrorFunction(LuaFunction::createFromCFunction(L, &testErrorFunction)); try { func(); FAIL(); } catch (const LuaException& err) { ASSERT_STREQ("TestError", err.what()); } } }