From 61f26d086054eb16cff15961c5923365a5610b4b Mon Sep 17 00:00:00 2001 From: kunitoki Date: Sun, 3 Mar 2024 10:43:20 +0100 Subject: [PATCH] Add test to validate luau fix of debugname --- Tests/Source/NamespaceTests.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Tests/Source/NamespaceTests.cpp b/Tests/Source/NamespaceTests.cpp index 313ad6a8..fbe2ca51 100644 --- a/Tests/Source/NamespaceTests.cpp +++ b/Tests/Source/NamespaceTests.cpp @@ -552,6 +552,27 @@ TEST_F(NamespaceTests, NamespaceAsRValueReferenceShouldWork) EXPECT_TRUE(result().isNil()); } +TEST_F(NamespaceTests, BugWithLuauNotPrintingMethodNameInErrors) +{ + auto strangelyNamedMethod = [](lua_State* L) + { + luaL_argerror(L, 1, "test message"); + return 0; + }; + + luabridge::getGlobalNamespace(L) + .beginNamespace("foo") + .addFunction("strangelyNamedMethod", strangelyNamedMethod) + .endNamespace(); + + auto [result, error] = runLuaCaptureError(R"( + local bar = function() foo.strangelyNamedMethod() end + bar() + )"); + + EXPECT_TRUE(error.find("strangelyNamedMethod") != std::string::npos); +} + #ifdef _M_IX86 // Windows 32bit only namespace {