diff options
author | Jukka Jylänki <jujjyl@gmail.com> | 2014-05-23 02:16:59 +0300 |
---|---|---|
committer | Jukka Jylänki <jujjyl@gmail.com> | 2014-05-23 02:20:06 +0300 |
commit | d8dad47db38919dc25707f44144b5e66a34a6cf4 (patch) | |
tree | 990b53db20683ea86df58a58f34d4253afee1bfc /tests/core | |
parent | b3af30a8b178cca331a0ec6b6d9d0b1012e3a70b (diff) |
Fix test test_sscanf to be spec-conformant in the treatment of scanf format specifiers. According to the standard, %255c matches exactly 255 characters, while %255s matches up to 255 characters.
Diffstat (limited to 'tests/core')
-rw-r--r-- | tests/core/test_sscanf.in | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/tests/core/test_sscanf.in b/tests/core/test_sscanf.in index 08a32f73..470aaf37 100644 --- a/tests/core/test_sscanf.in +++ b/tests/core/test_sscanf.in @@ -67,9 +67,8 @@ int main() { memset(buf4, 0, 100); - int numItems = sscanf("level=4:ref=3", "%255[^:=]=%255[^:]:%255[^=]=%255c", + int numItems = sscanf("level=4:ref=3", "%255[^:=]=%255[^:]:%255[^=]=%c", buf1, buf2, buf3, buf4); - numItems = 4; // XXX musl libc bug: it returns 3 - but still properly fills all the four buf1-buf4 fields! printf("%d, %s, %s, %s, %s\n", numItems, buf1, buf2, buf3, buf4); numItems = sscanf("def|456", "%[a-z]|%[0-9]", buf1, buf2); |