diff src/testdir/test_quickfix.vim @ 19069:e14feba578f1 v8.2.0095

patch 8.2.0095: cannot specify exit code for :cquit Commit: https://github.com/vim/vim/commit/1860bde9d31bbb0ba857f6284f6332a7134030dd Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jan 6 21:47:21 2020 +0100 patch 8.2.0095: cannot specify exit code for :cquit Problem: Cannot specify exit code for :cquit. Solution: Add optional argument. (Thinca, Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5442)
author Bram Moolenaar <Bram@vim.org>
date Mon, 06 Jan 2020 22:00:06 +0100
parents f98368dd6615
children 2ef19eed524a
line wrap: on
line diff
--- a/src/testdir/test_quickfix.vim
+++ b/src/testdir/test_quickfix.vim
@@ -4674,4 +4674,29 @@ func Test_search_in_dirstack()
   call delete('Xtestdir', 'rf')
 endfunc
 
+" Test for :cquit
+func Test_cquit()
+  " Exit Vim with a non-zero value
+  if RunVim([], ["cquit 7"], '')
+    call assert_equal(7, v:shell_error)
+  endif
+
+  if RunVim([], ["50cquit"], '')
+    call assert_equal(50, v:shell_error)
+  endif
+
+  " Exit Vim with default value
+  if RunVim([], ["cquit"], '')
+    call assert_equal(1, v:shell_error)
+  endif
+
+  " Exit Vim with zero value
+  if RunVim([], ["cquit 0"], '')
+    call assert_equal(0, v:shell_error)
+  endif
+
+  " Exit Vim with negative value
+  call assert_fails('-3cquit', 'E16:')
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab