From 8397b9837c6a4efdc7c0f48832808239acf62c4b Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Thu, 19 Dec 2024 00:16:00 +0100 Subject: [PATCH] tests: Fix failing test case This was previously segfaulting. See the comment/note that was added as part of this commit. Thanks to @zyp for helping to track this down. --- test/test_suites/components/controller.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/test_suites/components/controller.cpp b/test/test_suites/components/controller.cpp index 41a911f..e5a100d 100644 --- a/test/test_suites/components/controller.cpp +++ b/test/test_suites/components/controller.cpp @@ -53,10 +53,13 @@ TEST_SUITE("controller - roundtrips") } } + // Note: These would technically belong into the TEST_CASE() below. However, for a currently unknown reason, these strings don't survive + // until the callbacks are invoked. This should certainly be investigated. + constexpr auto cli_agent_str = "test-cli"; + constexpr auto serve_agent_str = "test-serve"; + TEST_CASE("Server and client set agent strings based on user_agent") { - constexpr auto cli_agent_str = "test-cli"; - constexpr auto serve_agent_str = "test-serve"; constexpr auto addr = "127.0.0.1"; constexpr uint16_t port = 55123;