annotate src/testdir/test_signals.vim @ 16084:ed1482db2d72 v8.1.1047

patch 8.1.1047: WINCH signal is not tested commit https://github.com/vim/vim/commit/db77b84ac2b6373ae4200d47945fc6ca64337e31 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 24 14:58:31 2019 +0100 patch 8.1.1047: WINCH signal is not tested Problem: WINCH signal is not tested. Solution: Add a test. (Dominique Pelle, closes https://github.com/vim/vim/issues/4158)
author Bram Moolenaar <Bram@vim.org>
date Sun, 24 Mar 2019 15:00:07 +0100
parents
children 1ab0d1f7807a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16084
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Test signal handling.
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 if !has('unix')
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 finish
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 endif
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 source shared.vim
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 " Test signal WINCH (window resize signal)
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 func Test_signal_WINCH()
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 let signals = system('kill -l')
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 if signals !~ '\<WINCH\>'
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 " signal WINCH is not available, skip the test.
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 return
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 endif
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 " We do not actually want to change the size of the terminal.
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 let old_WS = ''
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 if exists('&t_WS')
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 let old_WS = &t_WS
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 let &t_WS = ''
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 endif
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 let old_lines = &lines
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 let old_columns = &columns
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 let new_lines = &lines - 2
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 let new_columns = &columns - 2
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 exe 'set lines=' . new_lines
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 exe 'set columns=' . new_columns
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 call assert_equal(new_lines, &lines)
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 call assert_equal(new_columns, &columns)
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 " Send signal and wait for signal to be processed.
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 " 'lines' and 'columns' should have been restored
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 " after handing signal WINCH.
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 exe 'silent !kill -s WINCH ' . getpid()
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 call WaitForAssert({-> assert_equal(old_lines, &lines)})
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 call assert_equal(old_columns, &columns)
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 if old_WS != ''
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 let &t_WS = old_WS
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 endif
ed1482db2d72 patch 8.1.1047: WINCH signal is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 endfunc