Make tests support empty SPDLOG_EOL with new helper method require_message_count()

This commit is contained in:
Mario Emmenlauer
2020-02-04 22:23:36 +01:00
parent 58a5e654f9
commit 87acec6a91
7 changed files with 37 additions and 20 deletions

View File

@@ -22,7 +22,8 @@ TEST_CASE("debug and trace w/o format string", "[macros]]")
SPDLOG_LOGGER_DEBUG(logger, "Test message 2");
logger->flush();
REQUIRE(ends_with(file_contents(filename), "Test message 2\n"));
using spdlog::details::os::default_eol;
REQUIRE(ends_with(file_contents(filename), fmt::format("Test message 2{}", default_eol)));
REQUIRE(count_lines(filename) == 1);
spdlog::set_default_logger(logger);
@@ -31,8 +32,8 @@ TEST_CASE("debug and trace w/o format string", "[macros]]")
SPDLOG_DEBUG("Test message {}", 4);
logger->flush();
REQUIRE(ends_with(file_contents(filename), "Test message 4\n"));
REQUIRE(count_lines(filename) == 2);
require_message_count(filename, 2);
REQUIRE(ends_with(file_contents(filename), fmt::format("Test message 4{}", default_eol)));
}
TEST_CASE("disable param evaluation", "[macros]")