mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-25 15:21:54 +00:00
FMT_NUMERIC_ALIGN -> FMT_DEPRECATED_NUMERIC_ALIGN
This commit is contained in:
parent
56e63078ff
commit
56fed78149
@ -226,8 +226,8 @@ FMT_END_NAMESPACE
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Enable the deprecated numeric alignment.
|
// Enable the deprecated numeric alignment.
|
||||||
#ifndef FMT_NUMERIC_ALIGN
|
#ifndef FMT_DEPRECATED_NUMERIC_ALIGN
|
||||||
# define FMT_NUMERIC_ALIGN 1
|
# define FMT_DEPRECATED_NUMERIC_ALIGN 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FMT_BEGIN_NAMESPACE
|
FMT_BEGIN_NAMESPACE
|
||||||
@ -2445,7 +2445,7 @@ FMT_CONSTEXPR const Char* parse_align(const Char* begin, const Char* end,
|
|||||||
case '>':
|
case '>':
|
||||||
align = align::right;
|
align = align::right;
|
||||||
break;
|
break;
|
||||||
#if FMT_NUMERIC_ALIGN
|
#if FMT_DEPRECATED_NUMERIC_ALIGN
|
||||||
case '=':
|
case '=':
|
||||||
align = align::numeric;
|
align = align::numeric;
|
||||||
break;
|
break;
|
||||||
|
@ -605,7 +605,7 @@ TEST(FormatterTest, RightAlign) {
|
|||||||
EXPECT_EQ(" 0xface", format("{0:>8}", reinterpret_cast<void*>(0xface)));
|
EXPECT_EQ(" 0xface", format("{0:>8}", reinterpret_cast<void*>(0xface)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if FMT_NUMERIC_ALIGN
|
#if FMT_DEPRECATED_NUMERIC_ALIGN
|
||||||
TEST(FormatterTest, NumericAlign) { EXPECT_EQ("0042", format("{0:=4}", 42)); }
|
TEST(FormatterTest, NumericAlign) { EXPECT_EQ("0042", format("{0:=4}", 42)); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1887,7 +1887,7 @@ TEST(FormatTest, DynamicFormatter) {
|
|||||||
"cannot switch from manual to automatic argument indexing");
|
"cannot switch from manual to automatic argument indexing");
|
||||||
EXPECT_THROW_MSG(format("{:{0}}", num), format_error,
|
EXPECT_THROW_MSG(format("{:{0}}", num), format_error,
|
||||||
"cannot switch from automatic to manual argument indexing");
|
"cannot switch from automatic to manual argument indexing");
|
||||||
#if FMT_NUMERIC_ALIGN
|
#if FMT_DEPRECATED_NUMERIC_ALIGN
|
||||||
EXPECT_THROW_MSG(format("{:=}", str), format_error,
|
EXPECT_THROW_MSG(format("{:=}", str), format_error,
|
||||||
"format specifier requires numeric argument");
|
"format specifier requires numeric argument");
|
||||||
#endif
|
#endif
|
||||||
@ -2327,7 +2327,7 @@ TEST(FormatTest, FormatStringErrors) {
|
|||||||
EXPECT_ERROR("{:10000000000}", "number is too big", int);
|
EXPECT_ERROR("{:10000000000}", "number is too big", int);
|
||||||
EXPECT_ERROR("{:.10000000000}", "number is too big", int);
|
EXPECT_ERROR("{:.10000000000}", "number is too big", int);
|
||||||
EXPECT_ERROR_NOARGS("{:x}", "argument not found");
|
EXPECT_ERROR_NOARGS("{:x}", "argument not found");
|
||||||
# if FMT_NUMERIC_ALIGN
|
# if FMT_DEPRECATED_NUMERIC_ALIGN
|
||||||
EXPECT_ERROR("{0:=5", "unknown format specifier", int);
|
EXPECT_ERROR("{0:=5", "unknown format specifier", int);
|
||||||
EXPECT_ERROR("{:=}", "format specifier requires numeric argument",
|
EXPECT_ERROR("{:=}", "format specifier requires numeric argument",
|
||||||
const char*);
|
const char*);
|
||||||
|
@ -96,7 +96,7 @@ TEST(OStreamTest, Format) {
|
|||||||
TEST(OStreamTest, FormatSpecs) {
|
TEST(OStreamTest, FormatSpecs) {
|
||||||
EXPECT_EQ("def ", format("{0:<5}", TestString("def")));
|
EXPECT_EQ("def ", format("{0:<5}", TestString("def")));
|
||||||
EXPECT_EQ(" def", format("{0:>5}", TestString("def")));
|
EXPECT_EQ(" def", format("{0:>5}", TestString("def")));
|
||||||
#if FMT_NUMERIC_ALIGN
|
#if FMT_DEPRECATED_NUMERIC_ALIGN
|
||||||
EXPECT_THROW_MSG(format("{0:=5}", TestString("def")), format_error,
|
EXPECT_THROW_MSG(format("{0:=5}", TestString("def")), format_error,
|
||||||
"format specifier requires numeric argument");
|
"format specifier requires numeric argument");
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user