Ported pull #3023 with some changes and tests

This commit is contained in:
gabime
2024-03-16 17:12:46 +02:00
parent 167bf989d8
commit 8e10782a58
5 changed files with 223 additions and 175 deletions

View File

@@ -1,4 +1,5 @@
#include "includes.h"
#include <string_view>
#include "spdlog/sinks/daily_file_sink.h"
#include "spdlog/sinks/rotating_file_sink.h"
@@ -106,3 +107,24 @@ TEST_CASE("disable automatic registration", "[registry]") {
spdlog::set_level(spdlog::level::info);
spdlog::set_automatic_registration(true);
}
TEST_CASE("get(const char* name)", "[registry]") {
spdlog::drop_all();
spdlog::create<spdlog::sinks::null_sink_mt>(tested_logger_name);
REQUIRE(spdlog::get(tested_logger_name) != nullptr);
spdlog::drop_all();
}
TEST_CASE("get(std::string_view name)", "[registry]") {
spdlog::drop_all();
spdlog::create<spdlog::sinks::null_sink_mt>(tested_logger_name);
REQUIRE(spdlog::get(std::string_view(tested_logger_name)) != nullptr);
spdlog::drop_all();
}
TEST_CASE("get(std::string name)", "[registry]") {
spdlog::drop_all();
spdlog::create<spdlog::sinks::null_sink_mt>(tested_logger_name);
REQUIRE(spdlog::get(std::string(tested_logger_name)) != nullptr);
spdlog::drop_all();
}