fix zero flag for char types and make zero flag ignored if a precision is specified

This commit is contained in:
rimathia
2020-05-23 17:21:32 +02:00
committed by Victor Zverovich
parent bc1b89da26
commit 8c8f74a870
2 changed files with 9 additions and 1 deletions

View File

@@ -139,8 +139,11 @@ TEST(PrintfTest, ZeroFlag) {
EXPECT_PRINTF("+00042", "%00+6d", 42);
EXPECT_PRINTF(" 42", "%05.d", 42);
EXPECT_PRINTF(" 0042", "%05.4d", 42);
// '0' flag is ignored for non-numeric types.
EXPECT_PRINTF("0000x", "%05c", 'x');
EXPECT_PRINTF(" x", "%05c", 'x');
}
TEST(PrintfTest, PlusFlag) {