Mercurial > vim
annotate src/message_test.c @ 25835:55592629062e
Added tag v8.2.3452 for changeset a89664a64d6292c76c4aceecc955f43d47fb781b
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 21 Sep 2021 19:45:06 +0200 |
parents | 9d304d363ab6 |
children | 4dcccb2673fe |
rev | line source |
---|---|
10042
4aead6a9b7a9
commit https://github.com/vim/vim/commit/edf3f97ae2af024708ebb4ac614227327033ca47
Christian Brabandt <cb@256bit.org>
parents:
9581
diff
changeset
|
1 /* vi:set ts=8 sts=4 sw=4 noet: |
9542
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 * |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 * VIM - Vi IMproved by Bram Moolenaar |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 * |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 * Do ":help uganda" in Vim to read copying and usage conditions. |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 * Do ":help credits" in Vim to see a list of people who contributed. |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 * See README.txt for an overview of the Vim source code. |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 */ |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 /* |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 * message_test.c: Unittests for message.c |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 */ |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 #undef NDEBUG |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 #include <assert.h> |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 |
18931
80b40bd5ec1a
patch 8.2.0026: still some /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
11309
diff
changeset
|
17 // Must include main.c because it contains much more than just main() |
9542
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 #define NO_VIM_MAIN |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 #include "main.c" |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 |
18931
80b40bd5ec1a
patch 8.2.0026: still some /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
11309
diff
changeset
|
21 // This file has to be included because some of the tested functions are |
80b40bd5ec1a
patch 8.2.0026: still some /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
11309
diff
changeset
|
22 // static. |
9542
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 #include "message.c" |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 |
19011
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
25 #ifndef MIN |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
26 # define MIN(x,y) ((x) < (y) ? (x) : (y)) |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
27 #endif |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
28 |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
29 // These formats are not standard in C printf() function. |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
30 // Use a global variable rather than a literal format to disable |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
31 // -Wformat compiler warnings: |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
32 // |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
33 // - warning: '0' flag used with ‘%p’ gnu_printf format |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
34 // - warning: format ‘%S’ expects argument of type ‘wchar_t *’, but argument 4 has type ‘char *’ |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
35 // - warning: unknown conversion type character ‘b’ in format |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
36 // |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
37 // These formats are in practise only used from vim script printf() |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
38 // function and never as literals in C code. |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
39 char *fmt_012p = "%012p"; |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
40 char *fmt_5S = "%5S"; |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
41 char *fmt_06b = "%06b"; |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
42 |
9542
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 /* |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 * Test trunc_string(). |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 */ |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 static void |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 test_trunc_string(void) |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 { |
9581
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
49 char_u *buf; /*allocated every time to find uninit errors */ |
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
50 char_u *s; |
9542
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 |
23946
0b1f5717dc4d
patch 8.2.2515: memory access error when truncating an empty message
Bram Moolenaar <Bram@vim.org>
parents:
20105
diff
changeset
|
52 // Should not write anything to destination if buflen is 0. |
0b1f5717dc4d
patch 8.2.2515: memory access error when truncating an empty message
Bram Moolenaar <Bram@vim.org>
parents:
20105
diff
changeset
|
53 trunc_string((char_u *)"", NULL, 1, 0); |
0b1f5717dc4d
patch 8.2.2515: memory access error when truncating an empty message
Bram Moolenaar <Bram@vim.org>
parents:
20105
diff
changeset
|
54 |
0b1f5717dc4d
patch 8.2.2515: memory access error when truncating an empty message
Bram Moolenaar <Bram@vim.org>
parents:
20105
diff
changeset
|
55 // Truncating an empty string does nothing. |
0b1f5717dc4d
patch 8.2.2515: memory access error when truncating an empty message
Bram Moolenaar <Bram@vim.org>
parents:
20105
diff
changeset
|
56 buf = alloc(1); |
0b1f5717dc4d
patch 8.2.2515: memory access error when truncating an empty message
Bram Moolenaar <Bram@vim.org>
parents:
20105
diff
changeset
|
57 trunc_string((char_u *)"", buf, 1, 1); |
0b1f5717dc4d
patch 8.2.2515: memory access error when truncating an empty message
Bram Moolenaar <Bram@vim.org>
parents:
20105
diff
changeset
|
58 assert(buf[0] == NUL); |
0b1f5717dc4d
patch 8.2.2515: memory access error when truncating an empty message
Bram Moolenaar <Bram@vim.org>
parents:
20105
diff
changeset
|
59 vim_free(buf); |
0b1f5717dc4d
patch 8.2.2515: memory access error when truncating an empty message
Bram Moolenaar <Bram@vim.org>
parents:
20105
diff
changeset
|
60 |
18931
80b40bd5ec1a
patch 8.2.0026: still some /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
11309
diff
changeset
|
61 // in place |
9581
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
62 buf = alloc(40); |
9542
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
63 STRCPY(buf, "text"); |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
64 trunc_string(buf, buf, 20, 40); |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 assert(STRCMP(buf, "text") == 0); |
9581
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
66 vim_free(buf); |
9542
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
67 |
9581
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
68 buf = alloc(40); |
9542
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
69 STRCPY(buf, "a short text"); |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
70 trunc_string(buf, buf, 20, 40); |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
71 assert(STRCMP(buf, "a short text") == 0); |
9581
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
72 vim_free(buf); |
9542
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
73 |
9581
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
74 buf = alloc(40); |
9542
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
75 STRCPY(buf, "a text tha just fits"); |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
76 trunc_string(buf, buf, 20, 40); |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
77 assert(STRCMP(buf, "a text tha just fits") == 0); |
9581
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
78 vim_free(buf); |
9542
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
79 |
9581
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
80 buf = alloc(40); |
9542
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
81 STRCPY(buf, "a text that nott fits"); |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
82 trunc_string(buf, buf, 20, 40); |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
83 assert(STRCMP(buf, "a text t...nott fits") == 0); |
9581
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
84 vim_free(buf); |
9542
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
85 |
18931
80b40bd5ec1a
patch 8.2.0026: still some /* */ comments
Bram Moolenaar <Bram@vim.org>
parents:
11309
diff
changeset
|
86 // copy from string to buf |
9581
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
87 buf = alloc(40); |
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
88 s = vim_strsave((char_u *)"text"); |
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
89 trunc_string(s, buf, 20, 40); |
9542
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
90 assert(STRCMP(buf, "text") == 0); |
9581
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
91 vim_free(buf); |
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
92 vim_free(s); |
9542
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
93 |
9581
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
94 buf = alloc(40); |
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
95 s = vim_strsave((char_u *)"a text that fits"); |
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
96 trunc_string(s, buf, 34, 40); |
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
97 assert(STRCMP(buf, "a text that fits") == 0); |
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
98 vim_free(buf); |
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
99 vim_free(s); |
9542
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
100 |
9581
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
101 buf = alloc(40); |
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
102 s = vim_strsave((char_u *)"a short text"); |
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
103 trunc_string(s, buf, 20, 40); |
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
104 assert(STRCMP(buf, "a short text") == 0); |
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
105 vim_free(buf); |
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
106 vim_free(s); |
9542
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
107 |
9581
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
108 buf = alloc(40); |
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
109 s = vim_strsave((char_u *)"a text tha just fits"); |
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
110 trunc_string(s, buf, 20, 40); |
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
111 assert(STRCMP(buf, "a text tha just fits") == 0); |
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
112 vim_free(buf); |
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
113 vim_free(s); |
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
114 |
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
115 buf = alloc(40); |
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
116 s = vim_strsave((char_u *)"a text that nott fits"); |
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
117 trunc_string(s, buf, 20, 40); |
9542
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
118 assert(STRCMP(buf, "a text t...nott fits") == 0); |
9581
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
119 vim_free(buf); |
716382aaa0c0
commit https://github.com/vim/vim/commit/b9644433d2728e99fab874e5e33147ad95d23a31
Christian Brabandt <cb@256bit.org>
parents:
9542
diff
changeset
|
120 vim_free(s); |
9542
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
121 } |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
122 |
19011
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
123 /* |
24709
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23946
diff
changeset
|
124 * Test trunc_string() with mbyte chars. |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23946
diff
changeset
|
125 */ |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23946
diff
changeset
|
126 static void |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23946
diff
changeset
|
127 test_trunc_string_mbyte(void) |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23946
diff
changeset
|
128 { |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23946
diff
changeset
|
129 char_u *buf; // allocated every time to find uninit errors |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23946
diff
changeset
|
130 char_u *s; |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23946
diff
changeset
|
131 |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23946
diff
changeset
|
132 buf = alloc(40); |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23946
diff
changeset
|
133 s = vim_strsave((char_u *)"Ä text tha just fits"); |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23946
diff
changeset
|
134 trunc_string(s, buf, 20, 40); |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23946
diff
changeset
|
135 assert(STRCMP(buf, "Ä text tha just fits") == 0); |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23946
diff
changeset
|
136 vim_free(buf); |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23946
diff
changeset
|
137 vim_free(s); |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23946
diff
changeset
|
138 |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23946
diff
changeset
|
139 buf = alloc(40); |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23946
diff
changeset
|
140 s = vim_strsave((char_u *)"a text ÄÖÜä nott fits"); |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23946
diff
changeset
|
141 trunc_string(s, buf, 20, 40); |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23946
diff
changeset
|
142 assert(STRCMP(buf, "a text Ä...nott fits") == 0); |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23946
diff
changeset
|
143 vim_free(buf); |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23946
diff
changeset
|
144 vim_free(s); |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23946
diff
changeset
|
145 |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23946
diff
changeset
|
146 buf = alloc(40); |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23946
diff
changeset
|
147 s = vim_strsave((char_u *)"a text that not fitsÄ"); |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23946
diff
changeset
|
148 trunc_string(s, buf, 20, 40); |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23946
diff
changeset
|
149 assert(STRCMP(buf, "a text t...not fitsÄ") == 0); |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23946
diff
changeset
|
150 vim_free(buf); |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23946
diff
changeset
|
151 vim_free(s); |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23946
diff
changeset
|
152 } |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23946
diff
changeset
|
153 |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23946
diff
changeset
|
154 /* |
19011
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
155 * Test vim_snprintf() with a focus on checking that truncation is |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
156 * correct when buffer is small, since it cannot be tested from |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
157 * vim scrip tests. Check that: |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
158 * - no buffer overflows happens (with valgrind or asan) |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
159 * - output string is always NUL terminated. |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
160 * |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
161 * Not all formats of vim_snprintf() are checked here. They are |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
162 * checked more exhaustively in Test_printf*() vim script tests. |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
163 */ |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
164 static void |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
165 test_vim_snprintf(void) |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
166 { |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
167 int n; |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
168 size_t bsize; |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
169 int bsize_int; |
20105
785e2f0095a9
patch 8.2.0608: warning from clang when building message test
Bram Moolenaar <Bram@vim.org>
parents:
20007
diff
changeset
|
170 void *ptr = (void *)0x87654321; |
19011
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
171 |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
172 // Loop on various buffer sizes to make sure that truncation of |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
173 // vim_snprintf() is correct. |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
174 for (bsize = 0; bsize < 15; ++bsize) |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
175 { |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
176 bsize_int = (int)bsize - 1; |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
177 |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
178 // buf is the heap rather than in the stack |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
179 // so valgrind can detect buffer overflows if any. |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
180 // Use malloc() rather than alloc() as test checks with 0-size |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
181 // buffer and its content should then never be used. |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
182 char *buf = malloc(bsize); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
183 |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
184 n = vim_snprintf(buf, bsize, "%d", 1234567); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
185 assert(n == 7); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
186 assert(bsize == 0 || STRNCMP(buf, "1234567", bsize_int) == 0); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
187 assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
188 |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
189 n = vim_snprintf(buf, bsize, "%ld", 1234567L); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
190 assert(n == 7); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
191 assert(bsize == 0 || STRNCMP(buf, "1234567", bsize_int) == 0); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
192 assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
193 |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
194 n = vim_snprintf(buf, bsize, "%9ld", 1234567L); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
195 assert(n == 9); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
196 assert(bsize == 0 || STRNCMP(buf, " 1234567", bsize_int) == 0); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
197 assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
198 |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
199 n = vim_snprintf(buf, bsize, "%-9ld", 1234567L); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
200 assert(n == 9); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
201 assert(bsize == 0 || STRNCMP(buf, "1234567 ", bsize_int) == 0); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
202 assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
203 |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
204 n = vim_snprintf(buf, bsize, "%x", 0xdeadbeef); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
205 assert(n == 8); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
206 assert(bsize == 0 || STRNCMP(buf, "deadbeef", bsize_int) == 0); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
207 assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
208 |
19119
7816aa44c145
patch 8.2.0119: message test fails on some platforms
Bram Moolenaar <Bram@vim.org>
parents:
19011
diff
changeset
|
209 n = vim_snprintf(buf, bsize, fmt_06b, (uvarnumber_T)12); |
19011
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
210 assert(n == 6); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
211 assert(bsize == 0 || STRNCMP(buf, "001100", bsize_int) == 0); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
212 assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
213 |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
214 #ifdef FEAT_FLOAT |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
215 n = vim_snprintf(buf, bsize, "%f", 1.234); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
216 assert(n == 8); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
217 assert(bsize == 0 || STRNCMP(buf, "1.234000", bsize_int) == 0); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
218 assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
219 |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
220 n = vim_snprintf(buf, bsize, "%e", 1.234); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
221 assert(n == 12); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
222 assert(bsize == 0 || STRNCMP(buf, "1.234000e+00", bsize_int) == 0); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
223 assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
224 |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
225 n = vim_snprintf(buf, bsize, "%f", 0.0/0.0); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
226 assert(n == 3); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
227 assert(bsize == 0 || STRNCMP(buf, "nan", bsize_int) == 0); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
228 assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
229 |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
230 n = vim_snprintf(buf, bsize, "%f", 1.0/0.0); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
231 assert(n == 3); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
232 assert(bsize == 0 || STRNCMP(buf, "inf", bsize_int) == 0); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
233 assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
234 |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
235 n = vim_snprintf(buf, bsize, "%f", -1.0/0.0); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
236 assert(n == 4); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
237 assert(bsize == 0 || STRNCMP(buf, "-inf", bsize_int) == 0); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
238 assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
239 |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
240 n = vim_snprintf(buf, bsize, "%f", -0.0); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
241 assert(n == 9); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
242 assert(bsize == 0 || STRNCMP(buf, "-0.000000", bsize_int) == 0); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
243 assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
244 #endif |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
245 |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
246 n = vim_snprintf(buf, bsize, "%s", "漢語"); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
247 assert(n == 6); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
248 assert(bsize == 0 || STRNCMP(buf, "漢語", bsize_int) == 0); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
249 assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
250 |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
251 n = vim_snprintf(buf, bsize, "%8s", "漢語"); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
252 assert(n == 8); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
253 assert(bsize == 0 || STRNCMP(buf, " 漢語", bsize_int) == 0); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
254 assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
255 |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
256 n = vim_snprintf(buf, bsize, "%-8s", "漢語"); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
257 assert(n == 8); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
258 assert(bsize == 0 || STRNCMP(buf, "漢語 ", bsize_int) == 0); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
259 assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
260 |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
261 n = vim_snprintf(buf, bsize, "%.3s", "漢語"); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
262 assert(n == 3); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
263 assert(bsize == 0 || STRNCMP(buf, "漢", bsize_int) == 0); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
264 assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
265 |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
266 n = vim_snprintf(buf, bsize, fmt_5S, "foo"); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
267 assert(n == 5); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
268 assert(bsize == 0 || STRNCMP(buf, " foo", bsize_int) == 0); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
269 assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
270 |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
271 n = vim_snprintf(buf, bsize, "%%%%%%"); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
272 assert(n == 3); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
273 assert(bsize == 0 || STRNCMP(buf, "%%%", bsize_int) == 0); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
274 assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
275 |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
276 n = vim_snprintf(buf, bsize, "%c%c", 1, 2); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
277 assert(n == 2); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
278 assert(bsize == 0 || STRNCMP(buf, "\x01\x02", bsize_int) == 0); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
279 assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
280 |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
281 // %p format is not tested in vim script tests Test_printf*() |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
282 // as it only makes sense in C code. |
19352
c617ba6413bb
patch 8.2.0234: message test fails on SunOS
Bram Moolenaar <Bram@vim.org>
parents:
19119
diff
changeset
|
283 // NOTE: SunOS libc doesn't use the prefix "0x" on %p. |
c617ba6413bb
patch 8.2.0234: message test fails on SunOS
Bram Moolenaar <Bram@vim.org>
parents:
19119
diff
changeset
|
284 #ifdef SUN_SYSTEM |
c617ba6413bb
patch 8.2.0234: message test fails on SunOS
Bram Moolenaar <Bram@vim.org>
parents:
19119
diff
changeset
|
285 # define PREFIX_LEN 0 |
c617ba6413bb
patch 8.2.0234: message test fails on SunOS
Bram Moolenaar <Bram@vim.org>
parents:
19119
diff
changeset
|
286 # define PREFIX_STR1 "" |
c617ba6413bb
patch 8.2.0234: message test fails on SunOS
Bram Moolenaar <Bram@vim.org>
parents:
19119
diff
changeset
|
287 # define PREFIX_STR2 "00" |
c617ba6413bb
patch 8.2.0234: message test fails on SunOS
Bram Moolenaar <Bram@vim.org>
parents:
19119
diff
changeset
|
288 #else |
c617ba6413bb
patch 8.2.0234: message test fails on SunOS
Bram Moolenaar <Bram@vim.org>
parents:
19119
diff
changeset
|
289 # define PREFIX_LEN 2 |
c617ba6413bb
patch 8.2.0234: message test fails on SunOS
Bram Moolenaar <Bram@vim.org>
parents:
19119
diff
changeset
|
290 # define PREFIX_STR1 "0x" |
c617ba6413bb
patch 8.2.0234: message test fails on SunOS
Bram Moolenaar <Bram@vim.org>
parents:
19119
diff
changeset
|
291 # define PREFIX_STR2 "0x" |
c617ba6413bb
patch 8.2.0234: message test fails on SunOS
Bram Moolenaar <Bram@vim.org>
parents:
19119
diff
changeset
|
292 #endif |
19011
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
293 n = vim_snprintf(buf, bsize, "%p", ptr); |
19352
c617ba6413bb
patch 8.2.0234: message test fails on SunOS
Bram Moolenaar <Bram@vim.org>
parents:
19119
diff
changeset
|
294 assert(n == 8 + PREFIX_LEN); |
c617ba6413bb
patch 8.2.0234: message test fails on SunOS
Bram Moolenaar <Bram@vim.org>
parents:
19119
diff
changeset
|
295 assert(bsize == 0 |
c617ba6413bb
patch 8.2.0234: message test fails on SunOS
Bram Moolenaar <Bram@vim.org>
parents:
19119
diff
changeset
|
296 || STRNCMP(buf, PREFIX_STR1 "87654321", bsize_int) == 0); |
19011
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
297 assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
298 |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
299 n = vim_snprintf(buf, bsize, fmt_012p, ptr); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
300 assert(n == 12); |
19352
c617ba6413bb
patch 8.2.0234: message test fails on SunOS
Bram Moolenaar <Bram@vim.org>
parents:
19119
diff
changeset
|
301 assert(bsize == 0 |
c617ba6413bb
patch 8.2.0234: message test fails on SunOS
Bram Moolenaar <Bram@vim.org>
parents:
19119
diff
changeset
|
302 || STRNCMP(buf, PREFIX_STR2 "0087654321", bsize_int) == 0); |
19011
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
303 assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
304 |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
305 free(buf); |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
306 } |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
307 } |
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
308 |
9542
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
309 int |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
310 main(int argc, char **argv) |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
311 { |
20007
aadd1cae2ff5
patch 8.2.0559: clearing a struct is verbose
Bram Moolenaar <Bram@vim.org>
parents:
19352
diff
changeset
|
312 CLEAR_FIELD(params); |
9542
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
313 params.argc = argc; |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
314 params.argv = argv; |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
315 common_init(¶ms); |
18999
6fb11e7fb9cd
patch 8.2.0060: message test only runs with one encoding
Bram Moolenaar <Bram@vim.org>
parents:
18931
diff
changeset
|
316 |
6fb11e7fb9cd
patch 8.2.0060: message test only runs with one encoding
Bram Moolenaar <Bram@vim.org>
parents:
18931
diff
changeset
|
317 set_option_value((char_u *)"encoding", 0, (char_u *)"utf-8", 0); |
9542
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
318 init_chartab(); |
18999
6fb11e7fb9cd
patch 8.2.0060: message test only runs with one encoding
Bram Moolenaar <Bram@vim.org>
parents:
18931
diff
changeset
|
319 test_trunc_string(); |
24709
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
23946
diff
changeset
|
320 test_trunc_string_mbyte(); |
19011
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
321 test_vim_snprintf(); |
9542
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
322 |
18999
6fb11e7fb9cd
patch 8.2.0060: message test only runs with one encoding
Bram Moolenaar <Bram@vim.org>
parents:
18931
diff
changeset
|
323 set_option_value((char_u *)"encoding", 0, (char_u *)"latin1", 0); |
6fb11e7fb9cd
patch 8.2.0060: message test only runs with one encoding
Bram Moolenaar <Bram@vim.org>
parents:
18931
diff
changeset
|
324 init_chartab(); |
9542
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
325 test_trunc_string(); |
19011
61d94accf16f
patch 8.2.0066: some corners of vim_snprintf() are not tested
Bram Moolenaar <Bram@vim.org>
parents:
18999
diff
changeset
|
326 test_vim_snprintf(); |
18999
6fb11e7fb9cd
patch 8.2.0060: message test only runs with one encoding
Bram Moolenaar <Bram@vim.org>
parents:
18931
diff
changeset
|
327 |
9542
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
328 return 0; |
00ee8d8c2e0c
commit https://github.com/vim/vim/commit/502ae4ba63561c98ac69af26cd9883bfd18d225f
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
329 } |