diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-12-21 23:56:10 -0500 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-12-22 18:08:35 -0500 |
commit | 2b781a6d7f0bda56b9c5491724fabc38a19ca545 (patch) | |
tree | 28330ea4b7b81d60292c581d628a9050b1c7970f | |
parent | b931a554d70ef07803da3eb3f98ce4b3a3570d11 (diff) | |
download | rneovim-2b781a6d7f0bda56b9c5491724fabc38a19ca545.tar.gz rneovim-2b781a6d7f0bda56b9c5491724fabc38a19ca545.tar.bz2 rneovim-2b781a6d7f0bda56b9c5491724fabc38a19ca545.zip |
vim-patch:8.1.1047: WINCH signal is not tested
Problem: WINCH signal is not tested.
Solution: Add a test. (Dominique Pelle, closes vim/vim#4158)
https://github.com/vim/vim/commit/db77b84ac2b6373ae4200d47945fc6ca64337e31
-rw-r--r-- | src/nvim/testdir/test_signals.vim | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_signals.vim b/src/nvim/testdir/test_signals.vim new file mode 100644 index 0000000000..cdea278fa0 --- /dev/null +++ b/src/nvim/testdir/test_signals.vim @@ -0,0 +1,45 @@ +" Test signal handling. + +if !has('unix') + finish +endif + +source shared.vim + +" Test signal WINCH (window resize signal) +func Test_signal_WINCH() + throw 'skipped: Nvim cannot avoid terminal resize' + let signals = system('kill -l') + if signals !~ '\<WINCH\>' + " signal WINCH is not available, skip the test. + return + 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 |