Mercurial > vim
comparison src/testdir/test_join.vim @ 17172:6990c1160ea5 v8.1.1585
patch 8.1.1585: :let-heredoc does not trim enough
commit https://github.com/vim/vim/commit/e7eb92708ec2092a2fc11e78703b5dcf83844412
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Jun 24 00:58:07 2019 +0200
patch 8.1.1585: :let-heredoc does not trim enough
Problem: :let-heredoc does not trim enough.
Solution: Trim indent from the contents based on the indent of the first
line. Use let-heredoc in more tests.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 24 Jun 2019 01:00:05 +0200 |
parents | 9c90cf08cfa8 |
children | 9cbdd58eeeb2 |
comparison
equal
deleted
inserted
replaced
17171:1b0f624dcd8d | 17172:6990c1160ea5 |
---|---|
98 normal `xyl$p | 98 normal `xyl$p |
99 normal `yy2l$p | 99 normal `yy2l$p |
100 | 100 |
101 " Expected output | 101 " Expected output |
102 let expected =<< trim [DATA] | 102 let expected =<< trim [DATA] |
103 asdfasdf. asdf | 103 asdfasdf. asdf |
104 asdfasdf. asdf | 104 asdfasdf. asdf |
105 asdfasdf. asdf | 105 asdfasdf. asdf |
106 asdfasdf. asdf | 106 asdfasdf. asdf |
107 asdfasdf. asdf | 107 asdfasdf. asdf |
108 asdfasdf. asdf | 108 asdfasdf. asdf |
109 asdfasdf. asdf | 109 asdfasdf. asdf |
110 asdfasdf asdf | 110 asdfasdf asdf |
111 asdfasdf asdf | 111 asdfasdf asdf |
112 asdfasdf asdf | 112 asdfasdf asdf |
113 asdfasdf asdf | 113 asdfasdf asdf |
114 asdfasdf asdf | 114 asdfasdf asdf |
115 asdfasdf asdf | 115 asdfasdf asdf |
116 asdfasdf asdf | 116 asdfasdf asdf |
117 zx cvn. as dfg? hjkl iop! ert ernop | 117 zx cvn. as dfg? hjkl iop! ert ernop |
118 zx cvn. as dfg? hjkl iop! ert ernop | 118 zx cvn. as dfg? hjkl iop! ert ernop |
119 [DATA] | 119 [DATA] |
120 | 120 |
121 call assert_equal(expected, getline(1, '$')) | 121 call assert_equal(expected, getline(1, '$')) |
122 | 122 |
123 enew! | 123 enew! |
140 normal `xyl$p | 140 normal `xyl$p |
141 normal `yy2l$p | 141 normal `yy2l$p |
142 | 142 |
143 " Expected output | 143 " Expected output |
144 let expected =<< trim [DATA] | 144 let expected =<< trim [DATA] |
145 asdfasdf. asdf | 145 asdfasdf. asdf |
146 asdfasdf. asdf | 146 asdfasdf. asdf |
147 asdfasdf. asdf | 147 asdfasdf. asdf |
148 asdfasdf. asdf | 148 asdfasdf. asdf |
149 asdfasdf. asdf | 149 asdfasdf. asdf |
150 asdfasdf. asdf | 150 asdfasdf. asdf |
151 asdfasdf. asdf | 151 asdfasdf. asdf |
152 asdfasdf asdf | 152 asdfasdf asdf |
153 asdfasdf asdf | 153 asdfasdf asdf |
154 asdfasdf asdf | 154 asdfasdf asdf |
155 asdfasdf asdf | 155 asdfasdf asdf |
156 asdfasdf asdf | 156 asdfasdf asdf |
157 asdfasdf asdf | 157 asdfasdf asdf |
158 asdfasdf asdf | 158 asdfasdf asdf |
159 zx cvn. as dfg? hjkl iop! ert enop | 159 zx cvn. as dfg? hjkl iop! ert enop |
160 zx cvn. as dfg? hjkl iop! ert ernop | 160 zx cvn. as dfg? hjkl iop! ert ernop |
161 | 161 |
162 [DATA] | 162 [DATA] |
163 | 163 |
164 call assert_equal(expected, getline(1, '$')) | 164 call assert_equal(expected, getline(1, '$')) |
165 | 165 |
174 normal JjJjJjJjJjJjJjJjJjJjJjJjJjJ | 174 normal JjJjJjJjJjJjJjJjJjJjJjJjJjJ |
175 normal j4Jy3l$pjdG | 175 normal j4Jy3l$pjdG |
176 | 176 |
177 " Expected output | 177 " Expected output |
178 let expected =<< trim [DATA] | 178 let expected =<< trim [DATA] |
179 asdfasdf. asdf | 179 asdfasdf. asdf |
180 asdfasdf. asdf | 180 asdfasdf. asdf |
181 asdfasdf. asdf | 181 asdfasdf. asdf |
182 asdfasdf. asdf | 182 asdfasdf. asdf |
183 asdfasdf. asdf | 183 asdfasdf. asdf |
184 asdfasdf. asdf | 184 asdfasdf. asdf |
185 asdfasdf. asdf | 185 asdfasdf. asdf |
186 asdfasdf asdf | 186 asdfasdf asdf |
187 asdfasdf asdf | 187 asdfasdf asdf |
188 asdfasdf asdf | 188 asdfasdf asdf |
189 asdfasdf asdf | 189 asdfasdf asdf |
190 asdfasdf asdf | 190 asdfasdf asdf |
191 asdfasdf asdf | 191 asdfasdf asdf |
192 asdfasdf asdf | 192 asdfasdf asdf |
193 zx cvn. as dfg? hjkl iop! ert a | 193 zx cvn. as dfg? hjkl iop! ert a |
194 [DATA] | 194 [DATA] |
195 | 195 |
196 call assert_equal(expected, getline(1, '$')) | 196 call assert_equal(expected, getline(1, '$')) |
197 | 197 |
198 set nocompatible | 198 set nocompatible |
253 .,+2join | 253 .,+2join |
254 exe "normal jj3J\<CR>" | 254 exe "normal jj3J\<CR>" |
255 | 255 |
256 " Expected output | 256 " Expected output |
257 let expected =<< trim [CODE] | 257 let expected =<< trim [CODE] |
258 { | 258 { |
259 /* Make sure the previous comment leader is not removed. */ | 259 /* Make sure the previous comment leader is not removed. */ |
260 /* Make sure the previous comment leader is not removed. */ | 260 /* Make sure the previous comment leader is not removed. */ |
261 // Should the next comment leader be left alone? Yes. | 261 // Should the next comment leader be left alone? Yes. |
262 // Should the next comment leader be left alone? Yes. | 262 // Should the next comment leader be left alone? Yes. |
263 /* Here the comment leader should be left intact. */ // And so should this one. | 263 /* Here the comment leader should be left intact. */ // And so should this one. |
264 /* Here the comment leader should be left intact. */ // And so should this one. | 264 /* Here the comment leader should be left intact. */ // And so should this one. |
265 if (condition) // Remove the next comment leader! OK, I will. | 265 if (condition) // Remove the next comment leader! OK, I will. |
266 action(); | 266 action(); |
267 if (condition) // Remove the next comment leader! OK, I will. | 267 if (condition) // Remove the next comment leader! OK, I will. |
268 action(); | 268 action(); |
269 } | 269 } |
270 [CODE] | 270 [CODE] |
271 | 271 |
272 call assert_equal(expected, getline(1, '$')) | 272 call assert_equal(expected, getline(1, '$')) |
273 | 273 |
274 set comments&vim | 274 set comments&vim |
376 .,+5join | 376 .,+5join |
377 exe "normal j6J\<CR>" | 377 exe "normal j6J\<CR>" |
378 exe "normal oSome code!\<CR>// Make sure backspacing does not remove this comment leader.\<Esc>0i\<C-H>\<Esc>" | 378 exe "normal oSome code!\<CR>// Make sure backspacing does not remove this comment leader.\<Esc>0i\<C-H>\<Esc>" |
379 | 379 |
380 " Expected output | 380 " Expected output |
381 let expected =<< [CODE] | 381 let expected =<< trim [CODE] |
382 { | 382 { |
383 /* Make sure the previous comment leader is not removed. */ | 383 /* Make sure the previous comment leader is not removed. */ |
384 /* Make sure the previous comment leader is not removed. */ | 384 /* Make sure the previous comment leader is not removed. */ |
385 /* List: item1 foo bar baz foo bar baz item2 foo bar baz foo bar baz */ | 385 /* List: item1 foo bar baz foo bar baz item2 foo bar baz foo bar baz */ |
386 /* List: item1 foo bar baz foo bar baz item2 foo bar baz foo bar baz */ | 386 /* List: item1 foo bar baz foo bar baz item2 foo bar baz foo bar baz */ |
387 // Should the next comment leader be left alone? Yes. | 387 // Should the next comment leader be left alone? Yes. |
388 // Should the next comment leader be left alone? Yes. | 388 // Should the next comment leader be left alone? Yes. |
389 /* Here the comment leader should be left intact. */ // And so should this one. | 389 /* Here the comment leader should be left intact. */ // And so should this one. |
390 /* Here the comment leader should be left intact. */ // And so should this one. | 390 /* Here the comment leader should be left intact. */ // And so should this one. |
391 if (condition) // Remove the next comment leader! OK, I will. | 391 if (condition) // Remove the next comment leader! OK, I will. |
392 action(); | 392 action(); |
393 if (condition) // Remove the next comment leader! OK, I will. | 393 if (condition) // Remove the next comment leader! OK, I will. |
394 action(); | 394 action(); |
395 int i = 7 /* foo *// 3 // comment | 395 int i = 7 /* foo *// 3 // comment |
396 ; | 396 ; |
397 int i = 7 /* foo *// 3 // comment | 397 int i = 7 /* foo *// 3 // comment |
398 ; | 398 ; |
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. | 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. |
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. | 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. |
401 | 401 |
402 Some code!// Make sure backspacing does not remove this comment leader. | 402 Some code!// Make sure backspacing does not remove this comment leader. |
403 } | 403 } |
404 [CODE] | 404 [CODE] |
405 | 405 |
406 call assert_equal(expected, getline(1, '$')) | 406 call assert_equal(expected, getline(1, '$')) |
407 close! | 407 close! |
408 endfunc | 408 endfunc |