Mercurial > vim
comparison src/testdir/test_substitute.vim @ 29115:f371242b6a23 v8.2.5078
patch 8.2.5078: substitute test has a one second delay
Commit: https://github.com/vim/vim/commit/3269efdf014dd3b6e60e330950d40a7cc5d13d3a
Author: zeertzjq <zeertzjq@outlook.com>
Date: Sun Jun 12 11:13:05 2022 +0100
patch 8.2.5078: substitute test has a one second delay
Problem: Substitute test has a one second delay.
Solution: Use ":silent!". Add another test case. (closes https://github.com/vim/vim/issues/10558)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 12 Jun 2022 12:15:03 +0200 |
parents | 55ce8628cd9b |
children | 9e0b45df95b0 |
comparison
equal
deleted
inserted
replaced
29114:547cf1114034 | 29115:f371242b6a23 |
---|---|
467 func Run_SubCmd_Tests(tests) | 467 func Run_SubCmd_Tests(tests) |
468 enew! | 468 enew! |
469 for t in a:tests | 469 for t in a:tests |
470 let start = line('.') + 1 | 470 let start = line('.') + 1 |
471 let end = start + len(t[2]) - 1 | 471 let end = start + len(t[2]) - 1 |
472 " TODO: why is there a one second delay the first time we get here? | |
473 exe "normal o" . t[0] | 472 exe "normal o" . t[0] |
474 call cursor(start, 1) | 473 call cursor(start, 1) |
475 exe t[1] | 474 exe t[1] |
476 call assert_equal(t[2], getline(start, end), t[1]) | 475 call assert_equal(t[2], getline(start, end), t[1]) |
477 endfor | 476 endfor |
502 \ ['qQq', 's/Q/\t/', ["q\tq"]], | 501 \ ['qQq', 's/Q/\t/', ["q\tq"]], |
503 \ ['rRr', 's/R/\\/', ['r\r']], | 502 \ ['rRr', 's/R/\\/', ['r\r']], |
504 \ ['sSs', 's/S/\c/', ['scs']], | 503 \ ['sSs', 's/S/\c/', ['scs']], |
505 \ ['tTt', "s/T/\<C-V>\<C-J>/", ["t\<C-V>\<C-J>t"]], | 504 \ ['tTt', "s/T/\<C-V>\<C-J>/", ["t\<C-V>\<C-J>t"]], |
506 \ ['U', 's/U/\L\uuUu\l\EU/', ['UuuU']], | 505 \ ['U', 's/U/\L\uuUu\l\EU/', ['UuuU']], |
507 \ ['V', 's/V/\U\lVvV\u\Ev/', ['vVVv']] | 506 \ ['V', 's/V/\U\lVvV\u\Ev/', ['vVVv']], |
507 \ ['\', 's/\\/\\\\/', ['\\']] | |
508 \ ] | 508 \ ] |
509 call Run_SubCmd_Tests(tests) | 509 call Run_SubCmd_Tests(tests) |
510 endfunc | 510 endfunc |
511 | 511 |
512 func Test_sub_cmd_2() | 512 func Test_sub_cmd_2() |
533 \ ['qQq', 's/Q/\t/', ["q\tq"]], | 533 \ ['qQq', 's/Q/\t/', ["q\tq"]], |
534 \ ['rRr', 's/R/\\/', ['r\r']], | 534 \ ['rRr', 's/R/\\/', ['r\r']], |
535 \ ['sSs', 's/S/\c/', ['scs']], | 535 \ ['sSs', 's/S/\c/', ['scs']], |
536 \ ['tTt', "s/T/\<C-V>\<C-J>/", ["t\<C-V>\<C-J>t"]], | 536 \ ['tTt', "s/T/\<C-V>\<C-J>/", ["t\<C-V>\<C-J>t"]], |
537 \ ['U', 's/U/\L\uuUu\l\EU/', ['UuuU']], | 537 \ ['U', 's/U/\L\uuUu\l\EU/', ['UuuU']], |
538 \ ['V', 's/V/\U\lVvV\u\Ev/', ['vVVv']] | 538 \ ['V', 's/V/\U\lVvV\u\Ev/', ['vVVv']], |
539 \ ['\', 's/\\/\\\\/', ['\\']] | |
539 \ ] | 540 \ ] |
540 call Run_SubCmd_Tests(tests) | 541 call Run_SubCmd_Tests(tests) |
541 endfunc | 542 endfunc |
542 | 543 |
543 func Test_sub_cmd_3() | 544 func Test_sub_cmd_3() |
688 func Foo() | 689 func Foo() |
689 foobar | 690 foobar |
690 endfunc | 691 endfunc |
691 new | 692 new |
692 call setline(1, ['1 aaa', '2 aaa', '3 aaa']) | 693 call setline(1, ['1 aaa', '2 aaa', '3 aaa']) |
693 %s/aaa/\=Foo()/g | 694 " need silent! to avoid a delay when entering Insert mode |
695 silent! %s/aaa/\=Foo()/g | |
694 call assert_equal(['1 0', '2 0', '3 0'], getline(1, 3)) | 696 call assert_equal(['1 0', '2 0', '3 0'], getline(1, 3)) |
695 | 697 |
696 " Trow without try-catch causes abort after the first line. | 698 " Throw without try-catch causes abort after the first line. |
697 " We cannot test this, since it would stop executing the test script. | 699 " We cannot test this, since it would stop executing the test script. |
698 | 700 |
699 " try/catch does not result in any changes | 701 " try/catch does not result in any changes |
700 func! Foo() | 702 func! Foo() |
701 throw 'error' | 703 throw 'error' |