mirror of
https://github.com/vim/vim.git
synced 2025-09-28 04:24:06 -04:00
patch 8.2.1217: startup test depends on random source file
Problem: Startup test depends on random source file. Solution: Write a test file to find quickfix errors in.
This commit is contained in:
@@ -285,7 +285,15 @@ endfunc
|
|||||||
func Test_q_arg()
|
func Test_q_arg()
|
||||||
CheckFeature quickfix
|
CheckFeature quickfix
|
||||||
|
|
||||||
let source_file = has('win32') ? '..\memfile.c' : '../memfile.c'
|
let lines =<< trim END
|
||||||
|
/* some file with an error */
|
||||||
|
main() {
|
||||||
|
functionCall(arg; arg, arg);
|
||||||
|
return 666
|
||||||
|
}
|
||||||
|
END
|
||||||
|
call writefile(lines, 'Xbadfile.c')
|
||||||
|
|
||||||
let after =<< trim [CODE]
|
let after =<< trim [CODE]
|
||||||
call writefile([&errorfile, string(getpos("."))], "Xtestout")
|
call writefile([&errorfile, string(getpos("."))], "Xtestout")
|
||||||
copen
|
copen
|
||||||
@@ -295,24 +303,24 @@ func Test_q_arg()
|
|||||||
|
|
||||||
" Test with default argument '-q'.
|
" Test with default argument '-q'.
|
||||||
call assert_equal('errors.err', &errorfile)
|
call assert_equal('errors.err', &errorfile)
|
||||||
call writefile(["../memfile.c:208:5: error: expected ';' before '}' token"], 'errors.err')
|
call writefile(["Xbadfile.c:4:12: error: expected ';' before '}' token"], 'errors.err')
|
||||||
if RunVim([], after, '-q')
|
if RunVim([], after, '-q')
|
||||||
let lines = readfile('Xtestout')
|
let lines = readfile('Xtestout')
|
||||||
call assert_equal(['errors.err',
|
call assert_equal(['errors.err',
|
||||||
\ '[0, 208, 1, 0]',
|
\ '[0, 4, 12, 0]',
|
||||||
\ source_file . "|208 col 5| error: expected ';' before '}' token"],
|
\ "Xbadfile.c|4 col 12| error: expected ';' before '}' token"],
|
||||||
\ lines)
|
\ lines)
|
||||||
endif
|
endif
|
||||||
call delete('Xtestout')
|
call delete('Xtestout')
|
||||||
call delete('errors.err')
|
call delete('errors.err')
|
||||||
|
|
||||||
" Test with explicit argument '-q Xerrors' (with space).
|
" Test with explicit argument '-q Xerrors' (with space).
|
||||||
call writefile(["../memfile.c:208:5: error: expected ';' before '}' token"], 'Xerrors')
|
call writefile(["Xbadfile.c:4:12: error: expected ';' before '}' token"], 'Xerrors')
|
||||||
if RunVim([], after, '-q Xerrors')
|
if RunVim([], after, '-q Xerrors')
|
||||||
let lines = readfile('Xtestout')
|
let lines = readfile('Xtestout')
|
||||||
call assert_equal(['Xerrors',
|
call assert_equal(['Xerrors',
|
||||||
\ '[0, 208, 1, 0]',
|
\ '[0, 4, 12, 0]',
|
||||||
\ source_file . "|208 col 5| error: expected ';' before '}' token"],
|
\ "Xbadfile.c|4 col 12| error: expected ';' before '}' token"],
|
||||||
\ lines)
|
\ lines)
|
||||||
endif
|
endif
|
||||||
call delete('Xtestout')
|
call delete('Xtestout')
|
||||||
@@ -321,8 +329,8 @@ func Test_q_arg()
|
|||||||
if RunVim([], after, '-qXerrors')
|
if RunVim([], after, '-qXerrors')
|
||||||
let lines = readfile('Xtestout')
|
let lines = readfile('Xtestout')
|
||||||
call assert_equal(['Xerrors',
|
call assert_equal(['Xerrors',
|
||||||
\ '[0, 208, 1, 0]',
|
\ '[0, 4, 12, 0]',
|
||||||
\ source_file . "|208 col 5| error: expected ';' before '}' token"],
|
\ "Xbadfile.c|4 col 12| error: expected ';' before '}' token"],
|
||||||
\ lines)
|
\ lines)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -330,6 +338,7 @@ func Test_q_arg()
|
|||||||
let out = system(GetVimCommand() .. ' -q xyz.err')
|
let out = system(GetVimCommand() .. ' -q xyz.err')
|
||||||
call assert_equal(3, v:shell_error)
|
call assert_equal(3, v:shell_error)
|
||||||
|
|
||||||
|
call delete('Xbadfile.c')
|
||||||
call delete('Xtestout')
|
call delete('Xtestout')
|
||||||
call delete('Xerrors')
|
call delete('Xerrors')
|
||||||
endfunc
|
endfunc
|
||||||
|
@@ -754,6 +754,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1217,
|
||||||
/**/
|
/**/
|
||||||
1216,
|
1216,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user