Mercurial > vim
annotate src/testdir/test_join.vim @ 25382:b80e4e9c4988 v8.2.3228
patch 8.2.3228: cannot use a simple block for the :command argument
Commit: https://github.com/vim/vim/commit/5d7c2df536c17db4a9c61e0760bdcf78d0db7330
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Jul 27 21:17:32 2021 +0200
patch 8.2.3228: cannot use a simple block for the :command argument
Problem: Cannot use a simple block for the :command argument. (Maarten
Tournoij)
Solution: Recognize a simple {} block. (issue #8623)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 27 Jul 2021 21:30:08 +0200 |
parents | 08940efa6b4e |
children |
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)) |
18599
9cbdd58eeeb2
patch 8.1.2293: join adds trailing space when second line is empty
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
12 |
9cbdd58eeeb2
patch 8.1.2293: join adds trailing space when second line is empty
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
13 call setline(1, ['one', '', 'two']) |
9cbdd58eeeb2
patch 8.1.2293: join adds trailing space when second line is empty
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
14 normal J |
9cbdd58eeeb2
patch 8.1.2293: join adds trailing space when second line is empty
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
15 call assert_equal('one', getline(1)) |
9cbdd58eeeb2
patch 8.1.2293: join adds trailing space when second line is empty
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
16 |
9cbdd58eeeb2
patch 8.1.2293: join adds trailing space when second line is empty
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
17 call setline(1, ['one', ' ', 'two']) |
9cbdd58eeeb2
patch 8.1.2293: join adds trailing space when second line is empty
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
18 normal J |
9cbdd58eeeb2
patch 8.1.2293: join adds trailing space when second line is empty
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
19 call assert_equal('one', getline(1)) |
9cbdd58eeeb2
patch 8.1.2293: join adds trailing space when second line is empty
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
20 |
9cbdd58eeeb2
patch 8.1.2293: join adds trailing space when second line is empty
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
21 call setline(1, ['one', '', '', 'two']) |
9cbdd58eeeb2
patch 8.1.2293: join adds trailing space when second line is empty
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
22 normal JJ |
9cbdd58eeeb2
patch 8.1.2293: join adds trailing space when second line is empty
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
23 call assert_equal('one', getline(1)) |
9cbdd58eeeb2
patch 8.1.2293: join adds trailing space when second line is empty
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
24 |
9cbdd58eeeb2
patch 8.1.2293: join adds trailing space when second line is empty
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
25 call setline(1, ['one', ' ', ' ', 'two']) |
9cbdd58eeeb2
patch 8.1.2293: join adds trailing space when second line is empty
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
26 normal JJ |
9cbdd58eeeb2
patch 8.1.2293: join adds trailing space when second line is empty
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
27 call assert_equal('one', getline(1)) |
9cbdd58eeeb2
patch 8.1.2293: join adds trailing space when second line is empty
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
28 |
9cbdd58eeeb2
patch 8.1.2293: join adds trailing space when second line is empty
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
29 call setline(1, ['one', '', '', 'two']) |
9cbdd58eeeb2
patch 8.1.2293: join adds trailing space when second line is empty
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
30 normal 2J |
9cbdd58eeeb2
patch 8.1.2293: join adds trailing space when second line is empty
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
31 call assert_equal('one', getline(1)) |
9cbdd58eeeb2
patch 8.1.2293: join adds trailing space when second line is empty
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
32 |
8445
dd2e2bd69d0e
commit https://github.com/vim/vim/commit/41e0f2f48f541eb2c8eb5620d3f1d270eb979154
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 quit! |
dd2e2bd69d0e
commit https://github.com/vim/vim/commit/41e0f2f48f541eb2c8eb5620d3f1d270eb979154
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 endfunc |
12662
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
8445
diff
changeset
|
35 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
8445
diff
changeset
|
36 " 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
|
37 func Test_join_marks() |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
8445
diff
changeset
|
38 enew |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
8445
diff
changeset
|
39 call append(0, [ |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
8445
diff
changeset
|
40 \ "\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
|
41 \ "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
|
42 \ "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
|
43 \ "", |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
8445
diff
changeset
|
44 \ "This line.", |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
8445
diff
changeset
|
45 \ "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
|
46 \ "and with this line"]) |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
8445
diff
changeset
|
47 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
8445
diff
changeset
|
48 normal gg0gqj |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
8445
diff
changeset
|
49 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
|
50 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
|
51 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
8445
diff
changeset
|
52 /^This line/;'}-join |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
8445
diff
changeset
|
53 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
|
54 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
|
55 enew! |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
8445
diff
changeset
|
56 endfunc |
16658
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
57 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
58 " 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
|
59 " in compatible and nocompatible modes |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
60 " 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
|
61 " 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
|
62 func Test_join_spaces_marks() |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
63 new |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
64 " Text used for the test |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
65 insert |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
66 asdfasdf. |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
67 asdf |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
68 asdfasdf. |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
69 asdf |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
70 asdfasdf. |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
71 asdf |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
72 asdfasdf. |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
73 asdf |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
74 asdfasdf. |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
75 asdf |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
76 asdfasdf. |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
77 asdf |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
78 asdfasdf. |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
79 asdf |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
80 asdfasdf |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
81 asdf |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
82 asdfasdf |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
83 asdf |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
84 asdfasdf |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
85 asdf |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
86 asdfasdf |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
87 asdf |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
88 asdfasdf |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
89 asdf |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
90 asdfasdf |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
91 asdf |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
92 asdfasdf |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
93 asdf |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
94 zx cvn. |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
95 as dfg? |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
96 hjkl iop! |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
97 ert |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
98 zx cvn. |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
99 as dfg? |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
100 hjkl iop! |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
101 ert |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
102 . |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
103 let text = getline(1, '$') |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
104 normal gg |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
105 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
106 set nojoinspaces |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
107 set cpoptions-=j |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
108 normal JjJjJjJjJjJjJjJjJjJjJjJjJjJ |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
109 normal j05lmx |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
110 normal 2j06lmy |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
111 normal 2k4Jy3l$p |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
112 normal `xyl$p |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
113 normal `yy2l$p |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
114 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
115 set cpoptions+=j |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
116 normal j05lmx |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
117 normal 2j06lmy |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
118 normal 2k4Jy3l$p |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
119 normal `xyl$p |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
120 normal `yy2l$p |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
121 |
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
|
122 " 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
|
123 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
|
124 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
125 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
126 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
127 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
128 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
129 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
130 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
131 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
132 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
133 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
134 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
135 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
136 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
137 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
138 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
|
139 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
|
140 [DATA] |
16658
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
141 |
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
|
142 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
|
143 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
144 enew! |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
145 call append(0, text) |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
146 normal gg |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
147 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
148 set cpoptions-=j |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
149 set joinspaces |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
150 normal JjJjJjJjJjJjJjJjJjJjJjJjJjJ |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
151 normal j05lmx |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
152 normal 2j06lmy |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
153 normal 2k4Jy3l$p |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
154 normal `xyl$p |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
155 normal `yy2l$p |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
156 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
157 set cpoptions+=j |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
158 normal j05lmx |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
159 normal 2j06lmy |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
160 normal 2k4Jy3l$p |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
161 normal `xyl$p |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
162 normal `yy2l$p |
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 " 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
|
165 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
|
166 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
167 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
168 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
169 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
170 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
171 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
172 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
173 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
174 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
175 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
176 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
177 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
178 asdfasdf asdf |
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 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
|
181 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
|
182 |
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
|
183 [DATA] |
16658
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
184 |
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
|
185 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
|
186 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
187 enew! |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
188 call append(0, text) |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
189 normal gg |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
190 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
191 set cpoptions-=j |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
192 set nojoinspaces |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
193 set compatible |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
194 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
195 normal JjJjJjJjJjJjJjJjJjJjJjJjJjJ |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
196 normal j4Jy3l$pjdG |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
197 |
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
|
198 " 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
|
199 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
|
200 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
201 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
202 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
203 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
204 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
205 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
206 asdfasdf. asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
207 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
208 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
209 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
210 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
211 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
212 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
213 asdfasdf asdf |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
214 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
|
215 [DATA] |
16658
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
216 |
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
|
217 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
|
218 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
219 set nocompatible |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
220 set cpoptions&vim |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
221 set joinspaces&vim |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
222 close! |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
223 endfunc |
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 " 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
|
226 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
|
227 new |
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 " Text used by the test |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
230 insert |
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 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
233 /* |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
234 * 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
|
235 */ |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
236 |
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 * 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
|
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 // 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
|
242 // Yes. |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
243 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
244 // 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
|
245 // Yes. |
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 /* 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
|
248 // And so should this one. |
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 /* 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
|
251 // And so should this one. |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
252 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
253 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
|
254 // OK, I will. |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
255 action(); |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
256 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
257 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
|
258 // OK, I will. |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
259 action(); |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
260 } |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
261 . |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
262 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
263 call cursor(2, 1) |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
264 set comments=s1:/*,mb:*,ex:*/,:// |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
265 set nojoinspaces fo=j |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
266 set backspace=eol,start |
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 .,+3join |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
269 exe "normal j4J\<CR>" |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
270 .,+2join |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
271 exe "normal j3J\<CR>" |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
272 .,+2join |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
273 exe "normal j3J\<CR>" |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
274 .,+2join |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
275 exe "normal jj3J\<CR>" |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
276 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
277 " 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
|
278 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
|
279 { |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
280 /* 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
|
281 /* 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
|
282 // 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
|
283 // 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
|
284 /* 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
|
285 /* 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
|
286 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
|
287 action(); |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
288 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
|
289 action(); |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
290 } |
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
|
291 [CODE] |
16658
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
292 |
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
|
293 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
|
294 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
295 set comments&vim |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
296 set joinspaces&vim |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
297 set fo&vim |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
298 set backspace&vim |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
299 close! |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
300 endfunc |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
301 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
302 " 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
|
303 func Test_join_comments_2() |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
304 new |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
305 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
306 insert |
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 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
309 /* |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
310 * 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
|
311 */ |
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 * 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
|
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 /* List: |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
327 * - item1 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
328 * foo bar baz |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
329 * foo bar baz |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
330 * - item2 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
331 * foo bar baz |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
332 * foo bar baz |
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 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
335 // 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
|
336 // Yes. |
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 // 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
|
339 // Yes. |
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 /* 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
|
342 // And so should this one. |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
343 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
344 /* 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
|
345 // And so should this one. |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
346 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
347 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
|
348 // OK, I will. |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
349 action(); |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
350 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
351 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
|
352 // OK, I will. |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
353 action(); |
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 int i = 7 /* foo *// 3 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
356 // comment |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
357 ; |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
358 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
359 int i = 7 /* foo *// 3 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
360 // comment |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
361 ; |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
362 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
363 ># 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
|
364 # 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
|
365 # 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
|
366 < 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
|
367 < retain its comment leader. |
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 ># 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
|
370 # 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
|
371 # 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
|
372 < 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
|
373 < retain its comment leader. |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
374 |
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 . |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
377 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
378 call cursor(2, 1) |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
379 set comments=sO:*\ -,mO:*\ \ ,exO:*/ |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
380 set comments+=s1:/*,mb:*,ex:*/,:// |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
381 set comments+=s1:>#,mb:#,ex:#<,:< |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
382 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
|
383 set backspace=eol,start |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
384 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
385 .,+3join |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
386 exe "normal j4J\<CR>" |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
387 .,+8join |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
388 exe "normal j9J\<CR>" |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
389 .,+2join |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
390 exe "normal j3J\<CR>" |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
391 .,+2join |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
392 exe "normal j3J\<CR>" |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
393 .,+2join |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
394 exe "normal jj3J\<CR>j" |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
395 .,+2join |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
396 exe "normal jj3J\<CR>j" |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
397 .,+5join |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
398 exe "normal j6J\<CR>" |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
399 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
|
400 |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
401 " Expected output |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
402 let expected =<< trim [CODE] |
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 /* 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
|
405 /* 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
|
406 /* 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
|
407 /* 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
|
408 // 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
|
409 // 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
|
410 /* 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
|
411 /* 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
|
412 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
|
413 action(); |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
414 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
|
415 action(); |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
416 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
|
417 ; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
418 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
|
419 ; |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
420 ># 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
|
421 ># 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
|
422 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
423 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
|
424 } |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
425 [CODE] |
16658
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
426 |
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
|
427 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
|
428 close! |
f776ce5d4ed8
patch 8.1.1331: test 29 is old style
Bram Moolenaar <Bram@vim.org>
parents:
12662
diff
changeset
|
429 endfunc |
18914
4c0b420e7327
patch 8.2.0018: :join does not add white space where it should
Bram Moolenaar <Bram@vim.org>
parents:
18599
diff
changeset
|
430 |
4c0b420e7327
patch 8.2.0018: :join does not add white space where it should
Bram Moolenaar <Bram@vim.org>
parents:
18599
diff
changeset
|
431 func Test_join_lines() |
4c0b420e7327
patch 8.2.0018: :join does not add white space where it should
Bram Moolenaar <Bram@vim.org>
parents:
18599
diff
changeset
|
432 new |
4c0b420e7327
patch 8.2.0018: :join does not add white space where it should
Bram Moolenaar <Bram@vim.org>
parents:
18599
diff
changeset
|
433 call setline(1, ['a', 'b', '', 'c', 'd']) |
4c0b420e7327
patch 8.2.0018: :join does not add white space where it should
Bram Moolenaar <Bram@vim.org>
parents:
18599
diff
changeset
|
434 %join |
4c0b420e7327
patch 8.2.0018: :join does not add white space where it should
Bram Moolenaar <Bram@vim.org>
parents:
18599
diff
changeset
|
435 call assert_equal('a b c d', getline(1)) |
4c0b420e7327
patch 8.2.0018: :join does not add white space where it should
Bram Moolenaar <Bram@vim.org>
parents:
18599
diff
changeset
|
436 call setline(1, ['a', 'b', '', 'c', 'd']) |
4c0b420e7327
patch 8.2.0018: :join does not add white space where it should
Bram Moolenaar <Bram@vim.org>
parents:
18599
diff
changeset
|
437 normal 5J |
4c0b420e7327
patch 8.2.0018: :join does not add white space where it should
Bram Moolenaar <Bram@vim.org>
parents:
18599
diff
changeset
|
438 call assert_equal('a b c d', getline(1)) |
19425
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18914
diff
changeset
|
439 call setline(1, ['a', 'b', 'c']) |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18914
diff
changeset
|
440 2,2join |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18914
diff
changeset
|
441 call assert_equal(['a', 'b', 'c'], getline(1, '$')) |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18914
diff
changeset
|
442 call assert_equal(2, line('.')) |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18914
diff
changeset
|
443 2join |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18914
diff
changeset
|
444 call assert_equal(['a', 'b c'], getline(1, '$')) |
18914
4c0b420e7327
patch 8.2.0018: :join does not add white space where it should
Bram Moolenaar <Bram@vim.org>
parents:
18599
diff
changeset
|
445 bwipe! |
4c0b420e7327
patch 8.2.0018: :join does not add white space where it should
Bram Moolenaar <Bram@vim.org>
parents:
18599
diff
changeset
|
446 endfunc |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
447 |
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
448 " vim: shiftwidth=2 sts=2 expandtab |