comparison src/testdir/test_swap.vim @ 19487:0aba9ef12488 v8.2.0301

patch 8.2.0301: insufficient testing for exception handling Commit: https://github.com/vim/vim/commit/b654103ad1e379348616f354272db86804ab4bdb Author: Bram Moolenaar <Bram@vim.org> Date: Sat Feb 22 21:21:27 2020 +0100 patch 8.2.0301: insufficient testing for exception handling Problem: Insufficient testing for exception handling and the "attention" prompt. Solution: Add test cases. (Yegappan Lakshmanan, closes #5681)
author Bram Moolenaar <Bram@vim.org>
date Sat, 22 Feb 2020 21:30:04 +0100
parents 8f8a5a15d00a
children 42e4083429a7
comparison
equal deleted inserted replaced
19486:8b6a8273ac5a 19487:0aba9ef12488
1 " Tests for the swap feature 1 " Tests for the swap feature
2 2
3 source shared.vim 3 source shared.vim
4 source term_util.vim
4 5
5 func s:swapname() 6 func s:swapname()
6 return trim(execute('swapname')) 7 return trim(execute('swapname'))
7 endfunc 8 endfunc
8 9
347 autocmd! 348 autocmd!
348 augroup END 349 augroup END
349 augroup! test_swap_splitwin 350 augroup! test_swap_splitwin
350 endfunc 351 endfunc
351 352
353 " Test for selecting 'q' in the attention prompt
354 func Test_swap_prompt_splitwin()
355 if !CanRunVimInTerminal()
356 throw 'Skipped: cannot run vim in terminal'
357 endif
358 call writefile(['foo bar'], 'Xfile1')
359 edit Xfile1
360 let buf = RunVimInTerminal('', {'rows': 20})
361 call term_sendkeys(buf, ":set nomore\n")
362 call term_sendkeys(buf, ":set noruler\n")
363 call term_sendkeys(buf, ":split Xfile1\n")
364 call term_wait(buf)
365 call WaitForAssert({-> assert_match('^\[O\]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort: $', term_getline(buf, 20))})
366 call term_sendkeys(buf, "q")
367 call term_wait(buf)
368 call term_sendkeys(buf, ":")
369 call WaitForAssert({-> assert_match('^:$', term_getline(buf, 20))})
370 call term_sendkeys(buf, "echomsg winnr('$')\<CR>")
371 call term_wait(buf)
372 call WaitForAssert({-> assert_match('^1$', term_getline(buf, 20))})
373 call StopVimInTerminal(buf)
374 %bwipe!
375 call delete('Xfile1')
376 endfunc
377
352 " vim: shiftwidth=2 sts=2 expandtab 378 " vim: shiftwidth=2 sts=2 expandtab