1
0
mirror of https://github.com/gabime/spdlog.git synced 2025-04-29 20:13:52 +00:00

Fix test compile

This commit is contained in:
gabime 2024-11-30 15:55:23 +02:00
parent 032d93acf7
commit a0f371efed

View File

@ -196,13 +196,16 @@ struct auto_closer {
TEST_CASE("os::fwrite_bytes", "[os]") { TEST_CASE("os::fwrite_bytes", "[os]") {
using spdlog::details::os::fwrite_bytes; using spdlog::details::os::fwrite_bytes;
const char* filename = "test_fwrite_bytes.txt"; using spdlog::details::os::create_dir;
const char* filename = "log_tests/test_fwrite_bytes.txt";
const char *msg = "hello"; const char *msg = "hello";
prepare_logdir();
REQUIRE(create_dir("log_tests"));
{ {
auto_closer closer(std::fopen(filename, "wb")); auto_closer closer(std::fopen(filename, "wb"));
REQUIRE(closer.fp != nullptr); REQUIRE(closer.fp != nullptr);
std::ofstream ofstream(filename, std::ios::binary);
REQUIRE(fwrite_bytes(msg, std::strlen(msg), closer.fp) == true); REQUIRE(fwrite_bytes(msg, std::strlen(msg), closer.fp) == true);
REQUIRE(fwrite_bytes(msg, 0, closer.fp) == true); REQUIRE(fwrite_bytes(msg, 0, closer.fp) == true);
std::fflush(closer.fp); std::fflush(closer.fp);