mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-31 19:24:48 +02:00
Fix dynamic named arg format spec handling (#4361)
When dealing with dynamic named format args, need to account for nested named args when skipping the content of the replacement. Fixes #4360
This commit is contained in:
@@ -582,6 +582,8 @@ TEST(format_test, named_arg) {
|
||||
EXPECT_EQ("1/a/A", fmt::format("{_1}/{a_}/{A_}", fmt::arg("a_", 'a'),
|
||||
fmt::arg("A_", "A"), fmt::arg("_1", 1)));
|
||||
EXPECT_EQ(fmt::format("{0:{width}}", -42, fmt::arg("width", 4)), " -42");
|
||||
EXPECT_EQ(fmt::format("{value:{width}}", fmt::arg("value", -42),
|
||||
fmt::arg("width", 4)), " -42");
|
||||
EXPECT_EQ("st",
|
||||
fmt::format("{0:.{precision}}", "str", fmt::arg("precision", 2)));
|
||||
EXPECT_EQ(fmt::format("{} {two}", 1, fmt::arg("two", 2)), "1 2");
|
||||
|
Reference in New Issue
Block a user