From 5b5a597198038e1d67969ec5212d8eb8ab2e8dd4 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Tue, 15 Sep 2020 06:53:06 -0700 Subject: [PATCH] Fix handling of wide alignment --- include/fmt/format.h | 2 +- test/format-test.cc | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 464c0d72..98c15c64 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2501,7 +2501,7 @@ FMT_CONSTEXPR const Char* parse_align(const Char* begin, const Char* end, auto p = next_code_point(begin, end); if (p == end) p = begin; for (;;) { - switch (static_cast(*p)) { + switch (static_cast(*p)) { case '<': align = align::left; break; diff --git a/test/format-test.cc b/test/format-test.cc index 7841c68f..2d017a81 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -1525,6 +1525,7 @@ TEST(FormatterTest, WideFormatString) { EXPECT_EQ(L"4.2", format(L"{}", 4.2)); EXPECT_EQ(L"abc", format(L"{}", L"abc")); EXPECT_EQ(L"z", format(L"{}", L'z')); + EXPECT_THROW(fmt::format(L"{:*\x343E}", 42), fmt::format_error); } TEST(FormatterTest, FormatStringFromSpeedTest) {