This commit is contained in:
parent
89468c2a23
commit
a997de90eb
@ -436,7 +436,7 @@ class fmt::internal::ArgFormatter :
|
||||
// TODO: don't duplicate integer format specifiers here
|
||||
case 'd': case 'x': case 'X': case 'b': case 'B': case 'o':
|
||||
writer_.write_int(value, spec_);
|
||||
break;
|
||||
return;
|
||||
default:
|
||||
internal::ReportUnknownType(spec_.type_, "char");
|
||||
}
|
||||
|
@ -1268,10 +1268,17 @@ TEST(FormatterTest, FormatLongDouble) {
|
||||
}
|
||||
|
||||
TEST(FormatterTest, FormatChar) {
|
||||
CheckUnknownTypes('a', "cbBdoxX", "char");
|
||||
const char types[] = "cbBdoxX";
|
||||
CheckUnknownTypes('a', types, "char");
|
||||
EXPECT_EQ("a", format("{0}", 'a'));
|
||||
EXPECT_EQ("z", format("{0:c}", 'z'));
|
||||
EXPECT_EQ(L"a", format(L"{0}", 'a'));
|
||||
int n = 'x';
|
||||
for (const char *type = types + 1; *type; ++type) {
|
||||
std::string format_str = fmt::format("{{:{}}}", *type);
|
||||
EXPECT_EQ(fmt::format(format_str, n), fmt::format(format_str, 'x'));
|
||||
}
|
||||
EXPECT_EQ(fmt::format("{:02X}", n), fmt::format("{:02X}", 'x'));
|
||||
}
|
||||
|
||||
TEST(FormatterTest, FormatWChar) {
|
||||
|
Loading…
Reference in New Issue
Block a user