Cleaned tests

This commit is contained in:
gabime 2023-09-29 00:45:09 +03:00
parent b169859ce9
commit 8dc7ba7e3d
13 changed files with 16 additions and 9 deletions

View File

@ -49,4 +49,3 @@ using windebug_sink_st = msvc_sink_st;
} // namespace sinks
} // namespace spdlog

View File

@ -26,7 +26,7 @@ endif()
set(SPDLOG_UTESTS_SOURCES
test_file_helper.cpp
test_file_logging.cpp
test_daily_logger.cpp
test_daily_and_rotation_loggers.cpp
test_misc.cpp
test_pattern_formatter.cpp
test_async.cpp

View File

@ -28,11 +28,6 @@
#include "spdlog/async.h"
#include "spdlog/details/fmt_helper.h"
#include "spdlog/pattern_formatter.h"
#include "spdlog/sinks/basic_file_sink.h"
#include "spdlog/sinks/daily_file_sink.h"
#include "spdlog/sinks/msvc_sink.h"
#include "spdlog/sinks/null_sink.h"
#include "spdlog/sinks/ostream_sink.h"
#include "spdlog/sinks/rotating_file_sink.h"
#include "spdlog/sinks/stdout_color_sinks.h"
#include "spdlog/spdlog.h"

View File

@ -1,5 +1,6 @@
#include "includes.h"
#include "spdlog/fmt/bin_to_hex.h"
#include "spdlog/sinks/ostream_sink.h"
#include "test_sink.h"
TEST_CASE("to_hex", "[to_hex]") {

View File

@ -3,6 +3,8 @@
* https://raw.githubusercontent.com/gabime/spdlog/master/LICENSE
*/
#include "includes.h"
#include "spdlog/sinks/daily_file_sink.h"
#include "spdlog/sinks/rotating_file_sink.h"
#ifdef SPDLOG_USE_STD_FORMAT
using filename_memory_buf_t = std::basic_string<spdlog::filename_t::value_type>;
@ -73,7 +75,6 @@ TEST_CASE("daily_logger with custom calculator", "[daily_logger]") {
}
logger->flush();
require_message_count(filename_buf_to_utf8string(w), 10);
}

View File

@ -5,6 +5,7 @@
#include <iostream>
#include "includes.h"
#include "spdlog/sinks/basic_file_sink.h"
#define SIMPLE_LOG "test_logs/simple_log.txt"
#define SIMPLE_ASYNC_LOG "test_logs/simple_async_log.txt"

View File

@ -3,6 +3,7 @@
* https://raw.githubusercontent.com/gabime/spdlog/master/LICENSE
*/
#include "includes.h"
#include "spdlog/sinks/rotating_file_sink.h"
#define TEST_FILENAME "test_logs/file_helper_test.txt"

View File

@ -3,6 +3,8 @@
* https://raw.githubusercontent.com/gabime/spdlog/master/LICENSE
*/
#include "includes.h"
#include "spdlog/sinks/basic_file_sink.h"
#include "spdlog/sinks/rotating_file_sink.h"
#define SIMPLE_LOG "test_logs/simple_log"
#define ROTATING_LOG "test_logs/rotating_log"

View File

@ -4,6 +4,7 @@
*/
#include "includes.h"
#include "spdlog/sinks/basic_file_sink.h"
#if SPDLOG_ACTIVE_LEVEL != SPDLOG_LEVEL_DEBUG
#error "Invalid SPDLOG_ACTIVE_LEVEL in test. Should be SPDLOG_LEVEL_DEBUG"

View File

@ -1,4 +1,5 @@
#include "includes.h"
#include "spdlog/sinks/ostream_sink.h"
#include "test_sink.h"
template <class T>

View File

@ -1,4 +1,5 @@
#include "includes.h"
#include "spdlog/sinks/ostream_sink.h"
#include "test_sink.h"
using spdlog::memory_buf_t;

View File

@ -1,4 +1,6 @@
#include "includes.h"
#include "spdlog/sinks/daily_file_sink.h"
#include "spdlog/sinks/rotating_file_sink.h"
static const char *const tested_logger_name = "null_logger";
static const char *const tested_logger_name2 = "null_logger2";

View File

@ -1,5 +1,6 @@
#define SPDLOG_SOURCE_LOCATION
#include "includes.h"
#include "spdlog/sinks/ostream_sink.h"
#include "test_sink.h"
#if defined(SPDLOG_HAVE_STD_SOURCE_LOCATION) || defined(SPDLOG_HAVE_EXPERIMENTAL_SOURCE_LOCATION)
@ -11,9 +12,10 @@ TEST_CASE("test_source_location", "[source_location]") {
auto oss_sink = std::make_shared<spdlog::sinks::ostream_sink_st>(oss);
spdlog::logger oss_logger("oss", oss_sink);
oss_logger.set_pattern("%s:%# %v");
oss_logger.info("Hello {}", "source location");
REQUIRE(oss.str() ==
std::string("test_source_location.cpp:14 Hello source location") + default_eol);
std::string("test_source_location.cpp:16 Hello source location") + default_eol);
}
#endif