Don't remove trailing zeros with #

This commit is contained in:
Victor Zverovich
2020-08-08 08:14:39 -07:00
parent e06ae32294
commit 4fd95e4b4d
2 changed files with 2 additions and 1 deletions

View File

@@ -761,6 +761,7 @@ TEST(FormatterTest, HashFlag) {
EXPECT_EQ("-42.0", format("{0:#}", -42.0l));
EXPECT_EQ("4.e+01", format("{:#.0e}", 42.0));
EXPECT_EQ("0.", format("{:#.0f}", 0.01));
EXPECT_EQ("0.50", format("{:#.2g}", 0.5));
auto s = format("{:#.0f}", 0.5); // MSVC's printf uses wrong rounding mode.
EXPECT_TRUE(s == "0." || s == "1.");
EXPECT_THROW_MSG(format("{0:#", 'c'), format_error,