Mercurial > vim
changeset 21333:c44867526ad5 v8.2.1217
patch 8.2.1217: startup test depends on random source file
Commit: https://github.com/vim/vim/commit/1e1f612bd42085becb2208b9a95ed3ed0d272ee8
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jul 15 11:19:11 2020 +0200
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 15 Jul 2020 11:30:05 +0200 |
parents | 552547059dbb |
children | d7dc824cbbe5 |
files | src/testdir/test_startup.vim src/version.c |
diffstat | 2 files changed, 20 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/testdir/test_startup.vim +++ b/src/testdir/test_startup.vim @@ -285,7 +285,15 @@ endfunc func Test_q_arg() 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] call writefile([&errorfile, string(getpos("."))], "Xtestout") copen @@ -295,24 +303,24 @@ func Test_q_arg() " Test with default argument '-q'. 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') let lines = readfile('Xtestout') call assert_equal(['errors.err', - \ '[0, 208, 1, 0]', - \ source_file . "|208 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:208: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, 208, 1, 0]', - \ source_file . "|208 col 5| error: expected ';' before '}' token"], + \ '[0, 4, 12, 0]', + \ "Xbadfile.c|4 col 12| error: expected ';' before '}' token"], \ lines) endif call delete('Xtestout') @@ -321,8 +329,8 @@ func Test_q_arg() if RunVim([], after, '-qXerrors') let lines = readfile('Xtestout') call assert_equal(['Xerrors', - \ '[0, 208, 1, 0]', - \ source_file . "|208 col 5| error: expected ';' before '}' token"], + \ '[0, 4, 12, 0]', + \ "Xbadfile.c|4 col 12| error: expected ';' before '}' token"], \ lines) endif @@ -330,6 +338,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