aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorJan Edmund Lazo <janedmundlazo@hotmail.com>2018-09-04 21:57:45 -0400
committerJan Edmund Lazo <janedmundlazo@hotmail.com>2018-09-04 22:40:48 -0400
commit958467456930badcaf218b6fac56b105ac7655c8 (patch)
treea457601f6ac69690b9f894338ba5dfdef4c8581b /src/nvim/testdir
parentb6e83ba28469345ee145ab6da2c4ef7f3285d726 (diff)
downloadrneovim-958467456930badcaf218b6fac56b105ac7655c8.tar.gz
rneovim-958467456930badcaf218b6fac56b105ac7655c8.tar.bz2
rneovim-958467456930badcaf218b6fac56b105ac7655c8.zip
vim-patch:8.0.1595: no autocommand triggered before exiting
Problem: No autocommand triggered before exiting. Solution: Add the ExitPre autocommand event. https://github.com/vim/vim/commit/12a96de430779b88795fac87a2be666d9f661d1e
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_exit.vim57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_exit.vim b/src/nvim/testdir/test_exit.vim
new file mode 100644
index 0000000000..8f02fd29e3
--- /dev/null
+++ b/src/nvim/testdir/test_exit.vim
@@ -0,0 +1,57 @@
+" Tests for exiting Vim.
+
+source shared.vim
+
+func Test_exiting()
+ let after = [
+ \ 'au QuitPre * call writefile(["QuitPre"], "Xtestout")',
+ \ 'au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")',
+ \ 'quit',
+ \ ]
+ if RunVim([], after, '')
+ call assert_equal(['QuitPre', 'ExitPre'], readfile('Xtestout'))
+ endif
+ call delete('Xtestout')
+
+ let after = [
+ \ 'au QuitPre * call writefile(["QuitPre"], "Xtestout")',
+ \ 'au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")',
+ \ 'help',
+ \ 'wincmd w',
+ \ 'quit',
+ \ ]
+ if RunVim([], after, '')
+ call assert_equal(['QuitPre', 'ExitPre'], readfile('Xtestout'))
+ endif
+ call delete('Xtestout')
+
+ let after = [
+ \ 'au QuitPre * call writefile(["QuitPre"], "Xtestout")',
+ \ 'au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")',
+ \ 'split',
+ \ 'new',
+ \ 'qall',
+ \ ]
+ if RunVim([], after, '')
+ call assert_equal(['QuitPre', 'ExitPre'], readfile('Xtestout'))
+ endif
+ call delete('Xtestout')
+
+ let after = [
+ \ 'au QuitPre * call writefile(["QuitPre"], "Xtestout", "a")',
+ \ 'au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")',
+ \ 'augroup nasty',
+ \ ' au ExitPre * split',
+ \ 'augroup END',
+ \ 'quit',
+ \ 'augroup nasty',
+ \ ' au! ExitPre',
+ \ 'augroup END',
+ \ 'quit',
+ \ ]
+ if RunVim([], after, '')
+ call assert_equal(['QuitPre', 'ExitPre', 'QuitPre', 'ExitPre'],
+ \ readfile('Xtestout'))
+ endif
+ call delete('Xtestout')
+endfunc