mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-18 15:24:26 +08:00
Fixed tests for older gcc compilers
This commit is contained in:
parent
80163dc6c1
commit
d650fa2456
@ -51,13 +51,14 @@ TEST_CASE("name", "[pattern_formatter]")
|
|||||||
REQUIRE(log_to_str("Some message", formatter) == "[pattern_tester] Some message\n");
|
REQUIRE(log_to_str("Some message", formatter) == "[pattern_tester] Some message\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST_CASE("date MM/DD/YY ", "[pattern_formatter]")
|
TEST_CASE("date MM/DD/YY ", "[pattern_formatter]")
|
||||||
{
|
{
|
||||||
using namespace::std::chrono;
|
using namespace::std::chrono;
|
||||||
auto formatter = std::make_shared<spdlog::pattern_formatter>("%D %v", spdlog::pattern_time_type::local, "\n");
|
auto formatter = std::make_shared<spdlog::pattern_formatter>("%D %v", spdlog::pattern_time_type::local, "\n");
|
||||||
auto now_tm = spdlog::details::os::localtime();
|
auto now_tm = spdlog::details::os::localtime();
|
||||||
std::stringstream oss;
|
std::stringstream oss;
|
||||||
oss << std::put_time(&now_tm, "%D") << " Some message\n";
|
oss << std::setfill('0') << std::setw(2) << now_tm.tm_mon + 1 << "/" << now_tm.tm_mday << "/" << (now_tm.tm_year + 1900) % 1000 << " Some message\n";
|
||||||
REQUIRE(log_to_str("Some message", formatter) == oss.str());
|
REQUIRE(log_to_str("Some message", formatter) == oss.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user