summaryrefslogtreecommitdiff
path: root/unittest
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-05-25 19:41:58 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-05-25 19:41:58 +0300
commitecc7f305dde85d704a37e584c29df0ed3f97f7be (patch)
tree31810998f5f198e105c0f1f8e5acd6c9e7a581c3 /unittest
parent736ca14323fa16e409378f0da8005bce4be6dcf8 (diff)
parent5530a93f47324b847c799d00a2756729a2869d13 (diff)
downloadmariadb-git-ecc7f305dde85d704a37e584c29df0ed3f97f7be.tar.gz
Merge 10.2 into 10.3
Diffstat (limited to 'unittest')
-rw-r--r--unittest/mysys/my_vsnprintf-t.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/unittest/mysys/my_vsnprintf-t.c b/unittest/mysys/my_vsnprintf-t.c
index 872e88ddd7e..1a0b4080a2d 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(43);
+ plan(47);
test1("Constant string",
"Constant string");
@@ -99,27 +99,33 @@ int main(void)
test1("Width is ignored for strings <x> <y>",
"Width is ignored for strings <%04s> <%5s>", "x", "y");
- test1("Precision works for strings <ab...>",
+ test1("Precision works for strings <abcde>",
"Precision works for strings <%.5s>", "abcdef!");
+ test1("Precision works for strings <ab...>",
+ "Precision works for strings <%.5T>", "abcdef!");
+
+ test1("Flag '`' (backtick) works: `abcd` `op``q` (mysql extension)",
+ "Flag '`' (backtick) works: %`s %`.4s (mysql extension)",
+ "abcd", "op`qrst");
test1("Flag '`' (backtick) works: `abcd` `op``q...` (mysql extension)",
- "Flag '`' (backtick) works: %`s %`.7s (mysql extension)",
+ "Flag '`' (backtick) works: %`T %`.7T (mysql extension)",
"abcd", "op`qrstuuuuuuuuu");
test1("Flag '`' (backtick) works: `abcd` `.` (mysql extension)",
- "Flag '`' (backtick) works: %`s %`.1s (mysql extension)",
+ "Flag '`' (backtick) works: %`T %`.1T (mysql extension)",
"abcd", "op`qrstuuuuuuuuu");
test1("Flag '`' (backtick) works: `abcd` `...` (mysql extension)",
- "Flag '`' (backtick) works: %`s %`.3s (mysql extension)",
+ "Flag '`' (backtick) works: %`T %`.3T (mysql extension)",
"abcd", "op`qrstuuuuuuuuu");
test1("Flag '`' (backtick) works: `abcd` `op...` (mysql extension)",
- "Flag '`' (backtick) works: %`s %`.5s (mysql extension)",
+ "Flag '`' (backtick) works: %`T %`.5T (mysql extension)",
"abcd", "op`qrstuuuuuuuuu");
test1("Flag '`' (backtick) works: `abcd` `op``...` (mysql extension)",
- "Flag '`' (backtick) works: %`s %`.6s (mysql extension)",
+ "Flag '`' (backtick) works: %`T %`.6T (mysql extension)",
"abcd", "op`qrstuuuuuuuuu");
test1("Length modifiers work: 1 * -1 * 2 * 3",
@@ -141,15 +147,21 @@ int main(void)
test1("Asterisk '*' as a width works: < 4>",
"Asterisk '*' as a width works: <%*d>", 5, 4);
- test1("Asterisk '*' as a precision works: <qwe...>",
+ test1("Asterisk '*' as a precision works: <qwerty>",
"Asterisk '*' as a precision works: <%.*s>", 6, "qwertyuiop");
+ test1("Asterisk '*' as a precision works: <qwe...>",
+ "Asterisk '*' as a precision works: <%.*T>", 6, "qwertyuiop");
+
test1("Positional arguments for a width: < 4>",
"Positional arguments for a width: <%1$*2$d>", 4, 5);
- test1("Positional arguments for a precision: <qwe...>",
+ test1("Positional arguments for a precision: <qwerty>",
"Positional arguments for a precision: <%1$.*2$s>", "qwertyuiop", 6);
+ test1("Positional arguments for a precision: <qwe...>",
+ "Positional arguments for a precision: <%1$.*2$T>", "qwertyuiop", 6);
+
test1("Positional arguments and a width: <0000ab>",
"Positional arguments and a width: <%1$06x>", 0xab);