Add support for s format specifier to bool (#2094) (#2109)

This commit is contained in:
Ivan Polyakov
2021-01-23 18:32:41 +03:00
committed by GitHub
parent 9c418bc468
commit 8bf28e6bb1
2 changed files with 32 additions and 3 deletions

View File

@@ -1129,6 +1129,9 @@ TEST(BoolTest, FormatBool) {
EXPECT_EQ("1", format("{:d}", true));
EXPECT_EQ("true ", format("{:5}", true));
EXPECT_EQ(L"true", format(L"{}", true));
EXPECT_EQ("true", format("{:s}", true));
EXPECT_EQ("false", format("{:s}", false));
EXPECT_EQ("false ", format("{:6s}", false));
}
TEST(FormatterTest, FormatShort) {
@@ -2435,7 +2438,6 @@ TEST(FormatTest, FormatStringErrors) {
EXPECT_ERROR("{:.{}}", "argument not found", double);
EXPECT_ERROR("{:.2}", "precision not allowed for this argument type", int);
EXPECT_ERROR("{:s}", "invalid type specifier", int);
EXPECT_ERROR("{:s}", "invalid type specifier", bool);
EXPECT_ERROR("{:s}", "invalid type specifier", char);
EXPECT_ERROR("{:+}", "invalid format specifier for char", char);
EXPECT_ERROR("{:s}", "invalid type specifier", double);