Fix handling of wide alignment

This commit is contained in:
Victor Zverovich
2020-09-15 06:53:06 -07:00
parent f80ed64dd9
commit 5b5a597198
2 changed files with 2 additions and 1 deletions

View File

@@ -2501,7 +2501,7 @@ FMT_CONSTEXPR const Char* parse_align(const Char* begin, const Char* end,
auto p = next_code_point(begin, end); auto p = next_code_point(begin, end);
if (p == end) p = begin; if (p == end) p = begin;
for (;;) { for (;;) {
switch (static_cast<char>(*p)) { switch (static_cast<int>(*p)) {
case '<': case '<':
align = align::left; align = align::left;
break; break;

View File

@@ -1525,6 +1525,7 @@ TEST(FormatterTest, WideFormatString) {
EXPECT_EQ(L"4.2", format(L"{}", 4.2)); EXPECT_EQ(L"4.2", format(L"{}", 4.2));
EXPECT_EQ(L"abc", format(L"{}", L"abc")); EXPECT_EQ(L"abc", format(L"{}", L"abc"));
EXPECT_EQ(L"z", format(L"{}", L'z')); EXPECT_EQ(L"z", format(L"{}", L'z'));
EXPECT_THROW(fmt::format(L"{:*\x343E}", 42), fmt::format_error);
} }
TEST(FormatterTest, FormatStringFromSpeedTest) { TEST(FormatterTest, FormatStringFromSpeedTest) {