mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-19 20:18:49 +00:00
Merge branch 'master' of github.com:fmtlib/fmt
This commit is contained in:
commit
d3964d7b1e
@ -257,7 +257,10 @@ class printf_arg_formatter : public detail::arg_formatter_base<Range> {
|
|||||||
return (*this)(static_cast<int>(value));
|
return (*this)(static_cast<int>(value));
|
||||||
fmt_specs.sign = sign::none;
|
fmt_specs.sign = sign::none;
|
||||||
fmt_specs.alt = false;
|
fmt_specs.alt = false;
|
||||||
fmt_specs.align = align::right;
|
// align::numeric needs to be overwritten here since the '0' flag is
|
||||||
|
// ignored for non-numeric types
|
||||||
|
if (fmt_specs.align == align::none || fmt_specs.align == align::numeric)
|
||||||
|
fmt_specs.align = align::right;
|
||||||
return base::operator()(value);
|
return base::operator()(value);
|
||||||
} else {
|
} else {
|
||||||
return base::operator()(value);
|
return base::operator()(value);
|
||||||
|
@ -156,6 +156,10 @@ TEST(PrintfTest, PlusFlag) {
|
|||||||
TEST(PrintfTest, MinusFlag) {
|
TEST(PrintfTest, MinusFlag) {
|
||||||
EXPECT_PRINTF("abc ", "%-5s", "abc");
|
EXPECT_PRINTF("abc ", "%-5s", "abc");
|
||||||
EXPECT_PRINTF("abc ", "%0--5s", "abc");
|
EXPECT_PRINTF("abc ", "%0--5s", "abc");
|
||||||
|
|
||||||
|
EXPECT_PRINTF("7 ", "%-5d", 7);
|
||||||
|
EXPECT_PRINTF("97 ", "%-5hhi", 'a');
|
||||||
|
EXPECT_PRINTF("a ", "%-5c", 'a');
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(PrintfTest, SpaceFlag) {
|
TEST(PrintfTest, SpaceFlag) {
|
||||||
|
Loading…
Reference in New Issue
Block a user