summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.1212
blob: c402af49621254c66f4940265c8f9361cfd40aef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
To: vim_dev@googlegroups.com
Subject: Patch 8.1.1212
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 8.1.1212
Problem:    Signal PWR is not tested.
Solution:   Test that PWR updates the swap file. (Dominique Pelle,
            closes #4312)
Files:	    src/testdir/test_signals.vim


*** ../vim-8.1.1211/src/testdir/test_signals.vim	2019-04-02 21:45:38.260326643 +0200
--- src/testdir/test_signals.vim	2019-04-27 17:30:53.055172109 +0200
***************
*** 4,21 ****
    finish
  endif
  
- if has('gui_running')
-   " Signals only work for terminals, and won't work for GUI.
-   finish
- endif
- 
  source shared.vim
  
  " Test signal WINCH (window resize signal)
  func Test_signal_WINCH()
!   let signals = system('kill -l')
!   if signals !~ '\<WINCH\>'
!     " signal WINCH is not available, skip the test.
      return
    endif
  
--- 4,20 ----
    finish
  endif
  
  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()
!   if has('gui_running') || !HasSignal('WINCH')
      return
    endif
  
***************
*** 31,45 ****
    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)
  
--- 30,44 ----
    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)
  
***************
*** 47,49 ****
--- 46,77 ----
      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
*** ../vim-8.1.1211/src/version.c	2019-04-27 15:05:04.528816589 +0200
--- src/version.c	2019-04-27 17:31:56.794872746 +0200
***************
*** 769,770 ****
--- 769,772 ----
  {   /* Add new patch number below this line */
+ /**/
+     1212,
  /**/

-- 
CUSTOMER:     You're not fooling anyone y'know.  Look, isn't there something
              you can do?
DEAD PERSON:  I feel happy... I feel happy.
    [whop]
CUSTOMER:     Ah, thanks very much.
MORTICIAN:    Not at all.  See you on Thursday.
CUSTOMER:     Right.
                                  The Quest for the Holy Grail (Monty Python)

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///