mirror of
https://github.com/neovim/neovim.git
synced 2026-08-28 18:11:47 +00:00
vim-patch:8.2.2070: can't get the exit value in VimLeave(Pre) autocommands (#13981)
Problem: Can't get the exit value in VimLeave or VimLeavePre autocommands. Solution: Add v:exiting like in Neovim. (Yegappan Lakshmanan, closes vim/vim#7395)f0068c5154Rearrange VimVarIndex enums and vimvars[] entries to sync with Vim. N/A patches for version.c: vim-patch:8.2.2535: MS-Windows: cannot run all vim9 tests Problem: MS-Windows: cannot run all vim9 tests. Solution: Make test_vim9 target work.723ef5db98
This commit is contained in:
@@ -81,3 +81,32 @@ func Test_exiting()
|
||||
endif
|
||||
call delete('Xtestout')
|
||||
endfunc
|
||||
|
||||
" Test for getting the Vim exit code from v:exiting
|
||||
func Test_exit_code()
|
||||
call assert_equal(v:null, v:exiting)
|
||||
|
||||
let before =<< trim [CODE]
|
||||
au QuitPre * call writefile(['qp = ' .. v:exiting], 'Xtestout', 'a')
|
||||
au ExitPre * call writefile(['ep = ' .. v:exiting], 'Xtestout', 'a')
|
||||
au VimLeavePre * call writefile(['lp = ' .. v:exiting], 'Xtestout', 'a')
|
||||
au VimLeave * call writefile(['l = ' .. v:exiting], 'Xtestout', 'a')
|
||||
[CODE]
|
||||
|
||||
if RunVim(before, ['quit'], '')
|
||||
call assert_equal(['qp = null', 'ep = null', 'lp = 0', 'l = 0'], readfile('Xtestout'))
|
||||
endif
|
||||
call delete('Xtestout')
|
||||
|
||||
if RunVim(before, ['cquit'], '')
|
||||
call assert_equal(['lp = 1', 'l = 1'], readfile('Xtestout'))
|
||||
endif
|
||||
call delete('Xtestout')
|
||||
|
||||
if RunVim(before, ['cquit 4'], '')
|
||||
call assert_equal(['lp = 4', 'l = 4'], readfile('Xtestout'))
|
||||
endif
|
||||
call delete('Xtestout')
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
Reference in New Issue
Block a user