From 1d736a1ae2e5dfc0e47f221dd155058a5da92294 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 16 Oct 2020 22:57:58 -0400 Subject: vim-patch:8.2.0444: swap file test fails on some systems Problem: Swap file test fails on some systems. Solution: Preserve the swap file. Send NL terminated keys. https://github.com/vim/vim/commit/d36ef573b2fad620824495f5423cb649cde55e03 Cherry-pick Test_swap_prompt_splitwin() from patch 8.2.0301. --- src/nvim/testdir/test_swap.vim | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_swap.vim b/src/nvim/testdir/test_swap.vim index e072e9ed7f..f440569d66 100644 --- a/src/nvim/testdir/test_swap.vim +++ b/src/nvim/testdir/test_swap.vim @@ -1,5 +1,7 @@ " Tests for the swap feature +source check.vim + func s:swapname() return trim(execute('swapname')) endfunc @@ -305,3 +307,31 @@ func Test_swap_recover_ext() augroup END augroup! test_swap_recover_ext endfunc + +" Test for selecting 'q' in the attention prompt +func Test_swap_prompt_splitwin() + CheckRunVimInTerminal + + call writefile(['foo bar'], 'Xfile1') + edit Xfile1 + preserve " should help to make sure the swap file exists + + let buf = RunVimInTerminal('', {'rows': 20}) + call term_sendkeys(buf, ":set nomore\n") + call term_sendkeys(buf, ":set noruler\n") + call term_sendkeys(buf, ":split Xfile1\n") + call term_wait(buf) + call WaitForAssert({-> assert_match('^\[O\]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort: $', term_getline(buf, 20))}) + call term_sendkeys(buf, "q") + call term_wait(buf) + call term_sendkeys(buf, ":\") + call WaitForAssert({-> assert_match('^:$', term_getline(buf, 20))}) + call term_sendkeys(buf, ":echomsg winnr('$')\") + call term_wait(buf) + call WaitForAssert({-> assert_match('^1$', term_getline(buf, 20))}) + call StopVimInTerminal(buf) + %bwipe! + call delete('Xfile1') +endfunc + +" vim: shiftwidth=2 sts=2 expandtab -- cgit From a2e1bcd176bbacf4f63727429383436a160c4c58 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 16 Oct 2020 23:02:13 -0400 Subject: vim-patch:8.2.1219: symlink not followed if dirname ends in // MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: Symlink not followed if dirname ends in //. Solution: Resolve symlink earlier. (Tomáš Janoušek, closes vim/vim#6454) https://github.com/vim/vim/commit/5966ea105ea86e52a734e04267956e11efffc92d --- src/nvim/testdir/test_swap.vim | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_swap.vim b/src/nvim/testdir/test_swap.vim index f440569d66..f27920d20f 100644 --- a/src/nvim/testdir/test_swap.vim +++ b/src/nvim/testdir/test_swap.vim @@ -334,4 +334,34 @@ func Test_swap_prompt_splitwin() call delete('Xfile1') endfunc +func Test_swap_symlink() + if !has("unix") + return + endif + + call writefile(['text'], 'Xtestfile') + silent !ln -s -f Xtestfile Xtestlink + + set dir=. + + " Test that swap file uses the name of the file when editing through a + " symbolic link (so that editing the file twice is detected) + edit Xtestlink + call assert_match('Xtestfile\.swp$', s:swapname()) + bwipe! + + call mkdir('Xswapdir') + exe 'set dir=' . getcwd() . '/Xswapdir//' + + " Check that this also works when 'directory' ends with '//' + edit Xtestlink + call assert_match('Xtestfile\.swp$', s:swapname()) + bwipe! + + set dir& + call delete('Xtestfile') + call delete('Xtestlink') + call delete('Xswapdir', 'rf') +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From afd4888c6ae0430cb9e9b26a4b43734b7f39610f Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 17 Oct 2020 09:03:50 -0400 Subject: vim-patch:8.2.1384: no ATTENTION prompt for :vimgrep first match file Problem: No ATTENTION prompt for :vimgrep first match file. Solution: When there is an existing swap file do not keep the dummy buffer. (closes vim/vim#6649) https://github.com/vim/vim/commit/8ce4b7ed85a7c6499bea5eb1312c85ee7a00e364 --- src/nvim/testdir/runtest.vim | 3 +++ src/nvim/testdir/test_quickfix.vim | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/runtest.vim b/src/nvim/testdir/runtest.vim index 765ba2cbb6..b02514143c 100644 --- a/src/nvim/testdir/runtest.vim +++ b/src/nvim/testdir/runtest.vim @@ -78,6 +78,9 @@ set encoding=utf-8 let s:test_script_fname = expand('%') au! SwapExists * call HandleSwapExists() func HandleSwapExists() + if exists('g:ignoreSwapExists') + return + endif " Ignore finding a swap file for the test script (the user might be " editing it and do ":make test_name") and the output file. " Report finding another swap file and chose 'q' to avoid getting stuck. diff --git a/src/nvim/testdir/test_quickfix.vim b/src/nvim/testdir/test_quickfix.vim index f9e79919e9..1124032966 100644 --- a/src/nvim/testdir/test_quickfix.vim +++ b/src/nvim/testdir/test_quickfix.vim @@ -2568,6 +2568,26 @@ func Test_vimgrep_incsearch() set noincsearch endfunc +func Test_vimgrep_existing_swapfile() + call writefile(['match apple with apple'], 'Xapple') + call writefile(['swapfile'], '.Xapple.swp') + let g:foundSwap = 0 + let g:ignoreSwapExists = 1 + augroup grep + au SwapExists * let foundSwap = 1 | let v:swapchoice = 'e' + augroup END + vimgrep apple Xapple + call assert_equal(1, g:foundSwap) + call assert_match('.Xapple.swo', swapname('')) + + call delete('Xapple') + call delete('Xapple.swp') + augroup grep + au! SwapExists + augroup END + unlet g:ignoreSwapExists +endfunc + func XfreeTests(cchar) call s:setup_commands(a:cchar) -- cgit From b9fe30cac2967a4f7bc29d32a3cf1196fa3a1f3a Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 17 Oct 2020 11:05:33 -0400 Subject: vim-patch:8.2.1557: crash in :vimgrep when started as "vim -n" Problem: Crash in :vimgrep when started as "vim -n". (Raul Segura) Solution: Check mfp pointer. (Yegappan Lakshmanan, closes vim/vim#6827) https://github.com/vim/vim/commit/997cd1a17f030d004b334d17cf1c1c57050c9906 --- src/nvim/testdir/test_quickfix.vim | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_quickfix.vim b/src/nvim/testdir/test_quickfix.vim index 1124032966..d46233991c 100644 --- a/src/nvim/testdir/test_quickfix.vim +++ b/src/nvim/testdir/test_quickfix.vim @@ -1,8 +1,7 @@ " Test for the quickfix commands. -if !has('quickfix') - finish -endif +source check.vim +CheckFeature quickfix set encoding=utf-8 @@ -2568,6 +2567,21 @@ func Test_vimgrep_incsearch() set noincsearch endfunc +" Test vimgrep without swap file +func Test_vimgrep_without_swap_file() + let lines =<< trim [SCRIPT] + vimgrep grep test_c* + call writefile(['done'], 'Xresult') + qall! + [SCRIPT] + call writefile(lines, 'Xscript') + if RunVim([], [], '--clean -n -S Xscript Xscript') + call assert_equal(['done'], readfile('Xresult')) + endif + call delete('Xscript') + call delete('Xresult') +endfunc + func Test_vimgrep_existing_swapfile() call writefile(['match apple with apple'], 'Xapple') call writefile(['swapfile'], '.Xapple.swp') -- cgit