mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-02 11:28:20 +00:00
Merge branch 'master' of github.com:cppformat/cppformat
This commit is contained in:
commit
e5005c98b0
@ -764,7 +764,7 @@ inline Arg fmt::BasicFormatter<Char>::parse_arg_name(const Char *&s) {
|
||||
Char c;
|
||||
do {
|
||||
c = *++s;
|
||||
} while (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || ('0' <= c && c <= '9'));
|
||||
} while (is_name_start(c) || ('0' <= c && c <= '9'));
|
||||
const char *error = 0;
|
||||
Arg arg = get_arg(fmt::BasicStringRef<Char>(start, s - start), error);
|
||||
if (error)
|
||||
|
@ -610,8 +610,9 @@ TEST(FormatterTest, ManyArgs) {
|
||||
#endif
|
||||
|
||||
TEST(FormatterTest, NamedArg) {
|
||||
EXPECT_EQ("1/a/A", format("{_1}/{a_}/{A_}", fmt::arg("a_", 'a'), fmt::arg("A_", "A"), fmt::arg("_1", 1)));
|
||||
char a = 'A', b = 'B', c = 'C';
|
||||
EXPECT_EQ("BBAACC", format("{1}{b}{0}{a}{2}{c}", FMT_CAPTURE(a, b, c)));
|
||||
EXPECT_EQ("BB/AA/CC", format("{1}{b}/{0}{a}/{2}{c}", FMT_CAPTURE(a, b, c)));
|
||||
EXPECT_EQ(" A", format("{a:>2}", FMT_CAPTURE(a)));
|
||||
EXPECT_THROW_MSG(format("{a+}", FMT_CAPTURE(a)), FormatError, "missing '}' in format string");
|
||||
EXPECT_THROW_MSG(format("{a}"), FormatError, "argument not found");
|
||||
|
Loading…
Reference in New Issue
Block a user