mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-14 01:32:07 +08:00
Fix test compile
This commit is contained in:
parent
e26e3692d1
commit
032d93acf7
@ -1,3 +1,7 @@
|
|||||||
|
#ifdef _WIN32 // to prevent fopen warning on windows
|
||||||
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
@ -186,7 +190,7 @@ struct auto_closer {
|
|||||||
auto_closer(const auto_closer&) = delete;
|
auto_closer(const auto_closer&) = delete;
|
||||||
auto_closer& operator=(const auto_closer&) = delete;
|
auto_closer& operator=(const auto_closer&) = delete;
|
||||||
~auto_closer() {
|
~auto_closer() {
|
||||||
fp != nullptr && (std::fclose(fp) != 0);
|
if (fp != nullptr) (void)std::fclose(fp);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -198,6 +202,7 @@ TEST_CASE("os::fwrite_bytes", "[os]") {
|
|||||||
{
|
{
|
||||||
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);
|
||||||
|
Loading…
Reference in New Issue
Block a user