vim-patch:8.2.0444: swap file test fails on some systems

Problem:    Swap file test fails on some systems.
Solution:   Preserve the swap file. Send NL terminated keys.
d36ef573b2

Cherry-pick Test_swap_prompt_splitwin() from patch 8.2.0301.
This commit is contained in:
Jan Edmund Lazo
2020-10-16 22:57:58 -04:00
parent 96a555346b
commit 1d736a1ae2

View File

@@ -1,5 +1,7 @@
" Tests for the swap feature
source check.vim
func s:swapname()
return trim(execute('swapname'))
endfunc
@@ -305,3 +307,31 @@ func Test_swap_recover_ext()
augroup END
augroup! test_swap_recover_ext
endfunc
" Test for selecting 'q' in the attention prompt
func Test_swap_prompt_splitwin()
CheckRunVimInTerminal
call writefile(['foo bar'], 'Xfile1')
edit Xfile1
preserve " should help to make sure the swap file exists
let buf = RunVimInTerminal('', {'rows': 20})
call term_sendkeys(buf, ":set nomore\n")
call term_sendkeys(buf, ":set noruler\n")
call term_sendkeys(buf, ":split Xfile1\n")
call term_wait(buf)
call WaitForAssert({-> assert_match('^\[O\]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort: $', term_getline(buf, 20))})
call term_sendkeys(buf, "q")
call term_wait(buf)
call term_sendkeys(buf, ":\<CR>")
call WaitForAssert({-> assert_match('^:$', term_getline(buf, 20))})
call term_sendkeys(buf, ":echomsg winnr('$')\<CR>")
call term_wait(buf)
call WaitForAssert({-> assert_match('^1$', term_getline(buf, 20))})
call StopVimInTerminal(buf)
%bwipe!
call delete('Xfile1')
endfunc
" vim: shiftwidth=2 sts=2 expandtab