diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-02-08 17:14:46 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-02-08 17:14:46 +0100 |
commit | d5b991493816a2edba7cacdd06820cf3c0abc4dc (patch) | |
tree | 2c12474dbb6d46beaa2547dce9c139ce22e679f7 /src/message_test.c | |
parent | 4f645c54efe33d7a11e314676e503118761f08a7 (diff) |
patch 8.2.0234: message test fails on SunOSv8.2.0234
Problem: Message test fails on SunOS.
Solution: Adjust expectation for printf "%p". (Ozaki Kiichi, closes #5595)
Diffstat (limited to 'src/message_test.c')
-rw-r--r-- | src/message_test.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/message_test.c b/src/message_test.c index 3397a9cb47..7f6540b310 100644 --- a/src/message_test.c +++ b/src/message_test.c @@ -240,14 +240,26 @@ test_vim_snprintf(void) // %p format is not tested in vim script tests Test_printf*() // as it only makes sense in C code. + // NOTE: SunOS libc doesn't use the prefix "0x" on %p. +#ifdef SUN_SYSTEM +# define PREFIX_LEN 0 +# define PREFIX_STR1 "" +# define PREFIX_STR2 "00" +#else +# define PREFIX_LEN 2 +# define PREFIX_STR1 "0x" +# define PREFIX_STR2 "0x" +#endif n = vim_snprintf(buf, bsize, "%p", ptr); - assert(n == 10); - assert(bsize == 0 || STRNCMP(buf, "0x87654321", bsize_int) == 0); + assert(n == 8 + PREFIX_LEN); + assert(bsize == 0 + || STRNCMP(buf, PREFIX_STR1 "87654321", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); n = vim_snprintf(buf, bsize, fmt_012p, ptr); assert(n == 12); - assert(bsize == 0 || STRNCMP(buf, "0x0087654321", bsize_int) == 0); + assert(bsize == 0 + || STRNCMP(buf, PREFIX_STR2 "0087654321", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); free(buf); |