Mercurial > vim
view src/testdir/test_signals.vim @ 18404:b1a10a018f83 v8.1.2196
patch 8.1.2196: MS-Windows: running tests with MSVC lacks updates
Commit: https://github.com/vim/vim/commit/d53ebfc6246b2f29752adbda13cd2c11acca285a
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Oct 20 21:47:20 2019 +0200
patch 8.1.2196: MS-Windows: running tests with MSVC lacks updates
Problem: MS-Windows: running tests with MSVC lacks updates.
Solution: Improve running individual tests on MS-Windows. (closes https://github.com/vim/vim/issues/4922)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 20 Oct 2019 22:00:03 +0200 |
parents | 0da9bc55c31a |
children | c9cc9e5c87e0 |
line wrap: on
line source
" Test signal handling. source check.vim CheckUnix source shared.vim " Check whether a signal is available on this system. func HasSignal(signal) let signals = system('kill -l') return signals =~# '\<' .. a:signal .. '\>' endfunc " Test signal WINCH (window resize signal) func Test_signal_WINCH() CheckNotGui if !HasSignal('WINCH') throw 'Skipped: WINCH signal not supported' endif " We do not actually want to change the size of the terminal. let old_WS = '' if exists('&t_WS') let old_WS = &t_WS let &t_WS = '' endif let old_lines = &lines let old_columns = &columns let new_lines = &lines - 2 let new_columns = &columns - 2 exe 'set lines=' .. new_lines exe 'set columns=' .. new_columns call assert_equal(new_lines, &lines) call assert_equal(new_columns, &columns) " Send signal and wait for signal to be processed. " 'lines' and 'columns' should have been restored " after handing signal WINCH. exe 'silent !kill -s WINCH ' .. getpid() call WaitForAssert({-> assert_equal(old_lines, &lines)}) call assert_equal(old_columns, &columns) if old_WS != '' let &t_WS = old_WS endif endfunc " Test signal PWR, which should update the swap file. func Test_signal_PWR() if !HasSignal('PWR') return endif " Set a very large 'updatetime' and 'updatecount', so that we can be sure " that swap file is updated as a result of sending PWR signal, and not " because of exceeding 'updatetime' or 'updatecount' when changing buffer. set updatetime=100000 updatecount=100000 new Xtest_signal_PWR let swap_name = swapname('%') call setline(1, '123') preserve let swap_content = readfile(swap_name, 'b') " Update the buffer and check that the swap file is not yet updated, " since we set 'updatetime' and 'updatecount' to large values. call setline(1, 'abc') call assert_equal(swap_content, readfile(swap_name, 'b')) " Sending PWR signal should update the swap file. exe 'silent !kill -s PWR ' .. getpid() call WaitForAssert({-> assert_notequal(swap_content, readfile(swap_name, 'b'))}) bwipe! set updatetime& updatecount& endfunc