Commit cbac016c authored by Arthur Danskin's avatar Arthur Danskin Committed by Victor Zverovich

%.f should have zero precision, not default precision

parent c03f55ec
......@@ -439,6 +439,8 @@ void PrintfFormatter<Char, AF>::format(BasicCStringRef<Char> format_str) {
} else if (*s == '*') {
++s;
spec.precision_ = internal::PrecisionHandler().visit(get_arg(s));
} else {
spec.precision_ = 0;
}
}
......
......@@ -401,6 +401,9 @@ TEST(PrintfTest, LongLong) {
TEST(PrintfTest, Float) {
EXPECT_PRINTF("392.650000", "%f", 392.65);
EXPECT_PRINTF("392.65", "%.2f", 392.65);
EXPECT_PRINTF("392.6", "%.1f", 392.65);
EXPECT_PRINTF("393", "%.f", 392.65);
EXPECT_PRINTF("392.650000", "%F", 392.65);
EXPECT_PRINTF("392.65", "%s", 392.65);
char buffer[BUFFER_SIZE];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment