mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-25 15:21:54 +00:00
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-- = 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();
|
||||
out = write_padded<align::right>(
|
||||
out, specs, usize, usize,
|
||||
|
@ -73,8 +73,13 @@ TEST(LocaleTest, Format) {
|
||||
}
|
||||
|
||||
TEST(LocaleTest, FormatDetaultAlign) {
|
||||
std::locale special_grouping_loc(std::locale(), new special_grouping<char>());
|
||||
EXPECT_EQ(" 12,345", fmt::format(special_grouping_loc, "{:8L}", 12345));
|
||||
auto loc = std::locale({}, new special_grouping<char>());
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user