From 1f585359207eddefd7db8a0bf240f2ef61ac548b Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Mon, 6 Dec 2021 13:37:32 +0200 Subject: [PATCH] Fixed test_macros tests --- tests/test_macros.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/tests/test_macros.cpp b/tests/test_macros.cpp index b4ad5654..c9af60f3 100644 --- a/tests/test_macros.cpp +++ b/tests/test_macros.cpp @@ -27,7 +27,8 @@ TEST_CASE("debug and trace w/o format string", "[macros]]") using spdlog::details::os::default_eol; REQUIRE(ends_with(file_contents(TEST_FILENAME), spdlog::fmt_lib::format("Test message 2{}", default_eol))); REQUIRE(count_lines(TEST_FILENAME) == 1); - + + auto orig_default_logger = spdlog::default_logger(); spdlog::set_default_logger(logger); SPDLOG_TRACE("Test message 3"); @@ -36,6 +37,7 @@ TEST_CASE("debug and trace w/o format string", "[macros]]") require_message_count(TEST_FILENAME, 2); REQUIRE(ends_with(file_contents(TEST_FILENAME), spdlog::fmt_lib::format("Test message 4{}", default_eol))); + spdlog::set_default_logger(std::move(orig_default_logger)); } TEST_CASE("disable param evaluation", "[macros]") @@ -51,12 +53,3 @@ TEST_CASE("pass logger pointer", "[macros]") SPDLOG_LOGGER_DEBUG(&ref, "Test message 2"); } -// ensure that even if right macro level is on- don't evaluate if the logger's level is not high enough -// TEST_CASE("disable param evaluation2", "[macros]") -//{ -// auto logger = std::make_shared("test-macro"); -// logger->set_level(spdlog::level::off); -// int x = 0; -// SPDLOG_LOGGER_DEBUG(logger, "Test message {}", ++x); -// REQUIRE(x == 0); -//}