Mercurial > vim
annotate src/testdir/test_join.vim @ 17826:f2a1c7de4d14
Added tag v8.1.1909 for changeset ce993ba17adbfcc4f142f5ca35701097d9c5ff7a
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 21 Aug 2019 23:00:04 +0200 |
parents | 6990c1160ea5 |
children | 9cbdd58eeeb2 |
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 |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16658
diff
changeset
|
101 " Expected output |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16658
diff
changeset
|
102 let expected =<< trim [DATA] |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
103 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
104 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
105 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
106 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
107 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
108 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
109 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
110 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
111 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
112 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
113 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
114 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
115 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
116 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
117 zx cvn. as dfg? hjkl iop! ert ernop |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
118 zx cvn. as dfg? hjkl iop! ert ernop |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16658
diff
changeset
|
119 [DATA] |
16658
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
120 |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16658
diff
changeset
|
121 call assert_equal(expected, getline(1, '$')) |
16658
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 enew! |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
124 call append(0, text) |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
125 normal gg |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
126 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
127 set cpoptions-=j |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
128 set joinspaces |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
129 normal JjJjJjJjJjJjJjJjJjJjJjJjJjJ |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
130 normal j05lmx |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
131 normal 2j06lmy |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
132 normal 2k4Jy3l$p |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
133 normal `xyl$p |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
134 normal `yy2l$p |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
135 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
136 set cpoptions+=j |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
137 normal j05lmx |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
138 normal 2j06lmy |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
139 normal 2k4Jy3l$p |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
140 normal `xyl$p |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
141 normal `yy2l$p |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
142 |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16658
diff
changeset
|
143 " Expected output |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16658
diff
changeset
|
144 let expected =<< trim [DATA] |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
145 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
146 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
147 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
148 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
149 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
150 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
151 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
152 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
153 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
154 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
155 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
156 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
157 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
158 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
159 zx cvn. as dfg? hjkl iop! ert enop |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
160 zx cvn. as dfg? hjkl iop! ert ernop |
16658
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
161 |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16658
diff
changeset
|
162 [DATA] |
16658
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
163 |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16658
diff
changeset
|
164 call assert_equal(expected, getline(1, '$')) |
16658
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
165 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
166 enew! |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
167 call append(0, text) |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
168 normal gg |
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 set cpoptions-=j |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
171 set nojoinspaces |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
172 set compatible |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
173 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
174 normal JjJjJjJjJjJjJjJjJjJjJjJjJjJ |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
175 normal j4Jy3l$pjdG |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
176 |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16658
diff
changeset
|
177 " Expected output |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16658
diff
changeset
|
178 let expected =<< trim [DATA] |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
179 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
180 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
181 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
182 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
183 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
184 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
185 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
186 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
187 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
188 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
189 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
190 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
191 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
192 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
193 zx cvn. as dfg? hjkl iop! ert a |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16658
diff
changeset
|
194 [DATA] |
16658
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
195 |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16658
diff
changeset
|
196 call assert_equal(expected, getline(1, '$')) |
16658
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
197 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
198 set nocompatible |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
199 set cpoptions&vim |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
200 set joinspaces&vim |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
201 close! |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
202 endfunc |
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 " 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
|
205 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
|
206 new |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
207 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
208 " Text used by the test |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
209 insert |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
210 { |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
211 |
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 * 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
|
214 */ |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
215 |
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 * 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
|
218 */ |
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 // 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
|
221 // Yes. |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
222 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
223 // 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
|
224 // Yes. |
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 /* 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
|
227 // And so should this one. |
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 /* 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
|
230 // And so should this one. |
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 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
|
233 // OK, I will. |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
234 action(); |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
235 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
236 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
|
237 // OK, I will. |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
238 action(); |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
239 } |
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 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
242 call cursor(2, 1) |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
243 set comments=s1:/*,mb:*,ex:*/,:// |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
244 set nojoinspaces fo=j |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
245 set backspace=eol,start |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
246 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
247 .,+3join |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
248 exe "normal j4J\<CR>" |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
249 .,+2join |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
250 exe "normal j3J\<CR>" |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
251 .,+2join |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
252 exe "normal j3J\<CR>" |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
253 .,+2join |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
254 exe "normal jj3J\<CR>" |
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 " Expected output |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16658
diff
changeset
|
257 let expected =<< trim [CODE] |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
258 { |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
259 /* Make sure the previous comment leader is not removed. */ |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
260 /* Make sure the previous comment leader is not removed. */ |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
261 // Should the next comment leader be left alone? Yes. |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
262 // Should the next comment leader be left alone? Yes. |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
263 /* Here the comment leader should be left intact. */ // And so should this one. |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
264 /* Here the comment leader should be left intact. */ // And so should this one. |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
265 if (condition) // Remove the next comment leader! OK, I will. |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
266 action(); |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
267 if (condition) // Remove the next comment leader! OK, I will. |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
268 action(); |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
269 } |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16658
diff
changeset
|
270 [CODE] |
16658
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
271 |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16658
diff
changeset
|
272 call assert_equal(expected, getline(1, '$')) |
16658
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
273 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
274 set comments&vim |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
275 set joinspaces&vim |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
276 set fo&vim |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
277 set backspace&vim |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
278 close! |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
279 endfunc |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
280 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
281 " 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
|
282 func Test_join_comments_2() |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
283 new |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
284 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
285 insert |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
286 { |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
287 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
288 /* |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
289 * 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
|
290 */ |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
291 |
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 * 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
|
294 */ |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
295 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
296 /* List: |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
297 * - item1 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
298 * foo bar baz |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
299 * foo bar baz |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
300 * - item2 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
301 * foo bar baz |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
302 * foo bar baz |
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 /* List: |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
306 * - item1 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
307 * foo bar baz |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
308 * foo bar baz |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
309 * - item2 |
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 */ |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
313 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
314 // 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
|
315 // Yes. |
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 // 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
|
318 // Yes. |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
319 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
320 /* 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
|
321 // And so should this one. |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
322 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
323 /* 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
|
324 // And so should this one. |
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 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
|
327 // OK, I will. |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
328 action(); |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
329 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
330 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
|
331 // OK, I will. |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
332 action(); |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
333 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
334 int i = 7 /* foo *// 3 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
335 // comment |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
336 ; |
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 int i = 7 /* foo *// 3 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
339 // comment |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
340 ; |
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 ># 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
|
343 # 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
|
344 # 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
|
345 < 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
|
346 < retain its comment leader. |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
347 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
348 ># 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
|
349 # 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
|
350 # 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
|
351 < 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
|
352 < retain its comment leader. |
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 } |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
355 . |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
356 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
357 call cursor(2, 1) |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
358 set comments=sO:*\ -,mO:*\ \ ,exO:*/ |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
359 set comments+=s1:/*,mb:*,ex:*/,:// |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
360 set comments+=s1:>#,mb:#,ex:#<,:< |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
361 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
|
362 set backspace=eol,start |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
363 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
364 .,+3join |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
365 exe "normal j4J\<CR>" |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
366 .,+8join |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
367 exe "normal j9J\<CR>" |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
368 .,+2join |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
369 exe "normal j3J\<CR>" |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
370 .,+2join |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
371 exe "normal j3J\<CR>" |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
372 .,+2join |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
373 exe "normal jj3J\<CR>j" |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
374 .,+2join |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
375 exe "normal jj3J\<CR>j" |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
376 .,+5join |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
377 exe "normal j6J\<CR>" |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
378 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
|
379 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
380 " Expected output |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
381 let expected =<< trim [CODE] |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
382 { |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
383 /* Make sure the previous comment leader is not removed. */ |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
384 /* Make sure the previous comment leader is not removed. */ |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
385 /* List: item1 foo bar baz foo bar baz item2 foo bar baz foo bar baz */ |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
386 /* List: item1 foo bar baz foo bar baz item2 foo bar baz foo bar baz */ |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
387 // Should the next comment leader be left alone? Yes. |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
388 // Should the next comment leader be left alone? Yes. |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
389 /* Here the comment leader should be left intact. */ // And so should this one. |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
390 /* Here the comment leader should be left intact. */ // And so should this one. |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
391 if (condition) // Remove the next comment leader! OK, I will. |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
392 action(); |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
393 if (condition) // Remove the next comment leader! OK, I will. |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
394 action(); |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
395 int i = 7 /* foo *// 3 // comment |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
396 ; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
397 int i = 7 /* foo *// 3 // comment |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
398 ; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
399 ># 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. |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
400 ># 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. |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
401 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
402 Some code!// Make sure backspacing does not remove this comment leader. |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
403 } |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
404 [CODE] |
16658
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
405 |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16658
diff
changeset
|
406 call assert_equal(expected, getline(1, '$')) |
16658
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
407 close! |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
408 endfunc |