Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kunitoki committed Mar 4, 2024
1 parent eb67b2e commit c9c7f48
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Tests/Source/LuaRefTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
}
Expand Down

0 comments on commit c9c7f48

Please sign in to comment.