Mercurial > vim
annotate src/testdir/test_goto.vim @ 24059:24887299c5ff v8.2.2571
patch 8.2.2571: test may leave file behind
Commit: https://github.com/vim/vim/commit/8c801b374b7d32419cd877353495b801c5e1382a
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Mar 5 20:58:22 2021 +0100
patch 8.2.2571: test may leave file behind
Problem: Test may leave file behind.
Solution: Delete the temporary file. Don't profile in the running Vim
instance.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 05 Mar 2021 21:00:04 +0100 |
parents | 1503ecd54f8a |
children | dbec60b8c253 |
rev | line source |
---|---|
8925
f0d7dfb136bc
commit https://github.com/vim/vim/commit/f9660b59b2bdaa3ec2e7b31ab52186ad8b99f047
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Test commands that jump somewhere. |
f0d7dfb136bc
commit https://github.com/vim/vim/commit/f9660b59b2bdaa3ec2e7b31ab52186ad8b99f047
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
10251
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
3 " Create a new buffer using "lines" and place the cursor on the word after the |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
4 " first occurrence of return and invoke "cmd". The cursor should now be |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
5 " positioned at the given line and col. |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
6 func XTest_goto_decl(cmd, lines, line, col) |
8925
f0d7dfb136bc
commit https://github.com/vim/vim/commit/f9660b59b2bdaa3ec2e7b31ab52186ad8b99f047
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 new |
10251
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
8 call setline(1, a:lines) |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
9 /return/ |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
10 normal! W |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
11 execute 'norm! ' . a:cmd |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
12 call assert_equal(a:line, line('.')) |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
13 call assert_equal(a:col, col('.')) |
8925
f0d7dfb136bc
commit https://github.com/vim/vim/commit/f9660b59b2bdaa3ec2e7b31ab52186ad8b99f047
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 quit! |
f0d7dfb136bc
commit https://github.com/vim/vim/commit/f9660b59b2bdaa3ec2e7b31ab52186ad8b99f047
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 endfunc |
9315
1b4946fa3777
commit https://github.com/vim/vim/commit/23c60f21b07b04351d846e6fbf4f4abd9aa09345
Christian Brabandt <cb@256bit.org>
parents:
8925
diff
changeset
|
16 |
10251
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
17 func Test_gD() |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
18 let lines =<< trim [CODE] |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
19 int x; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
20 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
21 int func(void) |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
22 { |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
23 return x; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
24 } |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
25 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
26 |
10251
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
27 call XTest_goto_decl('gD', lines, 1, 5) |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
28 endfunc |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
29 |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
30 func Test_gD_too() |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
31 let lines =<< trim [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
32 Filename x; |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
33 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
34 int Filename |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
35 int func() { |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
36 Filename x; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
37 return x; |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
38 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
39 |
10251
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
40 call XTest_goto_decl('gD', lines, 1, 10) |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
41 endfunc |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
42 |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
43 func Test_gD_comment() |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
44 let lines =<< trim [CODE] |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
45 /* int x; */ |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
46 int x; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
47 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
48 int func(void) |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
49 { |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
50 return x; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
51 } |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
52 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
53 |
10251
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
54 call XTest_goto_decl('gD', lines, 2, 5) |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
55 endfunc |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
56 |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
57 func Test_gD_inline_comment() |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
58 let lines =<< trim [CODE] |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
59 int y /* , x */; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
60 int x; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
61 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
62 int func(void) |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
63 { |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
64 return x; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
65 } |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
66 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
67 |
10251
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
68 call XTest_goto_decl('gD', lines, 2, 5) |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
69 endfunc |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
70 |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
71 func Test_gD_string() |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
72 let lines =<< trim [CODE] |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
73 char *s[] = "x"; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
74 int x = 1; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
75 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
76 int func(void) |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
77 { |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
78 return x; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
79 } |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
80 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
81 |
10251
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
82 call XTest_goto_decl('gD', lines, 2, 5) |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
83 endfunc |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
84 |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
85 func Test_gD_string_same_line() |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
86 let lines =<< trim [CODE] |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
87 char *s[] = "x", int x = 1; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
88 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
89 int func(void) |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
90 { |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
91 return x; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
92 } |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
93 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
94 |
10251
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
95 call XTest_goto_decl('gD', lines, 1, 22) |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
96 endfunc |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
97 |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
98 func Test_gD_char() |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
99 let lines =<< trim [CODE] |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
100 char c = 'x'; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
101 int x = 1; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
102 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
103 int func(void) |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
104 { |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
105 return x; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
106 } |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
107 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
108 |
10251
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
109 call XTest_goto_decl('gD', lines, 2, 5) |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
110 endfunc |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
111 |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
112 func Test_gd() |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
113 let lines =<< trim [CODE] |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
114 int x; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
115 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
116 int func(int x) |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
117 { |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
118 return x; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
119 } |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
120 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
121 |
10251
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
122 call XTest_goto_decl('gd', lines, 3, 14) |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
123 endfunc |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
124 |
22502
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20199
diff
changeset
|
125 " Using gd to jump to a declaration in a fold |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20199
diff
changeset
|
126 func Test_gd_with_fold() |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20199
diff
changeset
|
127 new |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20199
diff
changeset
|
128 let lines =<< trim END |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20199
diff
changeset
|
129 #define ONE 1 |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20199
diff
changeset
|
130 #define TWO 2 |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20199
diff
changeset
|
131 #define THREE 3 |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20199
diff
changeset
|
132 |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20199
diff
changeset
|
133 TWO |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20199
diff
changeset
|
134 END |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20199
diff
changeset
|
135 call setline(1, lines) |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20199
diff
changeset
|
136 1,3fold |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20199
diff
changeset
|
137 call feedkeys('Ggd', 'xt') |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20199
diff
changeset
|
138 call assert_equal(2, line('.')) |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20199
diff
changeset
|
139 call assert_equal(-1, foldclosedend(2)) |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20199
diff
changeset
|
140 bw! |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20199
diff
changeset
|
141 endfunc |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20199
diff
changeset
|
142 |
10251
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
143 func Test_gd_not_local() |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
144 let lines =<< trim [CODE] |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
145 int func1(void) |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
146 { |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
147 return x; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
148 } |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
149 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
150 int func2(int x) |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
151 { |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
152 return x; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
153 } |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
154 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
155 |
10251
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
156 call XTest_goto_decl('gd', lines, 3, 10) |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
157 endfunc |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
158 |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
159 func Test_gd_kr_style() |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
160 let lines =<< trim [CODE] |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
161 int func(x) |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
162 int x; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
163 { |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
164 return x; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
165 } |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
166 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
167 |
10251
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
168 call XTest_goto_decl('gd', lines, 2, 7) |
9315
1b4946fa3777
commit https://github.com/vim/vim/commit/23c60f21b07b04351d846e6fbf4f4abd9aa09345
Christian Brabandt <cb@256bit.org>
parents:
8925
diff
changeset
|
169 endfunc |
10251
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
170 |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
171 func Test_gd_missing_braces() |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
172 let lines =<< trim [CODE] |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
173 def func1(a) |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
174 a + 1 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
175 end |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
176 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
177 a = 1 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
178 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
179 def func2() |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
180 return a |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
181 end |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
182 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
183 |
10251
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
184 call XTest_goto_decl('gd', lines, 1, 11) |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
185 endfunc |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
186 |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
187 func Test_gd_comment() |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
188 let lines =<< trim [CODE] |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
189 int func(void) |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
190 { |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
191 /* int x; */ |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
192 int x; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
193 return x; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
194 } |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
195 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
196 |
10251
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
197 call XTest_goto_decl('gd', lines, 4, 7) |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
198 endfunc |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
199 |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
200 func Test_gd_comment_in_string() |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
201 let lines =<< trim [CODE] |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
202 int func(void) |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
203 { |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
204 char *s ="//"; int x; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
205 int x; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
206 return x; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
207 } |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
208 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
209 |
10251
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
210 call XTest_goto_decl('gd', lines, 3, 22) |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
211 endfunc |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
212 |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
213 func Test_gd_string_in_comment() |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
214 set comments= |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
215 let lines =<< trim [CODE] |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
216 int func(void) |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
217 { |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
218 /* " */ int x; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
219 int x; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
220 return x; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
221 } |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
222 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
223 |
10251
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
224 call XTest_goto_decl('gd', lines, 3, 15) |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
225 set comments& |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
226 endfunc |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
227 |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
228 func Test_gd_inline_comment() |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
229 let lines =<< trim [CODE] |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
230 int func(/* x is an int */ int x) |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
231 { |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
232 return x; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
233 } |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
234 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
235 |
10251
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
236 call XTest_goto_decl('gd', lines, 1, 32) |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
237 endfunc |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
238 |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
239 func Test_gd_inline_comment_only() |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
240 let lines =<< trim [CODE] |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
241 int func(void) /* one lonely x */ |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
242 { |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
243 return x; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
244 } |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
245 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
246 |
10251
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
247 call XTest_goto_decl('gd', lines, 3, 10) |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
248 endfunc |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
249 |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
250 func Test_gd_inline_comment_body() |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
251 let lines =<< trim [CODE] |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
252 int func(void) |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
253 { |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
254 int y /* , x */; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
255 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
256 for (/* int x = 0 */; y < 2; y++); |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
257 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
258 int x = 0; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
259 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
260 return x; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
261 } |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
262 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
263 |
10251
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
264 call XTest_goto_decl('gd', lines, 7, 7) |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
265 endfunc |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
266 |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
267 func Test_gd_trailing_multiline_comment() |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
268 let lines =<< trim [CODE] |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
269 int func(int x) /* x is an int */ |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
270 { |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
271 return x; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
272 } |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
273 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
274 |
10251
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
275 call XTest_goto_decl('gd', lines, 1, 14) |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
276 endfunc |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
277 |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
278 func Test_gd_trailing_comment() |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
279 let lines =<< trim [CODE] |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
280 int func(int x) // x is an int |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
281 { |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
282 return x; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
283 } |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
284 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
285 |
10251
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
286 call XTest_goto_decl('gd', lines, 1, 14) |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
287 endfunc |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
288 |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
289 func Test_gd_string() |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
290 let lines =<< trim [CODE] |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
291 int func(void) |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
292 { |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
293 char *s = "x"; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
294 int x = 1; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
295 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
296 return x; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
297 } |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
298 [CODE] |
10251
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
299 call XTest_goto_decl('gd', lines, 4, 7) |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
300 endfunc |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
301 |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
302 func Test_gd_string_only() |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
303 let lines =<< trim [CODE] |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
304 int func(void) |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
305 { |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
306 char *s = "x"; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
307 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
308 return x; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
309 } |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
310 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
311 |
10251
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
312 call XTest_goto_decl('gd', lines, 5, 10) |
bc442c2296a7
commit https://github.com/vim/vim/commit/226630a030c0d41145e1109f09633360fc9c999d
Christian Brabandt <cb@256bit.org>
parents:
9315
diff
changeset
|
313 endfunc |
10456
536a7d49249c
commit https://github.com/vim/vim/commit/a2477fd3490c1166522631eee53c57d34321086a
Christian Brabandt <cb@256bit.org>
parents:
10255
diff
changeset
|
314 |
536a7d49249c
commit https://github.com/vim/vim/commit/a2477fd3490c1166522631eee53c57d34321086a
Christian Brabandt <cb@256bit.org>
parents:
10255
diff
changeset
|
315 " Check that setting 'cursorline' does not change curswant |
536a7d49249c
commit https://github.com/vim/vim/commit/a2477fd3490c1166522631eee53c57d34321086a
Christian Brabandt <cb@256bit.org>
parents:
10255
diff
changeset
|
316 func Test_cursorline_keep_col() |
536a7d49249c
commit https://github.com/vim/vim/commit/a2477fd3490c1166522631eee53c57d34321086a
Christian Brabandt <cb@256bit.org>
parents:
10255
diff
changeset
|
317 new |
536a7d49249c
commit https://github.com/vim/vim/commit/a2477fd3490c1166522631eee53c57d34321086a
Christian Brabandt <cb@256bit.org>
parents:
10255
diff
changeset
|
318 call setline(1, ['long long long line', 'short line']) |
536a7d49249c
commit https://github.com/vim/vim/commit/a2477fd3490c1166522631eee53c57d34321086a
Christian Brabandt <cb@256bit.org>
parents:
10255
diff
changeset
|
319 normal ggfi |
536a7d49249c
commit https://github.com/vim/vim/commit/a2477fd3490c1166522631eee53c57d34321086a
Christian Brabandt <cb@256bit.org>
parents:
10255
diff
changeset
|
320 let pos = getcurpos() |
536a7d49249c
commit https://github.com/vim/vim/commit/a2477fd3490c1166522631eee53c57d34321086a
Christian Brabandt <cb@256bit.org>
parents:
10255
diff
changeset
|
321 normal j |
536a7d49249c
commit https://github.com/vim/vim/commit/a2477fd3490c1166522631eee53c57d34321086a
Christian Brabandt <cb@256bit.org>
parents:
10255
diff
changeset
|
322 set cursorline |
536a7d49249c
commit https://github.com/vim/vim/commit/a2477fd3490c1166522631eee53c57d34321086a
Christian Brabandt <cb@256bit.org>
parents:
10255
diff
changeset
|
323 normal k |
536a7d49249c
commit https://github.com/vim/vim/commit/a2477fd3490c1166522631eee53c57d34321086a
Christian Brabandt <cb@256bit.org>
parents:
10255
diff
changeset
|
324 call assert_equal(pos, getcurpos()) |
536a7d49249c
commit https://github.com/vim/vim/commit/a2477fd3490c1166522631eee53c57d34321086a
Christian Brabandt <cb@256bit.org>
parents:
10255
diff
changeset
|
325 bwipe! |
536a7d49249c
commit https://github.com/vim/vim/commit/a2477fd3490c1166522631eee53c57d34321086a
Christian Brabandt <cb@256bit.org>
parents:
10255
diff
changeset
|
326 set nocursorline |
536a7d49249c
commit https://github.com/vim/vim/commit/a2477fd3490c1166522631eee53c57d34321086a
Christian Brabandt <cb@256bit.org>
parents:
10255
diff
changeset
|
327 endfunc |
536a7d49249c
commit https://github.com/vim/vim/commit/a2477fd3490c1166522631eee53c57d34321086a
Christian Brabandt <cb@256bit.org>
parents:
10255
diff
changeset
|
328 |
11366
b16bc115a270
patch 8.0.0568: 1gd may hang
Christian Brabandt <cb@256bit.org>
parents:
10456
diff
changeset
|
329 func Test_gd_local_block() |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
330 let lines =<< trim [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
331 int main() |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
332 { |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
333 char *a = "NOT NULL"; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
334 if(a) |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
335 { |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
336 char *b = a; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
337 printf("%s\n", b); |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
338 } |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
339 else |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
340 { |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
341 char *b = "NULL"; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
342 return b; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
343 } |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
344 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
345 return 0; |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
346 } |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
347 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
14013
diff
changeset
|
348 |
11366
b16bc115a270
patch 8.0.0568: 1gd may hang
Christian Brabandt <cb@256bit.org>
parents:
10456
diff
changeset
|
349 call XTest_goto_decl('1gd', lines, 11, 11) |
b16bc115a270
patch 8.0.0568: 1gd may hang
Christian Brabandt <cb@256bit.org>
parents:
10456
diff
changeset
|
350 endfunc |
14013
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
351 |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
352 func Test_motion_if_elif_else_endif() |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
353 new |
20199
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
354 let lines =<< trim END |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
355 /* Test pressing % on #if, #else #elsif and #endif, |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
356 * with nested #if |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
357 */ |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
358 #if FOO |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
359 /* ... */ |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
360 # if BAR |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
361 /* ... */ |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
362 # endif |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
363 #elif BAR |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
364 /* ... */ |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
365 #else |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
366 /* ... */ |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
367 #endif |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
368 |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
369 #define FOO 1 |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
370 END |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
371 call setline(1, lines) |
14013
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
372 /#if FOO |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
373 norm % |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
374 call assert_equal([9, 1], getpos('.')[1:2]) |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
375 norm % |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
376 call assert_equal([11, 1], getpos('.')[1:2]) |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
377 norm % |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
378 call assert_equal([13, 1], getpos('.')[1:2]) |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
379 norm % |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
380 call assert_equal([4, 1], getpos('.')[1:2]) |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
381 /# if BAR |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
382 norm $% |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
383 call assert_equal([8, 1], getpos('.')[1:2]) |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
384 norm $% |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
385 call assert_equal([6, 1], getpos('.')[1:2]) |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
386 |
20199
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
387 " Test for [# and ]# command |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
388 call cursor(5, 1) |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
389 normal [# |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
390 call assert_equal([4, 1], getpos('.')[1:2]) |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
391 call cursor(5, 1) |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
392 normal ]# |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
393 call assert_equal([9, 1], getpos('.')[1:2]) |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
394 call cursor(10, 1) |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
395 normal [# |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
396 call assert_equal([9, 1], getpos('.')[1:2]) |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
397 call cursor(10, 1) |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
398 normal ]# |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
399 call assert_equal([11, 1], getpos('.')[1:2]) |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
400 |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
401 " Finding a match before the first line or after the last line should fail |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
402 normal gg |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
403 call assert_beeps('normal [#') |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
404 normal G |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
405 call assert_beeps('normal ]#') |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
406 |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
407 " Finding a match for a macro definition (#define) should fail |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
408 normal G |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
409 call assert_beeps('normal %') |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
410 |
14013
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
411 bw! |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
412 endfunc |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
413 |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
414 func Test_motion_c_comment() |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
415 new |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
416 a |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
417 /* |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
418 * Test pressing % on beginning/end |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
419 * of C comments. |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
420 */ |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
421 /* Another comment */ |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
422 . |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
423 norm gg0% |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
424 call assert_equal([4, 3], getpos('.')[1:2]) |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
425 norm % |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
426 call assert_equal([1, 1], getpos('.')[1:2]) |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
427 norm gg0l% |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
428 call assert_equal([4, 3], getpos('.')[1:2]) |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
429 norm h% |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
430 call assert_equal([1, 1], getpos('.')[1:2]) |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
431 |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
432 norm G^ |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
433 norm % |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
434 call assert_equal([5, 21], getpos('.')[1:2]) |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
435 norm % |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
436 call assert_equal([5, 1], getpos('.')[1:2]) |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
437 |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
438 bw! |
a04738ab7670
patch 8.1.0024: % command not testded on #ifdef and comment
Christian Brabandt <cb@256bit.org>
parents:
11366
diff
changeset
|
439 endfunc |
20199
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
440 |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
441 " vim: shiftwidth=2 sts=2 expandtab |