Reverted const qualifier to log_msg& args, fixed issue #849, and added counter tests

This commit is contained in:
gabime
2018-10-05 14:23:37 +03:00
parent 2fa538779f
commit 36112371c0
8 changed files with 28 additions and 10 deletions

View File

@@ -175,3 +175,19 @@ TEST_CASE("to_hex_no_delimiter", "[to_hex]")
auto output = oss.str();
REQUIRE(ends_with(output, "0000: 090A0B0CFFFF" + std::string(spdlog::details::os::default_eol)));
}
TEST_CASE("message_counter", "[message_counter]")
{
std::ostringstream oss;
auto oss_sink = std::make_shared<spdlog::sinks::ostream_sink_mt>(oss);
spdlog::logger oss_logger("oss", oss_sink);
oss_logger.set_pattern("%i %v");
oss_logger.info("Hello");
REQUIRE(oss.str() == "000001 Hello" + std::string(spdlog::details::os::default_eol));
oss.str("");
oss_logger.info("Hello again");
REQUIRE(oss.str() == "000002 Hello again" + std::string(spdlog::details::os::default_eol));
}