From c4cef4ec93e3a6c9b9842239ae80cf90e528d559 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 21 Nov 2020 22:19:12 -0500 Subject: vim-patch:8.1.0650: command line argument -q [errorfile] is not tested Problem: Command line argument -q [errorfile] is not tested. Solution: Add a test. (Dominique Pelle, closes vim/vim#3730) https://github.com/vim/vim/commit/54948183d210f5117271bb5710752da24054fade --- src/nvim/testdir/test_startup.vim | 47 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'src') diff --git a/src/nvim/testdir/test_startup.vim b/src/nvim/testdir/test_startup.vim index 12bec745a8..ec043a3188 100644 --- a/src/nvim/testdir/test_startup.vim +++ b/src/nvim/testdir/test_startup.vim @@ -278,6 +278,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() -- cgit From e632e30b8a6c65ebe30849f6f2fe09c7630ed303 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 21 Nov 2020 22:36:45 -0500 Subject: test/old: cherry-pick patch 8.1.2373 for test_startup.vim --- src/nvim/testdir/test_startup.vim | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/nvim/testdir/test_startup.vim b/src/nvim/testdir/test_startup.vim index ec043a3188..1a90c8d62f 100644 --- a/src/nvim/testdir/test_startup.vim +++ b/src/nvim/testdir/test_startup.vim @@ -2,6 +2,7 @@ source shared.vim source screendump.vim +source check.vim " Check that loading startup.vim works. func Test_startup_script() @@ -280,6 +281,8 @@ endfunc " Test the '-q [errorfile]' argument. func Test_q_arg() + CheckFeature quickfix + let source_file = has('win32') ? '..\memfile.c' : '../memfile.c' let after = [ \ 'call writefile([&errorfile, string(getpos("."))], "Xtestout")', @@ -455,13 +458,15 @@ func Test_invalid_args() let out = split(system(GetVimCommand() .. ' - xxx -cq'), "\n") call assert_equal(0, v:shell_error) - " Detect invalid repeated arguments '-t foo -t foo", '-q foo -q foo'. - for opt in ['-t', '-q'] - let out = split(system(GetVimCommand() .. repeat(' ' .. opt .. ' foo', 2)), "\n") - call assert_equal(1, v:shell_error) - call assert_equal('nvim: Too many edit arguments: "' .. opt .. '"', out[0]) - call assert_equal('More info with "nvim -h"', out[1]) - endfor + if has('quickfix') + " Detect invalid repeated arguments '-t foo -t foo", '-q foo -q foo'. + for opt in ['-t', '-q'] + let out = split(system(GetVimCommand() .. repeat(' ' .. opt .. ' foo', 2)), "\n") + call assert_equal(1, v:shell_error) + call assert_equal('nvim: Too many edit arguments: "' .. opt .. '"', out[0]) + call assert_equal('More info with "nvim -h"', out[1]) + endfor + endif for opt in [' -cq', ' --cmd q', ' +', ' -S foo'] let out = split(system(GetVimCommand() .. repeat(opt, 11)), "\n") -- cgit From 485e5022fcaba3961626859885e67504ae0ceaca Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 21 Nov 2020 22:39:13 -0500 Subject: test/old: cherry-pick patch 8.2.0509 for Test_q_arg() --- src/nvim/testdir/test_startup.vim | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/nvim/testdir/test_startup.vim b/src/nvim/testdir/test_startup.vim index 1a90c8d62f..747eb28a28 100644 --- a/src/nvim/testdir/test_startup.vim +++ b/src/nvim/testdir/test_startup.vim @@ -2,6 +2,7 @@ source shared.vim source screendump.vim +source term_util.vim source check.vim " Check that loading startup.vim works. @@ -324,6 +325,10 @@ func Test_q_arg() \ lines) endif + " Test with a non-existing error file (exits with value 3) + let out = system(GetVimCommand() .. ' -q xyz.err') + call assert_equal(3, v:shell_error) + call delete('Xtestout') call delete('Xerrors') endfunc -- cgit From 4c14410af63a6fdcdda085e920e0b54b06f45932 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 21 Nov 2020 22:40:47 -0500 Subject: 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. https://github.com/vim/vim/commit/1e1f612bd42085becb2208b9a95ed3ed0d272ee8 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. https://github.com/vim/vim/commit/b6e4e4c6f7b4f7eadcc4c2397bfa57e0734e005f --- src/nvim/testdir/test_startup.vim | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/nvim/testdir/test_startup.vim b/src/nvim/testdir/test_startup.vim index 747eb28a28..7fe0168356 100644 --- a/src/nvim/testdir/test_startup.vim +++ b/src/nvim/testdir/test_startup.vim @@ -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 -- cgit