Workaround a bug in MSVC's strftime (#965)

This commit is contained in:
Victor Zverovich
2018-12-07 07:07:21 -08:00
parent 628f830583
commit acfa95d4a8
2 changed files with 10 additions and 2 deletions

View File

@@ -31,6 +31,14 @@ TEST(TimeTest, GrowBuffer) {
fmt::format(s, *std::localtime(&t));
}
TEST(TimeTest, FormatToEmptyContainer) {
std::string s;
auto time = std::tm();
time.tm_sec = 42;
fmt::format_to(std::back_inserter(s), "{:%S}", time);
EXPECT_EQ(s, "42");
}
TEST(TimeTest, EmptyResult) {
EXPECT_EQ("", fmt::format("{}", std::tm()));
}