[String] Allow using Java style %[arg$] prefix in sprintf.
This commit is contained in:
parent
be587f3a2d
commit
f69edf810e
2 changed files with 76 additions and 30 deletions
|
|
@ -1296,6 +1296,15 @@ TEST_CASE("[String] sprintf") {
|
|||
REQUIRE(error == false);
|
||||
CHECK(output == String("fish 99.990 frog"));
|
||||
|
||||
///// Argument indices.
|
||||
format = "fish %2$d frog %1$s xx";
|
||||
args.clear();
|
||||
args.push_back("test");
|
||||
args.push_back(5);
|
||||
output = format.sprintf(args, &error);
|
||||
REQUIRE(error == false);
|
||||
CHECK(output == String("fish 5 frog test xx"));
|
||||
|
||||
///// Errors
|
||||
|
||||
// More formats than arguments.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue