lib/std/io: support . string format speficier (#970)

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
This commit is contained in:
Pierre Curto
2023-09-05 14:39:51 +02:00
committed by GitHub
parent 5a2ef79fe6
commit f8fa9a057e
2 changed files with 24 additions and 7 deletions

View File

@@ -46,4 +46,8 @@ fn void printf_a()
assert(s == "[<12, 23>] ", "got '%s'; want '[<12, 23>] '", s);
s = string::printf("%20s", vec);
assert(s == " [<12, 23>]", "got '%s'; want ' [<12, 23>]'", s);
String ss = "hello world";
s = string::printf("%.4s %.5s", ss, ss);
assert(s == "hell hello", "got '%s'; want 'hell hello'", s);
}