From 7552c00e1c69069535f98b1bc5907d7157e5093c Mon Sep 17 00:00:00 2001 From: Samaresh Kumar Singh Date: Sun, 30 Nov 2025 15:16:23 -0600 Subject: [PATCH] tests: fix unit tests to not be affected by custom level names The unit tests were failing when users defined custom SPDLOG_LEVEL_NAMES or SPDLOG_SHORT_LEVEL_NAMES in tweakme.h. This happened because the tests expected the default level names but were getting the customized ones instead. For example, with custom short names defined, the test would fail like this: REQUIRE( spdlog::level::to_string_view(spdlog::level::trace) == "trace" ) with expansion: "TRC" == "trace" This fix undefines these macros in tests/includes.h (right after setting SPDLOG_ACTIVE_LEVEL) so that unit tests always use spdlog's default level names, regardless of any customizations in tweakme.h. Fixes #3466 --- tests/includes.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/includes.h b/tests/includes.h index 0bec4a0e..403410ff 100644 --- a/tests/includes.h +++ b/tests/includes.h @@ -23,6 +23,9 @@ #define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_DEBUG +#undef SPDLOG_LEVEL_NAMES +#undef SPDLOG_SHORT_LEVEL_NAMES + #include "spdlog/spdlog.h" #include "spdlog/async.h" #include "spdlog/details/fmt_helper.h"