patch 9.0.1538: :wqall does not trigger ExitPre

Problem:    :wqall does not trigger ExitPre. (Bart Libert)
Solution:   Move preparations for :qall to a common function. (closes #12374)
diff --git a/src/testdir/test_exit.vim b/src/testdir/test_exit.vim
index 9e9370e..b0446ba 100644
--- a/src/testdir/test_exit.vim
+++ b/src/testdir/test_exit.vim
@@ -81,6 +81,18 @@
 	  \ readfile('Xtestout'))
   endif
   call delete('Xtestout')
+
+  " ExitPre autocommand also executed on :wqall
+  let after =<< trim [CODE]
+    au QuitPre * call writefile(["QuitPre"], "Xtestout", "a")
+    au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")
+    wqall
+  [CODE]
+
+  if RunVim([], after, '')
+    call assert_equal(['QuitPre', 'ExitPre'], readfile('Xtestout'))
+  endif
+  call delete('Xtestout')
 endfunc
 
 " Test for getting the Vim exit code from v:exiting