]> granicus.if.org Git - vim/commitdiff
patch 8.1.0650: command line argument -q [errorfile] is not tested v8.1.0650
authorBram Moolenaar <Bram@vim.org>
Fri, 28 Dec 2018 17:32:56 +0000 (18:32 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 28 Dec 2018 17:32:56 +0000 (18:32 +0100)
Problem:    Command line argument -q [errorfile] is not tested.
Solution:   Add a test. (Dominique Pelle, closes #3730)

src/testdir/test_startup.vim
src/version.c

index 6f06ab877e5df12518dd04f5d9832c1dacfea4c1..16b202f85c0910b9d81324c21b137fe90471c091 100644 (file)
@@ -269,6 +269,53 @@ func Test_V_arg()
    call assert_match("sourcing \"$VIMRUNTIME[\\/]defaults\.vim\"\r\nline 1: \" The default vimrc file\..*  verbose=15\n", out)
 endfunc
 
+" Test the '-q [errorfile]' argument.
+func Test_q_arg()
+  let source_file = has('win32') ? '..\memfile.c' : '../memfile.c'
+  let after = [
+       \ 'call writefile([&errorfile, string(getpos("."))], "Xtestout")',
+       \ 'copen',
+       \ 'w >> Xtestout',
+       \ 'qall'
+       \ ]
+
+  " Test with default argument '-q'.
+  call assert_equal('errors.err', &errorfile)
+  call writefile(["../memfile.c:1482:5: error: expected ';' before '}' token"], 'errors.err')
+  if RunVim([], after, '-q')
+    let lines = readfile('Xtestout')
+    call assert_equal(['errors.err',
+       \              '[0, 1482, 5, 0]',
+       \              source_file . "|1482 col 5| error: expected ';' before '}' token"],
+       \             lines)
+  endif
+  call delete('Xtestout')
+  call delete('errors.err')
+
+  " Test with explicit argument '-q Xerrors' (with space).
+  call writefile(["../memfile.c:1482:5: error: expected ';' before '}' token"], 'Xerrors')
+  if RunVim([], after, '-q Xerrors')
+    let lines = readfile('Xtestout')
+    call assert_equal(['Xerrors',
+       \              '[0, 1482, 5, 0]',
+       \              source_file . "|1482 col 5| error: expected ';' before '}' token"],
+       \             lines)
+  endif
+  call delete('Xtestout')
+
+  " Test with explicit argument '-qXerrors' (without space).
+  if RunVim([], after, '-qXerrors')
+    let lines = readfile('Xtestout')
+    call assert_equal(['Xerrors',
+       \              '[0, 1482, 5, 0]',
+       \              source_file . "|1482 col 5| error: expected ';' before '}' token"],
+       \             lines)
+  endif
+
+  call delete('Xtestout')
+  call delete('Xerrors')
+endfunc
+
 " Test the -V[N]{filename} argument to set the 'verbose' option to N
 " and set 'verbosefile' to filename.
 func Test_V_file_arg()
index 870ea896de87346f3e11bd6a9c4d4e65ddd22afa..cbb0e70eaebcf5c71d61bad3b636e7cfeb916c5a 100644 (file)
@@ -799,6 +799,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    650,
 /**/
     649,
 /**/