Mercurial > vim
comparison src/testdir/test_breakindent.vim @ 21765:08940efa6b4e v8.2.1432
patch 8.2.1432: various inconsistencies in test files
Commit: https://github.com/vim/vim/commit/6d91bcb4d23b5c6a0be72c384beaf385e2d9d606
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Aug 12 18:50:36 2020 +0200
patch 8.2.1432: various inconsistencies in test files
Problem: Various inconsistencies in test files.
Solution: Add modelines where they were missing. Use Check commands instead
of silently skipping over tests. Adjust indents and comments.
(Ken Takata, closes #6695)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 12 Aug 2020 19:00:08 +0200 |
parents | 8c98c74176ac |
children | 68f506771741 |
comparison
equal
deleted
inserted
replaced
21764:476b6faad407 | 21765:08940efa6b4e |
---|---|
44 call s:close_windows() | 44 call s:close_windows() |
45 endfunc | 45 endfunc |
46 | 46 |
47 func Test_breakindent01_vartabs() | 47 func Test_breakindent01_vartabs() |
48 " like 01 but with vartabs feature | 48 " like 01 but with vartabs feature |
49 if !has("vartabs") | 49 CheckFeature vartabs |
50 return | |
51 endif | |
52 call s:test_windows('setl briopt=min:0 vts=4') | 50 call s:test_windows('setl briopt=min:0 vts=4') |
53 let lines = s:screen_lines(line('.'),8) | 51 let lines = s:screen_lines(line('.'),8) |
54 let expect = [ | 52 let expect = [ |
55 \ " abcd", | 53 \ " abcd", |
56 \ " qrst", | 54 \ " qrst", |
73 call s:compare_lines(expect, lines) | 71 call s:compare_lines(expect, lines) |
74 call s:close_windows('set sbr=') | 72 call s:close_windows('set sbr=') |
75 endfunc | 73 endfunc |
76 | 74 |
77 func Test_breakindent02_vartabs() | 75 func Test_breakindent02_vartabs() |
78 if !has("vartabs") | 76 CheckFeature vartabs |
79 return | |
80 endif | |
81 " simple breakindent test with showbreak set | 77 " simple breakindent test with showbreak set |
82 call s:test_windows('setl briopt=min:0 sbr=>> vts=4') | 78 call s:test_windows('setl briopt=min:0 sbr=>> vts=4') |
83 let lines = s:screen_lines(line('.'),8) | 79 let lines = s:screen_lines(line('.'),8) |
84 let expect = [ | 80 let expect = [ |
85 \ " abcd", | 81 \ " abcd", |
104 call s:close_windows('set sbr=') | 100 call s:close_windows('set sbr=') |
105 endfunc | 101 endfunc |
106 | 102 |
107 func Test_breakindent03_vartabs() | 103 func Test_breakindent03_vartabs() |
108 " simple breakindent test with showbreak set and briopt including sbr | 104 " simple breakindent test with showbreak set and briopt including sbr |
109 if !has("vartabs") | 105 CheckFeature vartabs |
110 return | |
111 endif | |
112 call s:test_windows('setl briopt=sbr,min:0 sbr=++ vts=4') | 106 call s:test_windows('setl briopt=sbr,min:0 sbr=++ vts=4') |
113 let lines = s:screen_lines(line('.'),8) | 107 let lines = s:screen_lines(line('.'),8) |
114 let expect = [ | 108 let expect = [ |
115 \ " abcd", | 109 \ " abcd", |
116 \ "++ qrst", | 110 \ "++ qrst", |
137 set sbr= | 131 set sbr= |
138 endfunc | 132 endfunc |
139 | 133 |
140 func Test_breakindent04_vartabs() | 134 func Test_breakindent04_vartabs() |
141 " breakindent set with min width 18 | 135 " breakindent set with min width 18 |
142 if !has("vartabs") | 136 CheckFeature vartabs |
143 return | |
144 endif | |
145 call s:test_windows('setl sbr= briopt=min:18 vts=4') | 137 call s:test_windows('setl sbr= briopt=min:18 vts=4') |
146 let lines = s:screen_lines(line('.'),8) | 138 let lines = s:screen_lines(line('.'),8) |
147 let expect = [ | 139 let expect = [ |
148 \ " abcd", | 140 \ " abcd", |
149 \ " qrstuv", | 141 \ " qrstuv", |
167 call s:close_windows() | 159 call s:close_windows() |
168 endfunc | 160 endfunc |
169 | 161 |
170 func Test_breakindent05_vartabs() | 162 func Test_breakindent05_vartabs() |
171 " breakindent set and shift by 2 | 163 " breakindent set and shift by 2 |
172 if !has("vartabs") | 164 CheckFeature vartabs |
173 return | |
174 endif | |
175 call s:test_windows('setl briopt=shift:2,min:0 vts=4') | 165 call s:test_windows('setl briopt=shift:2,min:0 vts=4') |
176 let lines = s:screen_lines(line('.'),8) | 166 let lines = s:screen_lines(line('.'),8) |
177 let expect = [ | 167 let expect = [ |
178 \ " abcd", | 168 \ " abcd", |
179 \ " qr", | 169 \ " qr", |
196 call s:close_windows() | 186 call s:close_windows() |
197 endfunc | 187 endfunc |
198 | 188 |
199 func Test_breakindent06_vartabs() | 189 func Test_breakindent06_vartabs() |
200 " breakindent set and shift by -1 | 190 " breakindent set and shift by -1 |
201 if !has("vartabs") | 191 CheckFeature vartabs |
202 return | |
203 endif | |
204 call s:test_windows('setl briopt=shift:-1,min:0 vts=4') | 192 call s:test_windows('setl briopt=shift:-1,min:0 vts=4') |
205 let lines = s:screen_lines(line('.'),8) | 193 let lines = s:screen_lines(line('.'),8) |
206 let expect = [ | 194 let expect = [ |
207 \ " abcd", | 195 \ " abcd", |
208 \ " qrstu", | 196 \ " qrstu", |
225 " clean up | 213 " clean up |
226 call s:close_windows('set sbr= cpo-=n') | 214 call s:close_windows('set sbr= cpo-=n') |
227 endfunc | 215 endfunc |
228 | 216 |
229 func Test_breakindent07_vartabs() | 217 func Test_breakindent07_vartabs() |
230 if !has("vartabs") | 218 CheckFeature vartabs |
231 return | |
232 endif | |
233 " breakindent set and shift by 1, Number set sbr=? and briopt:sbr | 219 " breakindent set and shift by 1, Number set sbr=? and briopt:sbr |
234 call s:test_windows('setl briopt=shift:1,sbr,min:0 nu sbr=? nuw=4 cpo+=n vts=4') | 220 call s:test_windows('setl briopt=shift:1,sbr,min:0 nu sbr=? nuw=4 cpo+=n vts=4') |
235 let lines = s:screen_lines(line('.'),10) | 221 let lines = s:screen_lines(line('.'),10) |
236 let expect = [ | 222 let expect = [ |
237 \ " 2 ab", | 223 \ " 2 ab", |
256 " clean up | 242 " clean up |
257 call s:close_windows('set sbr=') | 243 call s:close_windows('set sbr=') |
258 endfunc | 244 endfunc |
259 | 245 |
260 func Test_breakindent07a_vartabs() | 246 func Test_breakindent07a_vartabs() |
261 if !has("vartabs") | 247 CheckFeature vartabs |
262 return | |
263 endif | |
264 " breakindent set and shift by 1, Number set sbr=? and briopt:sbr | 248 " breakindent set and shift by 1, Number set sbr=? and briopt:sbr |
265 call s:test_windows('setl briopt=shift:1,sbr,min:0 nu sbr=? nuw=4 vts=4') | 249 call s:test_windows('setl briopt=shift:1,sbr,min:0 nu sbr=? nuw=4 vts=4') |
266 let lines = s:screen_lines(line('.'),10) | 250 let lines = s:screen_lines(line('.'),10) |
267 let expect = [ | 251 let expect = [ |
268 \ " 2 ab", | 252 \ " 2 ab", |
291 call s:compare_lines(expect, lines) | 275 call s:compare_lines(expect, lines) |
292 call s:close_windows('set sbr= cpo-=n') | 276 call s:close_windows('set sbr= cpo-=n') |
293 endfunc | 277 endfunc |
294 | 278 |
295 func Test_breakindent08_vartabs() | 279 func Test_breakindent08_vartabs() |
296 if !has("vartabs") | 280 CheckFeature vartabs |
297 return | |
298 endif | |
299 " breakindent set and shift by 1, Number and list set sbr=# and briopt:sbr | 281 " breakindent set and shift by 1, Number and list set sbr=# and briopt:sbr |
300 call s:test_windows('setl briopt=shift:1,sbr,min:0 nu nuw=4 sbr=# list cpo+=n ts=4 vts=4') | 282 call s:test_windows('setl briopt=shift:1,sbr,min:0 nu nuw=4 sbr=# list cpo+=n ts=4 vts=4') |
301 " make sure, cache is invalidated! | 283 " make sure, cache is invalidated! |
302 set ts=8 | 284 set ts=8 |
303 redraw! | 285 redraw! |
325 call s:compare_lines(expect, lines) | 307 call s:compare_lines(expect, lines) |
326 call s:close_windows('set sbr=') | 308 call s:close_windows('set sbr=') |
327 endfunc | 309 endfunc |
328 | 310 |
329 func Test_breakindent08a_vartabs() | 311 func Test_breakindent08a_vartabs() |
330 if !has("vartabs") | 312 CheckFeature vartabs |
331 return | |
332 endif | |
333 " breakindent set and shift by 1, Number and list set sbr=# and briopt:sbr | 313 " breakindent set and shift by 1, Number and list set sbr=# and briopt:sbr |
334 call s:test_windows('setl briopt=shift:1,sbr,min:0 nu nuw=4 sbr=# list vts=4') | 314 call s:test_windows('setl briopt=shift:1,sbr,min:0 nu nuw=4 sbr=# list vts=4') |
335 let lines = s:screen_lines(line('.'),10) | 315 let lines = s:screen_lines(line('.'),10) |
336 let expect = [ | 316 let expect = [ |
337 \ " 2 ^Iabcd", | 317 \ " 2 ^Iabcd", |
354 call s:compare_lines(expect, lines) | 334 call s:compare_lines(expect, lines) |
355 call s:close_windows('set sbr=') | 335 call s:close_windows('set sbr=') |
356 endfunc | 336 endfunc |
357 | 337 |
358 func Test_breakindent09_vartabs() | 338 func Test_breakindent09_vartabs() |
359 if !has("vartabs") | 339 CheckFeature vartabs |
360 return | |
361 endif | |
362 " breakindent set and shift by 1, Number and list set sbr=# | 340 " breakindent set and shift by 1, Number and list set sbr=# |
363 call s:test_windows('setl briopt=shift:1,min:0 nu nuw=4 sbr=# list vts=4') | 341 call s:test_windows('setl briopt=shift:1,min:0 nu nuw=4 sbr=# list vts=4') |
364 let lines = s:screen_lines(line('.'),10) | 342 let lines = s:screen_lines(line('.'),10) |
365 let expect = [ | 343 let expect = [ |
366 \ " 2 ^Iabcd", | 344 \ " 2 ^Iabcd", |
388 call s:compare_lines(expect, lines) | 366 call s:compare_lines(expect, lines) |
389 call s:close_windows('set sbr= cpo-=n') | 367 call s:close_windows('set sbr= cpo-=n') |
390 endfunc | 368 endfunc |
391 | 369 |
392 func Test_breakindent10_vartabs() | 370 func Test_breakindent10_vartabs() |
393 if !has("vartabs") | 371 CheckFeature vartabs |
394 return | |
395 endif | |
396 " breakindent set, Number set sbr=~ | 372 " breakindent set, Number set sbr=~ |
397 call s:test_windows('setl cpo+=n sbr=~ nu nuw=4 nolist briopt=sbr,min:0 vts=4') | 373 call s:test_windows('setl cpo+=n sbr=~ nu nuw=4 nolist briopt=sbr,min:0 vts=4') |
398 " make sure, cache is invalidated! | 374 " make sure, cache is invalidated! |
399 set ts=8 | 375 set ts=8 |
400 redraw! | 376 redraw! |
419 call s:close_windows('set sbr=') | 395 call s:close_windows('set sbr=') |
420 call assert_equal(4, strdisplaywidth("\t", 4)) | 396 call assert_equal(4, strdisplaywidth("\t", 4)) |
421 endfunc | 397 endfunc |
422 | 398 |
423 func Test_breakindent11_vartabs() | 399 func Test_breakindent11_vartabs() |
424 if !has("vartabs") | 400 CheckFeature vartabs |
425 return | |
426 endif | |
427 " test strdisplaywidth() | 401 " test strdisplaywidth() |
428 call s:test_windows('setl cpo-=n sbr=>> nu nuw=4 nolist briopt= ts=4 vts=4') | 402 call s:test_windows('setl cpo-=n sbr=>> nu nuw=4 nolist briopt= ts=4 vts=4') |
429 let text = getline(2) | 403 let text = getline(2) |
430 let width = strlen(text[1:]) + 2->indent() + strlen(&sbr) * 3 " text wraps 3 times | 404 let width = strlen(text[1:]) + 2->indent() + strlen(&sbr) * 3 " text wraps 3 times |
431 call assert_equal(width, text->strdisplaywidth()) | 405 call assert_equal(width, text->strdisplaywidth()) |
445 call s:compare_lines(expect, lines) | 419 call s:compare_lines(expect, lines) |
446 call s:close_windows('set nuw=4 listchars=') | 420 call s:close_windows('set nuw=4 listchars=') |
447 endfunc | 421 endfunc |
448 | 422 |
449 func Test_breakindent12_vartabs() | 423 func Test_breakindent12_vartabs() |
450 if !has("vartabs") | 424 CheckFeature vartabs |
451 return | |
452 endif | |
453 " test breakindent with long indent | 425 " test breakindent with long indent |
454 let s:input = "\t\t\t\t\t{" | 426 let s:input = "\t\t\t\t\t{" |
455 call s:test_windows('setl breakindent linebreak briopt=min:10 nu numberwidth=3 ts=4 list listchars=tab:>- vts=4') | 427 call s:test_windows('setl breakindent linebreak briopt=min:10 nu numberwidth=3 ts=4 list listchars=tab:>- vts=4') |
456 let lines = s:screen_lines(2,16) | 428 let lines = s:screen_lines(2,16) |
457 let expect = [ | 429 let expect = [ |
476 call assert_equal('w', @b) | 448 call assert_equal('w', @b) |
477 call s:close_windows() | 449 call s:close_windows() |
478 endfunc | 450 endfunc |
479 | 451 |
480 func Test_breakindent13_vartabs() | 452 func Test_breakindent13_vartabs() |
481 if !has("vartabs") | 453 CheckFeature vartabs |
482 return | |
483 endif | |
484 let s:input = "" | 454 let s:input = "" |
485 call s:test_windows('setl breakindent briopt=min:10 ts=8 vts=8') | 455 call s:test_windows('setl breakindent briopt=min:10 ts=8 vts=8') |
486 vert resize 20 | 456 vert resize 20 |
487 call setline(1, [" a\tb\tc\td\te", " z y x w v"]) | 457 call setline(1, [" a\tb\tc\td\te", " z y x w v"]) |
488 1 | 458 1 |
510 call s:compare_lines(expect, lines) | 480 call s:compare_lines(expect, lines) |
511 call s:close_windows() | 481 call s:close_windows() |
512 endfunc | 482 endfunc |
513 | 483 |
514 func Test_breakindent14_vartabs() | 484 func Test_breakindent14_vartabs() |
515 if !has("vartabs") | 485 CheckFeature vartabs |
516 return | |
517 endif | |
518 let s:input = "" | 486 let s:input = "" |
519 call s:test_windows('setl breakindent briopt= ts=8 vts=8') | 487 call s:test_windows('setl breakindent briopt= ts=8 vts=8') |
520 vert resize 30 | 488 vert resize 30 |
521 norm! 3a1234567890 | 489 norm! 3a1234567890 |
522 norm! a abcde | 490 norm! a abcde |
546 call s:compare_lines(expect, lines) | 514 call s:compare_lines(expect, lines) |
547 call s:close_windows() | 515 call s:close_windows() |
548 endfunc | 516 endfunc |
549 | 517 |
550 func Test_breakindent15_vartabs() | 518 func Test_breakindent15_vartabs() |
551 if !has("vartabs") | 519 CheckFeature vartabs |
552 return | |
553 endif | |
554 let s:input = "" | 520 let s:input = "" |
555 call s:test_windows('setl breakindent briopt= ts=8 sw=8 vts=8') | 521 call s:test_windows('setl breakindent briopt= ts=8 sw=8 vts=8') |
556 vert resize 30 | 522 vert resize 30 |
557 norm! 4a1234567890 | 523 norm! 4a1234567890 |
558 exe "normal! >>\<C-V>3f0x" | 524 exe "normal! >>\<C-V>3f0x" |
590 call s:compare_lines(expect, lines) | 556 call s:compare_lines(expect, lines) |
591 call s:close_windows() | 557 call s:close_windows() |
592 endfunc | 558 endfunc |
593 | 559 |
594 func Test_breakindent16_vartabs() | 560 func Test_breakindent16_vartabs() |
595 if !has("vartabs") | 561 CheckFeature vartabs |
596 return | |
597 endif | |
598 " Check that overlong lines are indented correctly. | 562 " Check that overlong lines are indented correctly. |
599 let s:input = "" | 563 let s:input = "" |
600 call s:test_windows('setl breakindent briopt=min:0 ts=4 vts=4') | 564 call s:test_windows('setl breakindent briopt=min:0 ts=4 vts=4') |
601 call setline(1, "\t".repeat("1234567890", 10)) | 565 call setline(1, "\t".repeat("1234567890", 10)) |
602 resize 6 | 566 resize 6 |
618 call s:compare_lines(expect, lines) | 582 call s:compare_lines(expect, lines) |
619 call s:close_windows('set vts&') | 583 call s:close_windows('set vts&') |
620 endfunc | 584 endfunc |
621 | 585 |
622 func Test_breakindent17_vartabs() | 586 func Test_breakindent17_vartabs() |
623 if !has("vartabs") | 587 CheckFeature vartabs |
624 return | |
625 endif | |
626 let s:input = "" | 588 let s:input = "" |
627 call s:test_windows('setl breakindent list listchars=tab:<-> showbreak=+++') | 589 call s:test_windows('setl breakindent list listchars=tab:<-> showbreak=+++') |
628 call setline(1, "\t" . repeat('a', 63)) | 590 call setline(1, "\t" . repeat('a', 63)) |
629 vert resize 30 | 591 vert resize 30 |
630 norm! 1gg$ | 592 norm! 1gg$ |
638 call s:compare_lines(expect, lines) | 600 call s:compare_lines(expect, lines) |
639 call s:close_windows('set breakindent& list& listchars& showbreak&') | 601 call s:close_windows('set breakindent& list& listchars& showbreak&') |
640 endfunc | 602 endfunc |
641 | 603 |
642 func Test_breakindent18_vartabs() | 604 func Test_breakindent18_vartabs() |
643 if !has("vartabs") | 605 CheckFeature vartabs |
644 return | |
645 endif | |
646 let s:input = "" | 606 let s:input = "" |
647 call s:test_windows('setl breakindent list listchars=tab:<->') | 607 call s:test_windows('setl breakindent list listchars=tab:<->') |
648 call setline(1, "\t" . repeat('a', 63)) | 608 call setline(1, "\t" . repeat('a', 63)) |
649 vert resize 30 | 609 vert resize 30 |
650 norm! 1gg$ | 610 norm! 1gg$ |