Fix width handling in dynamic formatting

This commit is contained in:
Victor Zverovich
2017-09-27 19:04:15 -07:00
parent 8cbf544733
commit d45544d14e
2 changed files with 52 additions and 32 deletions

View File

@@ -1561,6 +1561,7 @@ TEST(FormatTest, DynamicFormatter) {
auto str = variant("foo");
EXPECT_EQ("42", format("{:d}", num));
EXPECT_EQ("foo", format("{:s}", str));
EXPECT_EQ(" 42 foo ", format("{:{}} {:{}}", num, 3, str, 4));
EXPECT_THROW_MSG(format("{:=}", str),
format_error, "format specifier '=' requires numeric argument");
EXPECT_THROW_MSG(format("{:+}", str),