Mercurial > vim
annotate src/kword_test.c @ 24557:7a4cc4d3a40a v8.2.2818
patch 8.2.2818: no jump added when opening terminal in current window
Commit: https://github.com/vim/vim/commit/aeed2a6359e9ca692e1397884c3678685132d360
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Apr 29 20:18:45 2021 +0200
patch 8.2.2818: no jump added when opening terminal in current window
Problem: No jump added to jumplist when opening terminal in current window.
Solution: Call setpcmark(). (closes https://github.com/vim/vim/issues/8158)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 29 Apr 2021 20:30:04 +0200 |
parents | aadd1cae2ff5 |
children |
rev | line source |
---|---|
10724
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 /* vi:set ts=8 sts=4 sw=4 noet: |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 * |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 * VIM - Vi IMproved by Bram Moolenaar |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 * |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 * Do ":help uganda" in Vim to read copying and usage conditions. |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 * Do ":help credits" in Vim to see a list of people who contributed. |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 * See README.txt for an overview of the Vim source code. |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 */ |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 /* |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 * kword_test.c: Unittests for vim_iswordc() and vim_iswordp(). |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 */ |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 #undef NDEBUG |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 #include <assert.h> |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 |
18800
f41b55f9357c
patch 8.1.2388: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
15597
diff
changeset
|
17 // Must include main.c because it contains much more than just main() |
10724
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 #define NO_VIM_MAIN |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 #include "main.c" |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 |
18800
f41b55f9357c
patch 8.1.2388: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
15597
diff
changeset
|
21 // This file has to be included because the tested functions are static |
10724
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 #include "charset.c" |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 /* |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 * Test the results of vim_iswordc() and vim_iswordp() are matched. |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 */ |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 static void |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 test_isword_funcs_utf8(void) |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 { |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 buf_T buf; |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 int c; |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 |
20007
aadd1cae2ff5
patch 8.2.0559: clearing a struct is verbose
Bram Moolenaar <Bram@vim.org>
parents:
18991
diff
changeset
|
33 CLEAR_FIELD(buf); |
10724
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 p_enc = (char_u *)"utf-8"; |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 p_isi = (char_u *)""; |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 p_isp = (char_u *)""; |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 p_isf = (char_u *)""; |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 buf.b_p_isk = (char_u *)"@,48-57,_,128-167,224-235"; |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 curbuf = &buf; |
18800
f41b55f9357c
patch 8.1.2388: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
15597
diff
changeset
|
41 mb_init(); // calls init_chartab() |
10724
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 for (c = 0; c < 0x10000; ++c) |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 { |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 char_u p[4] = {0}; |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 int c1; |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 int retc; |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 int retp; |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 utf_char2bytes(c, p); |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 c1 = utf_ptr2char(p); |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 if (c != c1) |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 { |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 fprintf(stderr, "Failed: "); |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 fprintf(stderr, |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 "[c = %#04x, p = {%#02x, %#02x, %#02x}] ", |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 c, p[0], p[1], p[2]); |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 fprintf(stderr, "c != utf_ptr2char(p) (=%#04x)\n", c1); |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 abort(); |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 } |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
61 retc = vim_iswordc_buf(c, &buf); |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
62 retp = vim_iswordp_buf(p, &buf); |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
63 if (retc != retp) |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
64 { |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 fprintf(stderr, "Failed: "); |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
66 fprintf(stderr, |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
67 "[c = %#04x, p = {%#02x, %#02x, %#02x}] ", |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
68 c, p[0], p[1], p[2]); |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
69 fprintf(stderr, "vim_iswordc(c) (=%d) != vim_iswordp(p) (=%d)\n", |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
70 retc, retp); |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
71 abort(); |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
72 } |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
73 } |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
74 } |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
75 |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
76 int |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
77 main(void) |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
78 { |
18991
847cc7932c42
patch 8.2.0056: execution stack is incomplete and inefficient
Bram Moolenaar <Bram@vim.org>
parents:
18800
diff
changeset
|
79 estack_init(); |
10724
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
80 test_isword_funcs_utf8(); |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
81 return 0; |
ae1c6bf22e5f
patch 8.0.0252: not properly recognizing word characters between 128 and 255
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
82 } |