From c9c7f486ddcca4a030d6c5dea1b9d0f1c46a9471 Mon Sep 17 00:00:00 2001 From: kunitoki Date: Mon, 4 Mar 2024 21:49:17 +0100 Subject: [PATCH] More tests --- Tests/Source/LuaRefTests.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Tests/Source/LuaRefTests.cpp b/Tests/Source/LuaRefTests.cpp index dc2cbd9..62d4cbf 100644 --- a/Tests/Source/LuaRefTests.cpp +++ b/Tests/Source/LuaRefTests.cpp @@ -516,6 +516,12 @@ TEST_F(LuaRefTests, CallableWithHandler) auto f = luabridge::getGlobal(L, "f"); EXPECT_TRUE(f.isCallable()); +#if LUABRIDGE_HAS_EXCEPTIONS + EXPECT_ANY_THROW(f.call("badly")); +#else + EXPECT_FALSE(f.call("badly")); +#endif + bool calledHandler = false; std::string errorMessage; auto handler = [&](lua_State*) -> int @@ -528,8 +534,8 @@ TEST_F(LuaRefTests, CallableWithHandler) return 0; }; - f.callWithHandler(handler, "badly"); - + auto result = f.callWithHandler(handler, "badly"); + EXPECT_FALSE(result); EXPECT_TRUE(calledHandler); EXPECT_TRUE(errorMessage.find("we failed badly") != std::string::npos); }