diff options
author | Monty <monty@mariadb.org> | 2020-08-13 20:17:00 +0300 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2021-05-19 22:27:29 +0200 |
commit | 5c7d243b29257fe02edaea42730893d4d185ced5 (patch) | |
tree | 06cf893181aba06ec9af8a29a3440f79e23277ec /unittest | |
parent | 8dd6ad573ce3c0bc72e2ec47f9833f6dc774cecf (diff) | |
download | mariadb-git-5c7d243b29257fe02edaea42730893d4d185ced5.tar.gz |
Add support for minimum field width for strings to my_vsnprintf()
This patch adds support for right aligned strings and numbers.
Left alignment is left as an exercise for anyone needing it.
MDEV-25612 "Assertion `to <= end' failed in process_args" fixed.
(Was caused by the original version of this patch)
Diffstat (limited to 'unittest')
-rw-r--r-- | unittest/mysys/my_vsnprintf-t.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/unittest/mysys/my_vsnprintf-t.c b/unittest/mysys/my_vsnprintf-t.c index 1a0b4080a2d..af17f6e3854 100644 --- a/unittest/mysys/my_vsnprintf-t.c +++ b/unittest/mysys/my_vsnprintf-t.c @@ -61,7 +61,7 @@ static void test_many(const char **res, const char *fmt, ...) int main(void) { - plan(47); + plan(48); test1("Constant string", "Constant string"); @@ -96,8 +96,11 @@ int main(void) test1("Flag '0' works <0006>", "Flag '0' works <%04d>", 6); - test1("Width is ignored for strings <x> <y>", - "Width is ignored for strings <%04s> <%5s>", "x", "y"); + test1("Width for strings < x> < y>", + "Width for strings <%04s> <%5s>", "x", "y"); + + test1("Negative width is ignored for strings < x> < y>", + "Negative width is ignored for strings <%-4s> <%-5s>", "x", "y"); test1("Precision works for strings <abcde>", "Precision works for strings <%.5s>", "abcdef!"); |