Mercurial > vim
comparison src/testdir/test_match.vim @ 30582:72245f9c9405 v9.0.0626
patch 9.0.0626: too many delete() calls in tests
Commit: https://github.com/vim/vim/commit/b152b6a40f729ed81a25d2fa541a4e73e201bec4
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Sep 29 21:37:33 2022 +0100
patch 9.0.0626: too many delete() calls in tests
Problem: Too many delete() calls in tests.
Solution: Use deferred delete where possible.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 29 Sep 2022 22:45:04 +0200 |
parents | 66de6909e102 |
children | a357a624e487 |
comparison
equal
deleted
inserted
replaced
30581:2e1ec75a7766 | 30582:72245f9c9405 |
---|---|
370 let lines =<< trim END | 370 let lines =<< trim END |
371 set breakindent linebreak breakat+=] | 371 set breakindent linebreak breakat+=] |
372 call printf('%s]%s', repeat('x', 50), repeat('x', 70))->setline(1) | 372 call printf('%s]%s', repeat('x', 50), repeat('x', 70))->setline(1) |
373 call matchaddpos('ErrorMsg', [[1, 51]]) | 373 call matchaddpos('ErrorMsg', [[1, 51]]) |
374 END | 374 END |
375 call writefile(lines, 'XscriptMatchLinebreak') | 375 call writefile(lines, 'XscriptMatchLinebreak', 'D') |
376 let buf = RunVimInTerminal('-S XscriptMatchLinebreak', #{rows: 10}) | 376 let buf = RunVimInTerminal('-S XscriptMatchLinebreak', #{rows: 10}) |
377 call VerifyScreenDump(buf, 'Test_match_linebreak', {}) | 377 call VerifyScreenDump(buf, 'Test_match_linebreak', {}) |
378 | 378 |
379 call StopVimInTerminal(buf) | 379 call StopVimInTerminal(buf) |
380 call delete('XscriptMatchLinebreak') | |
381 endfunc | 380 endfunc |
382 | 381 |
383 func Test_match_with_incsearch() | 382 func Test_match_with_incsearch() |
384 CheckRunVimInTerminal | 383 CheckRunVimInTerminal |
385 | 384 |
386 let lines =<< trim END | 385 let lines =<< trim END |
387 set incsearch | 386 set incsearch |
388 call setline(1, range(20)) | 387 call setline(1, range(20)) |
389 call matchaddpos('ErrorMsg', [3]) | 388 call matchaddpos('ErrorMsg', [3]) |
390 END | 389 END |
391 call writefile(lines, 'XmatchWithIncsearch') | 390 call writefile(lines, 'XmatchWithIncsearch', 'D') |
392 let buf = RunVimInTerminal('-S XmatchWithIncsearch', #{rows: 6}) | 391 let buf = RunVimInTerminal('-S XmatchWithIncsearch', #{rows: 6}) |
393 call VerifyScreenDump(buf, 'Test_match_with_incsearch_1', {}) | 392 call VerifyScreenDump(buf, 'Test_match_with_incsearch_1', {}) |
394 | 393 |
395 call term_sendkeys(buf, ":s/0") | 394 call term_sendkeys(buf, ":s/0") |
396 call VerifyScreenDump(buf, 'Test_match_with_incsearch_2', {}) | 395 call VerifyScreenDump(buf, 'Test_match_with_incsearch_2', {}) |
397 | 396 |
398 call term_sendkeys(buf, "\<CR>") | 397 call term_sendkeys(buf, "\<CR>") |
399 call StopVimInTerminal(buf) | 398 call StopVimInTerminal(buf) |
400 call delete('XmatchWithIncsearch') | |
401 endfunc | 399 endfunc |
402 | 400 |
403 " Test for deleting matches outside of the screen redraw top/bottom lines | 401 " Test for deleting matches outside of the screen redraw top/bottom lines |
404 " This should cause a redraw of those lines. | 402 " This should cause a redraw of those lines. |
405 func Test_matchdelete_redraw() | 403 func Test_matchdelete_redraw() |
426 let lines =<< trim END | 424 let lines =<< trim END |
427 set linebreak | 425 set linebreak |
428 call setline(1, "\tix") | 426 call setline(1, "\tix") |
429 call matchadd('ErrorMsg', '\t') | 427 call matchadd('ErrorMsg', '\t') |
430 END | 428 END |
431 call writefile(lines, 'XscriptMatchTabLinebreak') | 429 call writefile(lines, 'XscriptMatchTabLinebreak', 'D') |
432 let buf = RunVimInTerminal('-S XscriptMatchTabLinebreak', #{rows: 10}) | 430 let buf = RunVimInTerminal('-S XscriptMatchTabLinebreak', #{rows: 10}) |
433 call VerifyScreenDump(buf, 'Test_match_tab_linebreak', {}) | 431 call VerifyScreenDump(buf, 'Test_match_tab_linebreak', {}) |
434 | 432 |
435 call StopVimInTerminal(buf) | 433 call StopVimInTerminal(buf) |
436 call delete('XscriptMatchTabLinebreak') | |
437 endfunc | 434 endfunc |
438 | 435 |
439 | 436 |
440 " vim: shiftwidth=2 sts=2 expandtab | 437 " vim: shiftwidth=2 sts=2 expandtab |