Fix handling of width when formatting int as char

This commit is contained in:
Victor Zverovich
2021-01-14 08:41:17 -08:00
parent 0fe0b15e71
commit f8c2f8480a
2 changed files with 14 additions and 13 deletions
+3 -2
View File
@@ -868,8 +868,9 @@ TEST(FormatterTest, Width) {
EXPECT_EQ(" 0xcafe", format("{0:10}", reinterpret_cast<void*>(0xcafe)));
EXPECT_EQ("x ", format("{0:11}", 'x'));
EXPECT_EQ("str ", format("{0:12}", "str"));
EXPECT_EQ(fmt::format("{:*^5}", "🤡"), "**🤡**");
EXPECT_EQ(fmt::format("{:#6}", 42.0), " 42.0");
EXPECT_EQ(format("{:*^5}", "🤡"), "**🤡**");
EXPECT_EQ(format("{:#6}", 42.0), " 42.0");
EXPECT_EQ(format("{:6c}", static_cast<int>('x')), "x ");
}
template <typename T> inline T const_check(T value) { return value; }