Mercurial > vim
comparison src/testdir/test_autocmd.vim @ 22576:170077e26bde v8.2.1836
patch 8.2.1836: autocmd test fails on pacifist systems
Commit: https://github.com/vim/vim/commit/62cd26a2294b7a5eead7c145e9bbc7c75f3bb801
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Oct 11 20:08:44 2020 +0200
patch 8.2.1836: autocmd test fails on pacifist systems
Problem: Autocmd test fails on pacifist systems.
Solution: Check that /bin/kill exists. (James McCoy, closes https://github.com/vim/vim/issues/7117)
Tune the timing, make the autocmd test run faster.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 11 Oct 2020 20:15:03 +0200 |
parents | 595ea7f099cd |
children | f7f2d73ff85e |
comparison
equal
deleted
inserted
replaced
22575:ed8a576def17 | 22576:170077e26bde |
---|---|
28 au CursorHold * call writefile([line('.')], 'Xoutput', 'a') | 28 au CursorHold * call writefile([line('.')], 'Xoutput', 'a') |
29 END | 29 END |
30 call writefile(before, 'Xinit') | 30 call writefile(before, 'Xinit') |
31 let buf = RunVimInTerminal('-S Xinit Xfile', {}) | 31 let buf = RunVimInTerminal('-S Xinit Xfile', {}) |
32 call term_sendkeys(buf, "G") | 32 call term_sendkeys(buf, "G") |
33 call term_wait(buf, 20) | 33 call term_wait(buf, 50) |
34 call term_sendkeys(buf, "gg") | 34 call term_sendkeys(buf, "gg") |
35 call term_wait(buf) | 35 call term_wait(buf) |
36 call WaitForAssert({-> assert_equal(['1'], readfile('Xoutput')[-1:-1])}) | 36 call WaitForAssert({-> assert_equal(['1'], readfile('Xoutput')[-1:-1])}) |
37 call term_sendkeys(buf, "j") | 37 call term_sendkeys(buf, "j") |
38 call term_wait(buf) | 38 call term_wait(buf) |
75 | 75 |
76 " Confirm the timer invoked in exit_cb of the job doesn't disturb | 76 " Confirm the timer invoked in exit_cb of the job doesn't disturb |
77 " CursorHoldI event. | 77 " CursorHoldI event. |
78 let g:triggered = 0 | 78 let g:triggered = 0 |
79 au CursorHoldI * let g:triggered += 1 | 79 au CursorHoldI * let g:triggered += 1 |
80 set updatetime=500 | 80 set updatetime=100 |
81 call job_start(has('win32') ? 'cmd /c echo:' : 'echo', | 81 call job_start(has('win32') ? 'cmd /c echo:' : 'echo', |
82 \ {'exit_cb': {-> timer_start(1000, 'ExitInsertMode')}}) | 82 \ {'exit_cb': {-> timer_start(200, 'ExitInsertMode')}}) |
83 call feedkeys('a', 'x!') | 83 call feedkeys('a', 'x!') |
84 call assert_equal(1, g:triggered) | 84 call assert_equal(1, g:triggered) |
85 unlet g:triggered | 85 unlet g:triggered |
86 au! CursorHoldI | 86 au! CursorHoldI |
87 set updatetime& | 87 set updatetime& |
450 file Xsomething | 450 file Xsomething |
451 set noswapfile | 451 set noswapfile |
452 mksession! | 452 mksession! |
453 | 453 |
454 let content =<< trim [CODE] | 454 let content =<< trim [CODE] |
455 call test_override('ui_delay', 10) | |
455 set nocp noswapfile | 456 set nocp noswapfile |
456 let v:swapchoice="e" | 457 let v:swapchoice="e" |
457 augroup test_autocmd_sessionload | 458 augroup test_autocmd_sessionload |
458 autocmd! | 459 autocmd! |
459 autocmd SessionLoadPost * exe bufnr("Xsomething") . "bw!" | 460 autocmd SessionLoadPost * exe bufnr("Xsomething") . "bw!" |
2419 endfunc | 2420 endfunc |
2420 | 2421 |
2421 " Test closing a window or editing another buffer from a FileChangedRO handler | 2422 " Test closing a window or editing another buffer from a FileChangedRO handler |
2422 " in a readonly buffer | 2423 " in a readonly buffer |
2423 func Test_FileChangedRO_winclose() | 2424 func Test_FileChangedRO_winclose() |
2425 call test_override('ui_delay', 10) | |
2426 | |
2424 augroup FileChangedROTest | 2427 augroup FileChangedROTest |
2425 au! | 2428 au! |
2426 autocmd FileChangedRO * quit | 2429 autocmd FileChangedRO * quit |
2427 augroup END | 2430 augroup END |
2428 new | 2431 new |
2438 new | 2441 new |
2439 set readonly | 2442 set readonly |
2440 call assert_fails('normal i', 'E788:') | 2443 call assert_fails('normal i', 'E788:') |
2441 close | 2444 close |
2442 augroup! FileChangedROTest | 2445 augroup! FileChangedROTest |
2446 call test_override('ALL', 0) | |
2443 endfunc | 2447 endfunc |
2444 | 2448 |
2445 func LogACmd() | 2449 func LogACmd() |
2446 call add(g:logged, line('$')) | 2450 call add(g:logged, line('$')) |
2447 endfunc | 2451 endfunc |
2531 endfunc | 2535 endfunc |
2532 | 2536 |
2533 " Tests for SigUSR1 autocmd event, which is only available on posix systems. | 2537 " Tests for SigUSR1 autocmd event, which is only available on posix systems. |
2534 func Test_autocmd_sigusr1() | 2538 func Test_autocmd_sigusr1() |
2535 CheckUnix | 2539 CheckUnix |
2540 CheckExecutable /bin/kill | |
2536 | 2541 |
2537 let g:sigusr1_passed = 0 | 2542 let g:sigusr1_passed = 0 |
2538 au SigUSR1 * let g:sigusr1_passed = 1 | 2543 au SigUSR1 * let g:sigusr1_passed = 1 |
2539 call system('/bin/kill -s usr1 ' . getpid()) | 2544 call system('/bin/kill -s usr1 ' . getpid()) |
2540 call WaitForAssert({-> assert_true(g:sigusr1_passed)}) | 2545 call WaitForAssert({-> assert_true(g:sigusr1_passed)}) |