align code-style

This commit is contained in:
Matthias Liedtke 2021-05-27 22:56:33 +02:00
parent 96e08b0cda
commit b92319da6f
2 changed files with 3 additions and 2 deletions

View File

@ -1591,7 +1591,7 @@ OutputIt write_nonfinite(OutputIt out, bool isinf,
constexpr size_t str_size = 3;
auto sign = fspecs.sign;
auto size = str_size + (sign ? 1 : 0);
// replace '0'-padding with space for non-finite values
// Replace '0'-padding with space for non-finite values.
const bool is_zero_fill =
specs.fill.size() == 1 && *specs.fill.data() == static_cast<Char>('0');
if (is_zero_fill) specs.fill[0] = static_cast<Char>(' ');

View File

@ -1279,8 +1279,9 @@ TEST(format_test, format_nan) {
if (std::signbit(-nan)) {
EXPECT_EQ("-nan", fmt::format("{}", -nan));
EXPECT_EQ(" -nan", fmt::format("{:+06}", -nan));
} else
} else {
fmt::print("Warning: compiler doesn't handle negative NaN correctly");
}
EXPECT_EQ(" nan", fmt::format("{: }", nan));
EXPECT_EQ("NAN", fmt::format("{:F}", nan));
EXPECT_EQ("nan ", fmt::format("{:<7}", nan));