aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_exit.vim
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-02-20 23:45:14 -0500
committerGitHub <noreply@github.com>2021-02-20 23:45:14 -0500
commit595f6e4d64bc2b44d8b9102706a84a16ed166199 (patch)
tree198d839428d556411d8e13d6ba4c9574690dc746 /src/nvim/testdir/test_exit.vim
parent1caf58578c6e4b30c18fa56804dd905b5472b460 (diff)
downloadrneovim-595f6e4d64bc2b44d8b9102706a84a16ed166199.tar.gz
rneovim-595f6e4d64bc2b44d8b9102706a84a16ed166199.tar.bz2
rneovim-595f6e4d64bc2b44d8b9102706a84a16ed166199.zip
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) https://github.com/vim/vim/commit/f0068c5154a99b86b2c4515a4b93c003b2445cf4 Rearrange 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. https://github.com/vim/vim/commit/723ef5db980b2e69ef8bdc0dd448cb645491c464
Diffstat (limited to 'src/nvim/testdir/test_exit.vim')
-rw-r--r--src/nvim/testdir/test_exit.vim29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_exit.vim b/src/nvim/testdir/test_exit.vim
index 99a401d4a4..bd3e9eb4d4 100644
--- a/src/nvim/testdir/test_exit.vim
+++ b/src/nvim/testdir/test_exit.vim
@@ -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