mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-22 18:40:05 +00:00
Don't parse '}' as fill
This commit is contained in:
parent
3176e0fad7
commit
ecffca6726
@ -2395,6 +2395,7 @@ FMT_CONSTEXPR auto parse_align(const Char* begin, const Char* end,
|
||||
auto c = *begin;
|
||||
if (c == '{')
|
||||
return handler.on_error("invalid fill character '{'"), begin;
|
||||
if (c == '}') return begin;
|
||||
handler.on_fill(basic_string_view<Char>(begin, to_unsigned(p - begin)));
|
||||
begin = p + 1;
|
||||
} else
|
||||
|
@ -1205,6 +1205,7 @@ constexpr auto uint128_max = ~static_cast<__uint128_t>(0);
|
||||
TEST(format_test, format_dec) {
|
||||
EXPECT_EQ("0", fmt::format("{0}", 0));
|
||||
EXPECT_EQ("42", fmt::format("{0}", 42));
|
||||
EXPECT_EQ("42>", fmt::format("{:}>", 42));
|
||||
EXPECT_EQ("42", fmt::format("{0:d}", 42));
|
||||
EXPECT_EQ("42", fmt::format("{0}", 42u));
|
||||
EXPECT_EQ("-42", fmt::format("{0}", -42));
|
||||
|
Loading…
Reference in New Issue
Block a user