annotate src/testdir/test_join.vim @ 16658:f776ce5d4ed8 v8.1.1331

patch 8.1.1331: test 29 is old style commit https://github.com/vim/vim/commit/fb222df28d5158516104a21cba7141a6240f4817 Author: Bram Moolenaar <Bram@vim.org> Date: Tue May 14 17:57:19 2019 +0200 patch 8.1.1331: test 29 is old style Problem: Test 29 is old style. Solution: Turn it into a new style test. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/4370)
author Bram Moolenaar <Bram@vim.org>
date Tue, 14 May 2019 18:00:07 +0200
parents 15f0f9f16cd9
children 9c90cf08cfa8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8445
dd2e2bd69d0e commit https://github.com/vim/vim/commit/41e0f2f48f541eb2c8eb5620d3f1d270eb979154
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test for joining lines.
dd2e2bd69d0e commit https://github.com/vim/vim/commit/41e0f2f48f541eb2c8eb5620d3f1d270eb979154
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
dd2e2bd69d0e commit https://github.com/vim/vim/commit/41e0f2f48f541eb2c8eb5620d3f1d270eb979154
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 func Test_join_with_count()
dd2e2bd69d0e commit https://github.com/vim/vim/commit/41e0f2f48f541eb2c8eb5620d3f1d270eb979154
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 new
dd2e2bd69d0e commit https://github.com/vim/vim/commit/41e0f2f48f541eb2c8eb5620d3f1d270eb979154
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 call setline(1, ['one', 'two', 'three', 'four'])
dd2e2bd69d0e commit https://github.com/vim/vim/commit/41e0f2f48f541eb2c8eb5620d3f1d270eb979154
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 normal J
dd2e2bd69d0e commit https://github.com/vim/vim/commit/41e0f2f48f541eb2c8eb5620d3f1d270eb979154
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 call assert_equal('one two', getline(1))
dd2e2bd69d0e commit https://github.com/vim/vim/commit/41e0f2f48f541eb2c8eb5620d3f1d270eb979154
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 %del
dd2e2bd69d0e commit https://github.com/vim/vim/commit/41e0f2f48f541eb2c8eb5620d3f1d270eb979154
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 call setline(1, ['one', 'two', 'three', 'four'])
dd2e2bd69d0e commit https://github.com/vim/vim/commit/41e0f2f48f541eb2c8eb5620d3f1d270eb979154
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 normal 10J
dd2e2bd69d0e commit https://github.com/vim/vim/commit/41e0f2f48f541eb2c8eb5620d3f1d270eb979154
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 call assert_equal('one two three four', getline(1))
dd2e2bd69d0e commit https://github.com/vim/vim/commit/41e0f2f48f541eb2c8eb5620d3f1d270eb979154
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 quit!
dd2e2bd69d0e commit https://github.com/vim/vim/commit/41e0f2f48f541eb2c8eb5620d3f1d270eb979154
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 endfunc
12662
15f0f9f16cd9 patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 8445
diff changeset
14
15f0f9f16cd9 patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 8445
diff changeset
15 " Tests for setting the '[,'] marks when joining lines.
15f0f9f16cd9 patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 8445
diff changeset
16 func Test_join_marks()
15f0f9f16cd9 patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 8445
diff changeset
17 enew
15f0f9f16cd9 patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 8445
diff changeset
18 call append(0, [
15f0f9f16cd9 patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 8445
diff changeset
19 \ "\t\tO sodales, ludite, vos qui",
15f0f9f16cd9 patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 8445
diff changeset
20 \ "attamen consulite per voster honur. Tua pulchra " .
15f0f9f16cd9 patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 8445
diff changeset
21 \ "facies me fay planszer milies",
15f0f9f16cd9 patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 8445
diff changeset
22 \ "",
15f0f9f16cd9 patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 8445
diff changeset
23 \ "This line.",
15f0f9f16cd9 patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 8445
diff changeset
24 \ "Should be joined with the next line",
15f0f9f16cd9 patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 8445
diff changeset
25 \ "and with this line"])
15f0f9f16cd9 patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 8445
diff changeset
26
15f0f9f16cd9 patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 8445
diff changeset
27 normal gg0gqj
15f0f9f16cd9 patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 8445
diff changeset
28 call assert_equal([0, 1, 1, 0], getpos("'["))
15f0f9f16cd9 patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 8445
diff changeset
29 call assert_equal([0, 2, 1, 0], getpos("']"))
15f0f9f16cd9 patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 8445
diff changeset
30
15f0f9f16cd9 patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 8445
diff changeset
31 /^This line/;'}-join
15f0f9f16cd9 patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 8445
diff changeset
32 call assert_equal([0, 4, 11, 0], getpos("'["))
15f0f9f16cd9 patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 8445
diff changeset
33 call assert_equal([0, 4, 67, 0], getpos("']"))
15f0f9f16cd9 patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 8445
diff changeset
34 enew!
15f0f9f16cd9 patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 8445
diff changeset
35 endfunc
16658
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
36
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
37 " Test for joining lines and marks in them
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
38 " in compatible and nocompatible modes
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
39 " and with 'joinspaces' set or not
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
40 " and with 'cpoptions' flag 'j' set or not
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
41 func Test_join_spaces_marks()
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
42 new
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
43 " Text used for the test
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
44 insert
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
45 asdfasdf.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
46 asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
47 asdfasdf.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
48 asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
49 asdfasdf.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
50 asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
51 asdfasdf.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
52 asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
53 asdfasdf.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
54 asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
55 asdfasdf.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
56 asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
57 asdfasdf.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
58 asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
59 asdfasdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
60 asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
61 asdfasdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
62 asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
63 asdfasdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
64 asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
65 asdfasdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
66 asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
67 asdfasdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
68 asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
69 asdfasdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
70 asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
71 asdfasdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
72 asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
73 zx cvn.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
74 as dfg?
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
75 hjkl iop!
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
76 ert
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
77 zx cvn.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
78 as dfg?
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
79 hjkl iop!
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
80 ert
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
81 .
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
82 let text = getline(1, '$')
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
83 normal gg
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
84
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
85 set nojoinspaces
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
86 set cpoptions-=j
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
87 normal JjJjJjJjJjJjJjJjJjJjJjJjJjJ
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
88 normal j05lmx
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
89 normal 2j06lmy
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
90 normal 2k4Jy3l$p
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
91 normal `xyl$p
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
92 normal `yy2l$p
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
93
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
94 set cpoptions+=j
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
95 normal j05lmx
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
96 normal 2j06lmy
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
97 normal 2k4Jy3l$p
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
98 normal `xyl$p
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
99 normal `yy2l$p
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
100
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
101 normal G
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
102 let last_line = line('$')
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
103
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
104 " Expected output
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
105 append
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
106 asdfasdf. asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
107 asdfasdf. asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
108 asdfasdf. asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
109 asdfasdf. asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
110 asdfasdf. asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
111 asdfasdf. asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
112 asdfasdf. asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
113 asdfasdf asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
114 asdfasdf asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
115 asdfasdf asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
116 asdfasdf asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
117 asdfasdf asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
118 asdfasdf asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
119 asdfasdf asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
120 zx cvn. as dfg? hjkl iop! ert ernop
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
121 zx cvn. as dfg? hjkl iop! ert ernop
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
122 .
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
123
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
124 call assert_equal(getline(last_line + 1, '$'), getline(1, last_line))
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
125
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
126 enew!
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
127 call append(0, text)
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
128 normal gg
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
129
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
130 set cpoptions-=j
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
131 set joinspaces
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
132 normal JjJjJjJjJjJjJjJjJjJjJjJjJjJ
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
133 normal j05lmx
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
134 normal 2j06lmy
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
135 normal 2k4Jy3l$p
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
136 normal `xyl$p
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
137 normal `yy2l$p
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
138
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
139 set cpoptions+=j
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
140 normal j05lmx
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
141 normal 2j06lmy
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
142 normal 2k4Jy3l$p
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
143 normal `xyl$p
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
144 normal `yy2l$p
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
145
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
146 normal G
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
147 let last_line = line('$')
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
148
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
149 " Expected output
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
150 append
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
151 asdfasdf. asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
152 asdfasdf. asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
153 asdfasdf. asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
154 asdfasdf. asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
155 asdfasdf. asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
156 asdfasdf. asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
157 asdfasdf. asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
158 asdfasdf asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
159 asdfasdf asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
160 asdfasdf asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
161 asdfasdf asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
162 asdfasdf asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
163 asdfasdf asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
164 asdfasdf asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
165 zx cvn. as dfg? hjkl iop! ert enop
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
166 zx cvn. as dfg? hjkl iop! ert ernop
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
167
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
168 .
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
169
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
170 call assert_equal(getline(last_line + 1, '$'), getline(1, last_line))
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
171
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
172 enew!
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
173 call append(0, text)
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
174 normal gg
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
175
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
176 set cpoptions-=j
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
177 set nojoinspaces
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
178 set compatible
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
179
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
180 normal JjJjJjJjJjJjJjJjJjJjJjJjJjJ
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
181 normal j4Jy3l$pjdG
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
182
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
183 normal G
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
184 let last_line = line('$')
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
185
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
186 " Expected output
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
187 append
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
188 asdfasdf. asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
189 asdfasdf. asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
190 asdfasdf. asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
191 asdfasdf. asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
192 asdfasdf. asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
193 asdfasdf. asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
194 asdfasdf. asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
195 asdfasdf asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
196 asdfasdf asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
197 asdfasdf asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
198 asdfasdf asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
199 asdfasdf asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
200 asdfasdf asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
201 asdfasdf asdf
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
202 zx cvn. as dfg? hjkl iop! ert a
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
203 .
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
204
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
205 call assert_equal(getline(last_line + 1, '$'), getline(1, last_line))
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
206
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
207 set nocompatible
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
208 set cpoptions&vim
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
209 set joinspaces&vim
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
210 close!
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
211 endfunc
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
212
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
213 " Test for joining lines with comments
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
214 func Test_join_lines_with_comments()
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
215 new
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
216
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
217 " Text used by the test
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
218 insert
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
219 {
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
220
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
221 /*
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
222 * Make sure the previous comment leader is not removed.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
223 */
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
224
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
225 /*
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
226 * Make sure the previous comment leader is not removed.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
227 */
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
228
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
229 // Should the next comment leader be left alone?
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
230 // Yes.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
231
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
232 // Should the next comment leader be left alone?
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
233 // Yes.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
234
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
235 /* Here the comment leader should be left intact. */
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
236 // And so should this one.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
237
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
238 /* Here the comment leader should be left intact. */
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
239 // And so should this one.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
240
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
241 if (condition) // Remove the next comment leader!
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
242 // OK, I will.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
243 action();
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
244
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
245 if (condition) // Remove the next comment leader!
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
246 // OK, I will.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
247 action();
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
248 }
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
249 .
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
250
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
251 call cursor(2, 1)
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
252 set comments=s1:/*,mb:*,ex:*/,://
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
253 set nojoinspaces fo=j
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
254 set backspace=eol,start
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
255
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
256 .,+3join
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
257 exe "normal j4J\<CR>"
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
258 .,+2join
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
259 exe "normal j3J\<CR>"
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
260 .,+2join
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
261 exe "normal j3J\<CR>"
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
262 .,+2join
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
263 exe "normal jj3J\<CR>"
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
264
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
265 normal G
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
266 let last_line = line('$')
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
267
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
268 " Expected output
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
269 append
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
270 {
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
271 /* Make sure the previous comment leader is not removed. */
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
272 /* Make sure the previous comment leader is not removed. */
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
273 // Should the next comment leader be left alone? Yes.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
274 // Should the next comment leader be left alone? Yes.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
275 /* Here the comment leader should be left intact. */ // And so should this one.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
276 /* Here the comment leader should be left intact. */ // And so should this one.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
277 if (condition) // Remove the next comment leader! OK, I will.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
278 action();
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
279 if (condition) // Remove the next comment leader! OK, I will.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
280 action();
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
281 }
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
282 .
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
283
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
284 call assert_equal(getline(last_line + 1, '$'), getline(1, last_line))
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
285
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
286 set comments&vim
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
287 set joinspaces&vim
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
288 set fo&vim
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
289 set backspace&vim
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
290 close!
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
291 endfunc
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
292
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
293 " Test for joining lines with different comment leaders
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
294 func Test_join_comments_2()
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
295 new
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
296
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
297 insert
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
298 {
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
299
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
300 /*
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
301 * Make sure the previous comment leader is not removed.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
302 */
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
303
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
304 /*
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
305 * Make sure the previous comment leader is not removed.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
306 */
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
307
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
308 /* List:
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
309 * - item1
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
310 * foo bar baz
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
311 * foo bar baz
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
312 * - item2
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
313 * foo bar baz
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
314 * foo bar baz
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
315 */
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
316
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
317 /* List:
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
318 * - item1
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
319 * foo bar baz
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
320 * foo bar baz
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
321 * - item2
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
322 * foo bar baz
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
323 * foo bar baz
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
324 */
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
325
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
326 // Should the next comment leader be left alone?
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
327 // Yes.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
328
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
329 // Should the next comment leader be left alone?
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
330 // Yes.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
331
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
332 /* Here the comment leader should be left intact. */
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
333 // And so should this one.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
334
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
335 /* Here the comment leader should be left intact. */
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
336 // And so should this one.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
337
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
338 if (condition) // Remove the next comment leader!
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
339 // OK, I will.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
340 action();
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
341
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
342 if (condition) // Remove the next comment leader!
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
343 // OK, I will.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
344 action();
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
345
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
346 int i = 7 /* foo *// 3
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
347 // comment
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
348 ;
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
349
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
350 int i = 7 /* foo *// 3
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
351 // comment
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
352 ;
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
353
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
354 ># Note that the last character of the ending comment leader (left angle
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
355 # bracket) is a comment leader itself. Make sure that this comment leader is
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
356 # not removed from the next line #<
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
357 < On this line a new comment is opened which spans 2 lines. This comment should
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
358 < retain its comment leader.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
359
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
360 ># Note that the last character of the ending comment leader (left angle
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
361 # bracket) is a comment leader itself. Make sure that this comment leader is
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
362 # not removed from the next line #<
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
363 < On this line a new comment is opened which spans 2 lines. This comment should
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
364 < retain its comment leader.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
365
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
366 }
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
367 .
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
368
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
369 call cursor(2, 1)
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
370 set comments=sO:*\ -,mO:*\ \ ,exO:*/
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
371 set comments+=s1:/*,mb:*,ex:*/,://
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
372 set comments+=s1:>#,mb:#,ex:#<,:<
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
373 set cpoptions-=j joinspaces fo=j
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
374 set backspace=eol,start
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
375
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
376 .,+3join
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
377 exe "normal j4J\<CR>"
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
378 .,+8join
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
379 exe "normal j9J\<CR>"
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
380 .,+2join
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
381 exe "normal j3J\<CR>"
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
382 .,+2join
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
383 exe "normal j3J\<CR>"
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
384 .,+2join
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
385 exe "normal jj3J\<CR>j"
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
386 .,+2join
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
387 exe "normal jj3J\<CR>j"
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
388 .,+5join
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
389 exe "normal j6J\<CR>"
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
390 exe "normal oSome code!\<CR>// Make sure backspacing does not remove this comment leader.\<Esc>0i\<C-H>\<Esc>"
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
391
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
392 normal G
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
393 let last_line = line('$')
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
394
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
395 " Expected output
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
396 append
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
397 {
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
398 /* Make sure the previous comment leader is not removed. */
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
399 /* Make sure the previous comment leader is not removed. */
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
400 /* List: item1 foo bar baz foo bar baz item2 foo bar baz foo bar baz */
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
401 /* List: item1 foo bar baz foo bar baz item2 foo bar baz foo bar baz */
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
402 // Should the next comment leader be left alone? Yes.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
403 // Should the next comment leader be left alone? Yes.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
404 /* Here the comment leader should be left intact. */ // And so should this one.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
405 /* Here the comment leader should be left intact. */ // And so should this one.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
406 if (condition) // Remove the next comment leader! OK, I will.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
407 action();
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
408 if (condition) // Remove the next comment leader! OK, I will.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
409 action();
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
410 int i = 7 /* foo *// 3 // comment
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
411 ;
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
412 int i = 7 /* foo *// 3 // comment
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
413 ;
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
414 ># Note that the last character of the ending comment leader (left angle bracket) is a comment leader itself. Make sure that this comment leader is not removed from the next line #< < On this line a new comment is opened which spans 2 lines. This comment should retain its comment leader.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
415 ># Note that the last character of the ending comment leader (left angle bracket) is a comment leader itself. Make sure that this comment leader is not removed from the next line #< < On this line a new comment is opened which spans 2 lines. This comment should retain its comment leader.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
416
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
417 Some code!// Make sure backspacing does not remove this comment leader.
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
418 }
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
419 .
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
420
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
421 call assert_equal(getline(last_line + 1, '$'), getline(1, last_line))
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
422 close!
f776ce5d4ed8 patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents: 12662
diff changeset
423 endfunc