Fix handling of the + flag with locales (#2133)
This commit is contained in:
parent
c5979d564e
commit
ee0fed639c
@ -1810,7 +1810,7 @@ template <typename OutputIt, typename Char, typename UInt> struct int_writer {
|
|||||||
p -= s.size();
|
p -= s.size();
|
||||||
}
|
}
|
||||||
*p-- = static_cast<Char>(*digits);
|
*p-- = static_cast<Char>(*digits);
|
||||||
if (prefix_size != 0) *p = static_cast<Char>('-');
|
if (prefix_size != 0) *p = static_cast<Char>(prefix[0]);
|
||||||
auto data = buffer.data();
|
auto data = buffer.data();
|
||||||
out = write_padded<align::right>(
|
out = write_padded<align::right>(
|
||||||
out, specs, usize, usize,
|
out, specs, usize, usize,
|
||||||
|
@ -73,8 +73,13 @@ TEST(LocaleTest, Format) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(LocaleTest, FormatDetaultAlign) {
|
TEST(LocaleTest, FormatDetaultAlign) {
|
||||||
std::locale special_grouping_loc(std::locale(), new special_grouping<char>());
|
auto loc = std::locale({}, new special_grouping<char>());
|
||||||
EXPECT_EQ(" 12,345", fmt::format(special_grouping_loc, "{:8L}", 12345));
|
EXPECT_EQ(" 12,345", fmt::format(loc, "{:8L}", 12345));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(LocaleTest, FormatPlus) {
|
||||||
|
auto loc = std::locale({}, new special_grouping<char>());
|
||||||
|
EXPECT_EQ("+100", fmt::format(loc, "{:+L}", 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(LocaleTest, WFormat) {
|
TEST(LocaleTest, WFormat) {
|
||||||
|
Loading…
Reference in New Issue
Block a user