blob: 3fea76bd6983fde1efef0a53da665ae29415f57b [file] [log] [blame]
Bram Moolenaardb77b842019-03-24 14:58:31 +01001" Test signal handling.
2
3if !has('unix')
4 finish
5endif
6
7source shared.vim
8
9" Test signal WINCH (window resize signal)
10func Test_signal_WINCH()
11 let signals = system('kill -l')
12 if signals !~ '\<WINCH\>'
13 " signal WINCH is not available, skip the test.
14 return
15 endif
16
17 " We do not actually want to change the size of the terminal.
18 let old_WS = ''
19 if exists('&t_WS')
20 let old_WS = &t_WS
21 let &t_WS = ''
22 endif
23
24 let old_lines = &lines
25 let old_columns = &columns
26 let new_lines = &lines - 2
27 let new_columns = &columns - 2
28
29 exe 'set lines=' . new_lines
30 exe 'set columns=' . new_columns
31 call assert_equal(new_lines, &lines)
32 call assert_equal(new_columns, &columns)
33
34 " Send signal and wait for signal to be processed.
35 " 'lines' and 'columns' should have been restored
36 " after handing signal WINCH.
37 exe 'silent !kill -s WINCH ' . getpid()
38 call WaitForAssert({-> assert_equal(old_lines, &lines)})
39 call assert_equal(old_columns, &columns)
40
41 if old_WS != ''
42 let &t_WS = old_WS
43 endif
44endfunc