Fixed windows test
This commit is contained in:
parent
dc7b8ee205
commit
7ada31d66a
@ -136,7 +136,7 @@ TEST_CASE("file_event_handlers", "[file_helper]") {
|
|||||||
events.clear();
|
events.clear();
|
||||||
helper.close();
|
helper.close();
|
||||||
REQUIRE(events == std::vector<flags>{flags::before_close, flags::after_close});
|
REQUIRE(events == std::vector<flags>{flags::before_close, flags::after_close});
|
||||||
REQUIRE(file_contents(TEST_FILENAME) == "after_open\nbefore_close\n");
|
REQUIRE(file_contents(SPDLOG_FILENAME_T(TEST_FILENAME)) == "after_open\nbefore_close\n");
|
||||||
|
|
||||||
helper.reopen(true);
|
helper.reopen(true);
|
||||||
events.clear();
|
events.clear();
|
||||||
|
@ -18,7 +18,7 @@ void prepare_logdir() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string file_contents(const std::string &filename) {
|
std::string file_contents(const std::filesystem::path &filename) {
|
||||||
std::ifstream ifs(filename, std::ios_base::binary);
|
std::ifstream ifs(filename, std::ios_base::binary);
|
||||||
if (!ifs) {
|
if (!ifs) {
|
||||||
throw std::runtime_error("Failed open file ");
|
throw std::runtime_error("Failed open file ");
|
||||||
@ -26,7 +26,7 @@ std::string file_contents(const std::string &filename) {
|
|||||||
return std::string((std::istreambuf_iterator<char>(ifs)), (std::istreambuf_iterator<char>()));
|
return std::string((std::istreambuf_iterator<char>(ifs)), (std::istreambuf_iterator<char>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t count_lines(const spdlog::filename_t &filename) {
|
std::size_t count_lines(const std::filesystem::path &filename) {
|
||||||
std::ifstream ifs(filename);
|
std::ifstream ifs(filename);
|
||||||
if (!ifs) {
|
if (!ifs) {
|
||||||
throw std::runtime_error("Failed open file ");
|
throw std::runtime_error("Failed open file ");
|
||||||
|
@ -8,7 +8,7 @@ std::size_t count_files(const std::string &folder);
|
|||||||
|
|
||||||
void prepare_logdir();
|
void prepare_logdir();
|
||||||
|
|
||||||
std::string file_contents(const std::string &filename);
|
std::string file_contents(const std::filesystem::path &filename);
|
||||||
|
|
||||||
// std::size_t count_lines(const std::string &filename);
|
// std::size_t count_lines(const std::string &filename);
|
||||||
std::size_t count_lines(const std::filesystem::path &filename);
|
std::size_t count_lines(const std::filesystem::path &filename);
|
||||||
|
Loading…
Reference in New Issue
Block a user