Mercurial > vim
annotate src/testdir/test_comments.vim @ 27678:1646525507aa v8.2.4365
patch 8.2.4365: sticky command modifiers are too sticky
Commit: https://github.com/vim/vim/commit/cdf04859699bdde891b5b52ea821d0bebd7e8ee0
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Feb 12 22:13:06 2022 +0000
patch 8.2.4365: sticky command modifiers are too sticky
Problem: sticky command modifiers are too sticky.
Solution: Do not apply command modifiers to a called function. (closes https://github.com/vim/vim/issues/9751)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 12 Feb 2022 23:15:03 +0100 |
parents | 55b3849ded11 |
children | 1fa23ccd6d9a |
rev | line source |
---|---|
20990
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1 " Tests for the various flags in the 'comments' option |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2 |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3 " Test for the 'n' flag in 'comments' |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4 func Test_comment_nested() |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
5 new |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
6 setlocal comments=n:> fo+=ro |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
7 exe "normal i> B\nD\<C-C>ggOA\<C-C>joC\<C-C>Go\<BS>>>> F\nH" |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
8 exe "normal 5GOE\<C-C>6GoG" |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
9 let expected =<< trim END |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
10 > A |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
11 > B |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
12 > C |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
13 > D |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
14 >>>> E |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
15 >>>> F |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
16 >>>> G |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
17 >>>> H |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
18 END |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
19 call assert_equal(expected, getline(1, '$')) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
20 close! |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
21 endfunc |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
22 |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
23 " Test for the 'b' flag in 'comments' |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
24 func Test_comment_blank() |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
25 new |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
26 setlocal comments=b:* fo+=ro |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
27 exe "normal i* E\nF\n\<BS>G\nH\<C-C>ggOC\<C-C>O\<BS>B\<C-C>OA\<C-C>2joD" |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
28 let expected =<< trim END |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
29 A |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
30 *B |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
31 * C |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
32 * D |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
33 * E |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
34 * F |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
35 *G |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
36 H |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
37 END |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
38 call assert_equal(expected, getline(1, '$')) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
39 close! |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
40 endfunc |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
41 |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
42 " Test for the 'f' flag in 'comments' (only the first line has a comment |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
43 " string) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
44 func Test_comment_firstline() |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
45 new |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
46 setlocal comments=f:- fo+=ro |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
47 exe "normal i- B\nD\<C-C>ggoC\<C-C>ggOA\<C-C>" |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
48 call assert_equal(['A', '- B', ' C', ' D'], getline(1, '$')) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
49 %d |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
50 setlocal comments=:- |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
51 exe "normal i- B\nD\<C-C>ggoC\<C-C>ggOA\<C-C>" |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
52 call assert_equal(['- A', '- B', '- C', '- D'], getline(1, '$')) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
53 close! |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
54 endfunc |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
55 |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
56 " Test for the 's', 'm' and 'e' flags in 'comments' |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
57 " Test for automatically adding comment leaders in insert mode |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
58 func Test_comment_threepiece() |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
59 new |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
60 setlocal expandtab |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
61 call setline(1, ["\t/*"]) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
62 setlocal formatoptions=croql |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
63 call cursor(1, 3) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
64 call feedkeys("A\<cr>\<cr>/", 'tnix') |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
65 call assert_equal(["\t/*", " *", " */"], getline(1, '$')) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
66 |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
67 " If a comment ends in a single line, then don't add it in the next line |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
68 %d |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
69 call setline(1, '/* line1 */') |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
70 call feedkeys("A\<CR>next line", 'xt') |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
71 call assert_equal(['/* line1 */', 'next line'], getline(1, '$')) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
72 |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
73 %d |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
74 " Copy the trailing indentation from the leader comment to a new line |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
75 setlocal autoindent noexpandtab |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
76 call feedkeys("a\t/*\tone\ntwo\n/", 'xt') |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
77 call assert_equal(["\t/*\tone", "\t *\ttwo", "\t */"], getline(1, '$')) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
78 close! |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
79 endfunc |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
80 |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
81 " Test for the 'r' flag in 'comments' (right align comment) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
82 func Test_comment_rightalign() |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
83 new |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
84 setlocal comments=sr:/***,m:**,ex-2:******/ fo+=ro |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
85 exe "normal i=\<C-C>o\t /***\nD\n/" |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
86 exe "normal 2GOA\<C-C>joB\<C-C>jOC\<C-C>joE\<C-C>GOF\<C-C>joG" |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
87 let expected =<< trim END |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
88 = |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
89 A |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
90 /*** |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
91 ** B |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
92 ** C |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
93 ** D |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
94 ** E |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
95 ** F |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
96 ******/ |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
97 G |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
98 END |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
99 call assert_equal(expected, getline(1, '$')) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
100 close! |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
101 endfunc |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
102 |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
103 " Test for the 'O' flag in 'comments' |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
104 func Test_comment_O() |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
105 new |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
106 setlocal comments=Ob:* fo+=ro |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
107 exe "normal i* B\nD\<C-C>kOA\<C-C>joC" |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
108 let expected =<< trim END |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
109 A |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
110 * B |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
111 * C |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
112 * D |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
113 END |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
114 call assert_equal(expected, getline(1, '$')) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
115 close! |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
116 endfunc |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
117 |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
118 " Test for using a multibyte character as a comment leader |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
119 func Test_comment_multibyte_leader() |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
120 new |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
121 let t =<< trim END |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
122 { |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
123 X |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
124 Xa |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
125 XaY |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
126 XY |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
127 XYZ |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
128 X Y |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
129 X YZ |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
130 XX |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
131 XXa |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
132 XXY |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
133 } |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
134 END |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
135 call setline(1, t) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
136 call cursor(2, 1) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
137 |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
138 set tw=2 fo=cqm comments=n:X |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
139 exe "normal gqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgq" |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
140 let t =<< trim END |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
141 X |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
142 Xa |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
143 XaY |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
144 XY |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
145 XYZ |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
146 X Y |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
147 X YZ |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
148 XX |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
149 XXa |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
150 XXY |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
151 END |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
152 exe "normal o\n" . join(t, "\n") |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
153 |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
154 let expected =<< trim END |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
155 { |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
156 X |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
157 Xa |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
158 Xa |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
159 XY |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
160 XY |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
161 XY |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
162 XZ |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
163 X Y |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
164 X Y |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
165 X Z |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
166 XX |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
167 XXa |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
168 XXY |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
169 |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
170 X |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
171 Xa |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
172 Xa |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
173 XY |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
174 XY |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
175 XY |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
176 XZ |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
177 X Y |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
178 X Y |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
179 X Z |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
180 XX |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
181 XXa |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
182 XXY |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
183 } |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
184 END |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
185 call assert_equal(expected, getline(1, '$')) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
186 |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
187 set tw& fo& comments& |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
188 close! |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
189 endfunc |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
190 |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
191 " Test for a space character in 'comments' setting |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
192 func Test_comment_space() |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
193 new |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
194 setlocal comments=b:\ > fo+=ro |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
195 exe "normal i> B\nD\<C-C>ggOA\<C-C>joC" |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
196 exe "normal Go > F\nH\<C-C>kOE\<C-C>joG" |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
197 let expected =<< trim END |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
198 A |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
199 > B |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
200 C |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
201 D |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
202 > E |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
203 > F |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
204 > G |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
205 > H |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
206 END |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
207 call assert_equal(expected, getline(1, '$')) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
208 close! |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
209 endfunc |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
210 |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
211 " Test for formatting lines with and without comments |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
212 func Test_comment_format_lines() |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
213 new |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
214 call setline(1, ['one', '/* two */', 'three']) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
215 normal gggqG |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
216 call assert_equal(['one', '/* two */', 'three'], getline(1, '$')) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
217 close! |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
218 endfunc |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
219 |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
220 " Test for using 'a' in 'formatoptions' with comments |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
221 func Test_comment_autoformat() |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
222 new |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
223 setlocal formatoptions+=a |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
224 call feedkeys("a- one\n- two\n", 'xt') |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
225 call assert_equal(['- one', '- two', ''], getline(1, '$')) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
226 |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
227 %d |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
228 call feedkeys("a\none\n", 'xt') |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
229 call assert_equal(['', 'one', ''], getline(1, '$')) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
230 |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
231 setlocal formatoptions+=aw |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
232 %d |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
233 call feedkeys("aone \ntwo\n", 'xt') |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
234 call assert_equal(['one two', ''], getline(1, '$')) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
235 |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
236 %d |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
237 call feedkeys("aone\ntwo\n", 'xt') |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
238 call assert_equal(['one', 'two', ''], getline(1, '$')) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
239 |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
240 close! |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
241 endfunc |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
242 |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
243 " Test for joining lines with comments ('j' flag in 'formatoptions') |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
244 func Test_comment_join_lines_fo_j() |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
245 new |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
246 setlocal fo+=j comments=:// |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
247 call setline(1, ['i++; // comment1', ' // comment2']) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
248 normal J |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
249 call assert_equal('i++; // comment1 comment2', getline(1)) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
250 setlocal fo-=j |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
251 call setline(1, ['i++; // comment1', ' // comment2']) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
252 normal J |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
253 call assert_equal('i++; // comment1 // comment2', getline(1)) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
254 " Test with nested comments |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
255 setlocal fo+=j comments=n:>,n:) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
256 call setline(1, ['i++; > ) > ) comment1', ' > ) comment2']) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
257 normal J |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
258 call assert_equal('i++; > ) > ) comment1 comment2', getline(1)) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
259 close! |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
260 endfunc |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
261 |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
262 " Test for formatting lines where only the first line has a comment. |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
263 func Test_comment_format_firstline_comment() |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
264 new |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
265 setlocal formatoptions=tcq |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
266 call setline(1, ['- one two', 'three']) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
267 normal gggqG |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
268 call assert_equal(['- one two three'], getline(1, '$')) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
269 |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
270 %d |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
271 call setline(1, ['- one', '- two']) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
272 normal gggqG |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
273 call assert_equal(['- one', '- two'], getline(1, '$')) |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
274 close! |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
275 endfunc |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
276 |
55b3849ded11
patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
277 " vim: shiftwidth=2 sts=2 expandtab |