Problem: INT signal not properly tested.
Solution: Add a test. Also clean up some unnecessary lines. (Dominique
Pelle, closes #5828)
call VerifyScreenDump(buf, 'Test_long_file_name_1', {})
- call term_sendkeys(buf, ":q\<cr>")
-
" clean up
call StopVimInTerminal(buf)
call delete(longName)
call term_sendkeys(buf, ":vi\<CR>")
call WaitForAssert({-> assert_match('foo bar', term_getline(buf, 1))}, 1000)
- call term_sendkeys(buf, ":q!\n")
call StopVimInTerminal(buf)
endfunc
call WaitForAssert({-> assert_match('^\[Y\]es, (N)o, (C)ancel: *$',
\ term_getline(buf, 20))}, 1000)
call term_sendkeys(buf, "N")
- call term_sendkeys(buf, ":quit\n")
call StopVimInTerminal(buf)
call delete('foo')
call term_sendkeys(buf, 'q')
call WaitForAssert({-> assert_equal('100', term_getline(buf, 5))})
- call term_sendkeys(buf, ":q!\n")
call StopVimInTerminal(buf)
endfunc
call WaitForAssert({-> assert_equal('y1', term_getline(buf, 1))})
call WaitForAssert({-> assert_equal('y2', term_getline(buf, 2))})
- call term_sendkeys(buf, ":q!\n")
call StopVimInTerminal(buf)
endfunc
" Test signal handling.
source check.vim
+source term_util.vim
+
CheckUnix
source shared.vim
" Test signal PWR, which should update the swap file.
func Test_signal_PWR()
if !HasSignal('PWR')
- return
+ throw 'Skipped: PWR signal not supported'
endif
" Set a very large 'updatetime' and 'updatecount', so that we can be sure
bwipe!
set updatetime& updatecount&
endfunc
+
+" Test signal INT. Handler sets got_int. It should be like typing CTRL-C.
+func Test_signal_INT()
+ if !HasSignal('INT')
+ throw 'Skipped: INT signal not supported'
+ endif
+
+ " Skip the rest of the test when running with valgrind as signal INT is not
+ " received somehow by Vim when running with valgrind.
+ let cmd = GetVimCommand()
+ if cmd =~ 'valgrind'
+ throw 'Skipped: cannot test signal INT with valgrind'
+ endif
+
+ if !CanRunVimInTerminal()
+ throw 'Skipped: cannot run vim in terminal'
+ endif
+ let buf = RunVimInTerminal('', {'rows': 6})
+ let pid_vim = term_getjob(buf)->job_info().process
+
+ " Check that an endless loop in Vim is interrupted by signal INT.
+ call term_sendkeys(buf, ":while 1 | endwhile\n")
+ call WaitForAssert({-> assert_equal(':while 1 | endwhile', term_getline(buf, 6))})
+ exe 'silent !kill -s INT ' .. pid_vim
+ call term_sendkeys(buf, ":call setline(1, 'INTERUPTED')\n")
+ call WaitForAssert({-> assert_equal('INTERUPTED', term_getline(buf, 1))})
+
+ call StopVimInTerminal(buf)
+endfunc
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 433,
/**/
432,
/**/