mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-28 09:09:35 +08:00
@@ -1,12 +1,12 @@
|
||||
#ifdef _WIN32 // to prevent fopen warning on windows
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#ifdef _WIN32 // to prevent fopen warning on windows
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
|
||||
#include "includes.h"
|
||||
#include "test_sink.h"
|
||||
|
||||
template <class T>
|
||||
std::string log_info(const T &what, spdlog::level::level_enum logger_level = spdlog::level::info) {
|
||||
std::string log_info(const T& what, spdlog::level::level_enum logger_level = spdlog::level::info) {
|
||||
std::ostringstream oss;
|
||||
auto oss_sink = std::make_shared<spdlog::sinks::ostream_sink_mt>(oss);
|
||||
|
||||
@@ -182,17 +182,19 @@ TEST_CASE("utf8 to utf16 conversion using windows api", "[windows utf]") {
|
||||
spdlog::details::os::utf8_to_wstrbuf("abc", buffer);
|
||||
REQUIRE(std::wstring(buffer.data(), buffer.size()) == std::wstring(L"abc"));
|
||||
|
||||
spdlog::details::os::utf8_to_wstrbuf("\xc3\x28", buffer); // Invalid UTF-8 sequence.
|
||||
spdlog::details::os::utf8_to_wstrbuf("\xc3\x28", buffer); // Invalid UTF-8 sequence.
|
||||
REQUIRE(std::wstring(buffer.data(), buffer.size()) == std::wstring(L"\xfffd("));
|
||||
|
||||
spdlog::details::os::utf8_to_wstrbuf("\xe3\x81\xad\xe3\x81\x93", buffer); // "Neko" in hiragana.
|
||||
spdlog::details::os::utf8_to_wstrbuf("\xe3\x81\xad\xe3\x81\x93",
|
||||
buffer); // "Neko" in hiragana.
|
||||
REQUIRE(std::wstring(buffer.data(), buffer.size()) == std::wstring(L"\x306d\x3053"));
|
||||
}
|
||||
#endif
|
||||
|
||||
struct auto_closer {
|
||||
FILE* fp = nullptr;
|
||||
explicit auto_closer(FILE* f) : fp(f) {}
|
||||
explicit auto_closer(FILE* f)
|
||||
: fp(f) {}
|
||||
auto_closer(const auto_closer&) = delete;
|
||||
auto_closer& operator=(const auto_closer&) = delete;
|
||||
~auto_closer() {
|
||||
@@ -201,10 +203,10 @@ struct auto_closer {
|
||||
};
|
||||
|
||||
TEST_CASE("os::fwrite_bytes", "[os]") {
|
||||
using spdlog::details::os::fwrite_bytes;
|
||||
using spdlog::details::os::create_dir;
|
||||
using spdlog::details::os::fwrite_bytes;
|
||||
const char* filename = "log_tests/test_fwrite_bytes.txt";
|
||||
const char *msg = "hello";
|
||||
const char* msg = "hello";
|
||||
prepare_logdir();
|
||||
REQUIRE(create_dir(SPDLOG_FILENAME_T("log_tests")) == true);
|
||||
{
|
||||
|
Reference in New Issue
Block a user