vim-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.
1e1f612bd4

N/A patches for version.c:

vim-patch:8.2.1216: startup test fails

Problem:    Startup test fails.
Solution:   Adjust expected values for deleted lines.
b6e4e4c6f7
This commit is contained in:
Jan Edmund Lazo 2020-11-21 22:40:47 -05:00
parent 485e5022fc
commit 4c14410af6
No known key found for this signature in database
GPG Key ID: 64915E6E9F735B15

View File

@ -284,34 +284,42 @@ endfunc
func Test_q_arg()
CheckFeature quickfix
let source_file = has('win32') ? '..\memfile.c' : '../memfile.c'
let after = [
\ 'call writefile([&errorfile, string(getpos("."))], "Xtestout")',
\ 'copen',
\ 'w >> Xtestout',
\ 'qall'
\ ]
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]
call writefile([&errorfile, string(getpos("."))], "Xtestout")
copen
w >> Xtestout
qall
[CODE]
" Test with default argument '-q'.
call assert_equal('errors.err', &errorfile)
call writefile(["../memfile.c:1482:5: error: expected ';' before '}' token"], 'errors.err')
call writefile(["Xbadfile.c:4:12: 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"],
\ '[0, 4, 12, 0]',
\ "Xbadfile.c|4 col 12| 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')
call writefile(["Xbadfile.c:4:12: 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"],
\ '[0, 4, 12, 0]',
\ "Xbadfile.c|4 col 12| error: expected ';' before '}' token"],
\ lines)
endif
call delete('Xtestout')
@ -320,8 +328,8 @@ func Test_q_arg()
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"],
\ '[0, 4, 12, 0]',
\ "Xbadfile.c|4 col 12| error: expected ';' before '}' token"],
\ lines)
endif
@ -329,6 +337,7 @@ func Test_q_arg()
let out = system(GetVimCommand() .. ' -q xyz.err')
call assert_equal(3, v:shell_error)
call delete('Xbadfile.c')
call delete('Xtestout')
call delete('Xerrors')
endfunc