|
|
|
@@ -396,7 +396,7 @@ func XfileTests(cchar)
|
|
|
|
|
Xtestfile1:700:10:Line 700
|
|
|
|
|
Xtestfile2:800:15:Line 800
|
|
|
|
|
END
|
|
|
|
|
call writefile(lines, 'Xqftestfile1')
|
|
|
|
|
call writefile(lines, 'Xqftestfile1', 'D')
|
|
|
|
|
|
|
|
|
|
enew!
|
|
|
|
|
Xfile Xqftestfile1
|
|
|
|
@@ -439,8 +439,6 @@ func XfileTests(cchar)
|
|
|
|
|
call writefile([t], 'Xqftestfile1', 'b')
|
|
|
|
|
silent! Xfile Xqftestfile1
|
|
|
|
|
call assert_equal(text, g:Xgetlist()[0].text)
|
|
|
|
|
|
|
|
|
|
call delete('Xqftestfile1')
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
|
func Test_cfile()
|
|
|
|
@@ -795,10 +793,9 @@ func Xnomem_tests(cchar)
|
|
|
|
|
call assert_fails('Xbuffer', 'E342:')
|
|
|
|
|
%bw!
|
|
|
|
|
|
|
|
|
|
call writefile([repeat('a', 8192)], 'Xtest')
|
|
|
|
|
call writefile([repeat('a', 8192)], 'Xtest', 'D')
|
|
|
|
|
call test_alloc_fail(GetAllocId('qf_linebuf'), 0, 0)
|
|
|
|
|
call assert_fails('Xfile Xtest', 'E342:')
|
|
|
|
|
call delete('Xtest')
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
|
func Test_nomem()
|
|
|
|
@@ -899,7 +896,7 @@ def Test_helpgrep_vim9_restore_cpo()
|
|
|
|
|
var rtp_save = &rtp
|
|
|
|
|
var dir = 'Xruntime/after'
|
|
|
|
|
&rtp ..= ',' .. dir
|
|
|
|
|
mkdir(dir .. '/ftplugin', 'p')
|
|
|
|
|
mkdir(dir .. '/ftplugin', 'pR')
|
|
|
|
|
writefile(['vim9script'], dir .. '/ftplugin/qf.vim')
|
|
|
|
|
filetype plugin on
|
|
|
|
|
silent helpgrep grail
|
|
|
|
@@ -907,7 +904,6 @@ def Test_helpgrep_vim9_restore_cpo()
|
|
|
|
|
silent helpgrep grail
|
|
|
|
|
|
|
|
|
|
assert_equal('aABceFs', &cpo)
|
|
|
|
|
delete('Xruntime', 'rf')
|
|
|
|
|
&rtp = rtp_save
|
|
|
|
|
cclose
|
|
|
|
|
helpclose
|
|
|
|
@@ -1180,8 +1176,8 @@ func Test_locationlist_curwin_was_closed()
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
|
func Test_locationlist_cross_tab_jump()
|
|
|
|
|
call writefile(['loclistfoo'], 'loclistfoo')
|
|
|
|
|
call writefile(['loclistbar'], 'loclistbar')
|
|
|
|
|
call writefile(['loclistfoo'], 'loclistfoo', 'D')
|
|
|
|
|
call writefile(['loclistbar'], 'loclistbar', 'D')
|
|
|
|
|
set switchbuf=usetab
|
|
|
|
|
|
|
|
|
|
edit loclistfoo
|
|
|
|
@@ -1191,8 +1187,6 @@ func Test_locationlist_cross_tab_jump()
|
|
|
|
|
|
|
|
|
|
enew | only | tabonly
|
|
|
|
|
set switchbuf&vim
|
|
|
|
|
call delete('loclistfoo')
|
|
|
|
|
call delete('loclistbar')
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
|
" More tests for 'errorformat'
|
|
|
|
@@ -1237,8 +1231,9 @@ func Test_efm1()
|
|
|
|
|
"Xtestfile", line 22 col 9: What is the title of the quickfix window?
|
|
|
|
|
[DATA]
|
|
|
|
|
|
|
|
|
|
call writefile(l, 'Xerrorfile1')
|
|
|
|
|
call writefile(l[:-2], 'Xerrorfile2')
|
|
|
|
|
call writefile(l, 'Xerrorfile1', 'D')
|
|
|
|
|
call delete('loclistbar')
|
|
|
|
|
call writefile(l[:-2], 'Xerrorfile2', 'D')
|
|
|
|
|
|
|
|
|
|
let m =<< [DATA]
|
|
|
|
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 2
|
|
|
|
@@ -1263,7 +1258,7 @@ func Test_efm1()
|
|
|
|
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 21
|
|
|
|
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 22
|
|
|
|
|
[DATA]
|
|
|
|
|
call writefile(m, 'Xtestfile')
|
|
|
|
|
call writefile(m, 'Xtestfile', 'D')
|
|
|
|
|
|
|
|
|
|
let save_efm = &efm
|
|
|
|
|
set efm+==%f=\\,\ line\ %l%*\\D%v%*[^\ ]\ %m
|
|
|
|
@@ -1309,9 +1304,6 @@ func Test_efm1()
|
|
|
|
|
wincmd p
|
|
|
|
|
|
|
|
|
|
let &efm = save_efm
|
|
|
|
|
call delete('Xerrorfile1')
|
|
|
|
|
call delete('Xerrorfile2')
|
|
|
|
|
call delete('Xtestfile')
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
|
" Test for quickfix directory stack support
|
|
|
|
@@ -1363,11 +1355,11 @@ endfunc
|
|
|
|
|
" Tests for %D and %X errorformat options
|
|
|
|
|
func Test_efm_dirstack()
|
|
|
|
|
" Create the directory stack and files
|
|
|
|
|
call mkdir('dir1')
|
|
|
|
|
call mkdir('dir1', 'R')
|
|
|
|
|
call mkdir('dir1/a')
|
|
|
|
|
call mkdir('dir1/a/b')
|
|
|
|
|
call mkdir('dir1/c')
|
|
|
|
|
call mkdir('dir2')
|
|
|
|
|
call mkdir('dir2', 'R')
|
|
|
|
|
|
|
|
|
|
let lines =<< trim END
|
|
|
|
|
Nine Healthy Habits
|
|
|
|
@@ -1382,7 +1374,7 @@ func Test_efm_dirstack()
|
|
|
|
|
8 Hours of sleep (at least)
|
|
|
|
|
9 PM end of the day and off to bed
|
|
|
|
|
END
|
|
|
|
|
call writefile(lines, 'habits1.txt')
|
|
|
|
|
call writefile(lines, 'habits1.txt', 'D')
|
|
|
|
|
call writefile(lines, 'dir1/a/habits2.txt')
|
|
|
|
|
call writefile(lines, 'dir1/a/b/habits3.txt')
|
|
|
|
|
call writefile(lines, 'dir1/c/habits4.txt')
|
|
|
|
@@ -1390,10 +1382,6 @@ func Test_efm_dirstack()
|
|
|
|
|
|
|
|
|
|
call s:dir_stack_tests('c')
|
|
|
|
|
call s:dir_stack_tests('l')
|
|
|
|
|
|
|
|
|
|
call delete('dir1', 'rf')
|
|
|
|
|
call delete('dir2', 'rf')
|
|
|
|
|
call delete('habits1.txt')
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
|
" Test for resync after continuing an ignored message
|
|
|
|
@@ -1518,9 +1506,9 @@ func Test_efm2()
|
|
|
|
|
set efm=%+P[%f]%r,(%l\\,%c)%*[\ ]%t%*[^:]:\ %m,%+Q--%r
|
|
|
|
|
" To exercise the push/pop file functionality in quickfix, the test files
|
|
|
|
|
" need to be created.
|
|
|
|
|
call writefile(['Line1'], 'Xtestfile1')
|
|
|
|
|
call writefile(['Line2'], 'Xtestfile2')
|
|
|
|
|
call writefile(['Line3'], 'Xtestfile3')
|
|
|
|
|
call writefile(['Line1'], 'Xtestfile1', 'D')
|
|
|
|
|
call writefile(['Line2'], 'Xtestfile2', 'D')
|
|
|
|
|
call writefile(['Line3'], 'Xtestfile3', 'D')
|
|
|
|
|
cexpr ""
|
|
|
|
|
for l in lines
|
|
|
|
|
caddexpr l
|
|
|
|
@@ -1531,9 +1519,6 @@ func Test_efm2()
|
|
|
|
|
call assert_equal(2, l[2].col)
|
|
|
|
|
call assert_equal('w', l[2].type)
|
|
|
|
|
call assert_equal('e', l[3].type)
|
|
|
|
|
call delete('Xtestfile1')
|
|
|
|
|
call delete('Xtestfile2')
|
|
|
|
|
call delete('Xtestfile3')
|
|
|
|
|
|
|
|
|
|
" Test for %P, %Q with non-existing files
|
|
|
|
|
cexpr lines
|
|
|
|
@@ -1602,7 +1587,7 @@ func Test_efm2()
|
|
|
|
|
" Test for %o
|
|
|
|
|
set efm=%f(%o):%l\ %m
|
|
|
|
|
cgetexpr ['Xotestfile(Language.PureScript.Types):20 Error']
|
|
|
|
|
call writefile(['Line1'], 'Xotestfile')
|
|
|
|
|
call writefile(['Line1'], 'Xotestfile', 'D')
|
|
|
|
|
let l = getqflist()
|
|
|
|
|
call assert_equal(1, len(l), string(l))
|
|
|
|
|
call assert_equal('Language.PureScript.Types', l[0].module)
|
|
|
|
@@ -1612,7 +1597,6 @@ func Test_efm2()
|
|
|
|
|
call assert_equal('Xotestfile', expand('%:t'))
|
|
|
|
|
cclose
|
|
|
|
|
bd
|
|
|
|
|
call delete("Xotestfile")
|
|
|
|
|
|
|
|
|
|
" Test for a long module name
|
|
|
|
|
cexpr 'Xtest(' . repeat('m', 1026) . '):15 message'
|
|
|
|
@@ -1776,7 +1760,7 @@ func Test_quickfix_was_changed_by_autocmd()
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
|
func Test_setloclist_in_autocommand()
|
|
|
|
|
call writefile(['test1', 'test2'], 'Xfile')
|
|
|
|
|
call writefile(['test1', 'test2'], 'Xfile', 'D')
|
|
|
|
|
edit Xfile
|
|
|
|
|
let s:bufnr = bufnr()
|
|
|
|
|
call setloclist(1,
|
|
|
|
@@ -1796,7 +1780,6 @@ func Test_setloclist_in_autocommand()
|
|
|
|
|
augroup Test_LocList
|
|
|
|
|
au!
|
|
|
|
|
augroup END
|
|
|
|
|
call delete('Xfile')
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
|
func Test_caddbuffer_to_empty()
|
|
|
|
@@ -2129,11 +2112,10 @@ func Test_cgetfile_on_long_lines()
|
|
|
|
|
/tmp/file4:1:1:ccc
|
|
|
|
|
END
|
|
|
|
|
let lines[1] = substitute(lines[1], '%s', repeat('x', len), '')
|
|
|
|
|
call writefile(lines, 'Xcqetfile.txt')
|
|
|
|
|
call writefile(lines, 'Xcqetfile.txt', 'D')
|
|
|
|
|
cgetfile Xcqetfile.txt
|
|
|
|
|
call assert_equal(4, getqflist(#{size: v:true}).size, 'with length ' .. len)
|
|
|
|
|
endfor
|
|
|
|
|
call delete('Xcqetfile.txt')
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
|
func s:create_test_file(filename)
|
|
|
|
@@ -2274,7 +2256,7 @@ func Test_switchbuf()
|
|
|
|
|
" If opening a file changes 'switchbuf', then the new value should be
|
|
|
|
|
" retained.
|
|
|
|
|
set modeline&vim
|
|
|
|
|
call writefile(["vim: switchbuf=split"], 'Xqftestfile1')
|
|
|
|
|
call writefile(["vim: switchbuf=split"], 'Xqftestfile1', 'D')
|
|
|
|
|
enew | only
|
|
|
|
|
set switchbuf&vim
|
|
|
|
|
cexpr "Xqftestfile1:1:10"
|
|
|
|
@@ -2290,7 +2272,6 @@ func Test_switchbuf()
|
|
|
|
|
cexpr "Xqftestfile1:1:10"
|
|
|
|
|
call assert_equal('', &switchbuf)
|
|
|
|
|
|
|
|
|
|
call delete('Xqftestfile1')
|
|
|
|
|
call delete('Xqftestfile2')
|
|
|
|
|
call delete('Xqftestfile3')
|
|
|
|
|
set switchbuf&vim
|
|
|
|
@@ -2385,8 +2366,8 @@ func Test_two_windows()
|
|
|
|
|
" Use one 'errorformat' for two windows. Add an expression to each of them,
|
|
|
|
|
" make sure they each keep their own state.
|
|
|
|
|
set efm=%DEntering\ dir\ '%f',%f:%l:%m,%XLeaving\ dir\ '%f'
|
|
|
|
|
call mkdir('Xone/a', 'p')
|
|
|
|
|
call mkdir('Xtwo/a', 'p')
|
|
|
|
|
call mkdir('Xone/a', 'pR')
|
|
|
|
|
call mkdir('Xtwo/a', 'pR')
|
|
|
|
|
let lines = ['1', '2', 'one one one', '4', 'two two two', '6', '7']
|
|
|
|
|
call writefile(lines, 'Xone/a/one.txt')
|
|
|
|
|
call writefile(lines, 'Xtwo/a/two.txt')
|
|
|
|
@@ -2418,8 +2399,6 @@ func Test_two_windows()
|
|
|
|
|
bwipe!
|
|
|
|
|
call win_gotoid(two_id)
|
|
|
|
|
bwipe!
|
|
|
|
|
call delete('Xone', 'rf')
|
|
|
|
|
call delete('Xtwo', 'rf')
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
|
func XbottomTests(cchar)
|
|
|
|
@@ -2503,12 +2482,10 @@ func Test_duplicate_buf()
|
|
|
|
|
let last_buffer = bufnr("$")
|
|
|
|
|
|
|
|
|
|
" make sure only one buffer is created
|
|
|
|
|
call writefile(['this one', 'that one'], 'Xgrepthis')
|
|
|
|
|
call writefile(['this one', 'that one'], 'Xgrepthis', 'D')
|
|
|
|
|
vimgrep one Xgrepthis
|
|
|
|
|
vimgrep one Xgrepthis
|
|
|
|
|
call assert_equal(last_buffer + 1, bufnr("$"))
|
|
|
|
|
|
|
|
|
|
call delete('Xgrepthis')
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
|
" Quickfix/Location list set/get properties tests
|
|
|
|
@@ -2876,8 +2853,8 @@ func Test_Autocmd()
|
|
|
|
|
END
|
|
|
|
|
call assert_equal(l, g:acmds)
|
|
|
|
|
|
|
|
|
|
call writefile(['Xtest:1:Line1'], 'Xtest')
|
|
|
|
|
call writefile([], 'Xempty')
|
|
|
|
|
call writefile(['Xtest:1:Line1'], 'Xtest', 'D')
|
|
|
|
|
call writefile([], 'Xempty', 'D')
|
|
|
|
|
let g:acmds = []
|
|
|
|
|
cfile Xtest
|
|
|
|
|
caddfile Xtest
|
|
|
|
@@ -2976,8 +2953,6 @@ func Test_Autocmd()
|
|
|
|
|
call assert_equal(l, g:acmds)
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
call delete('Xtest')
|
|
|
|
|
call delete('Xempty')
|
|
|
|
|
au! QuickFixCmdPre
|
|
|
|
|
au! QuickFixCmdPost
|
|
|
|
|
endfunc
|
|
|
|
@@ -3137,7 +3112,7 @@ func Test_cwindow_highlight()
|
|
|
|
|
redraw
|
|
|
|
|
cwindow 4
|
|
|
|
|
END
|
|
|
|
|
call writefile(lines, 'XtestCwindow')
|
|
|
|
|
call writefile(lines, 'XtestCwindow', 'D')
|
|
|
|
|
let buf = RunVimInTerminal('-S XtestCwindow', #{rows: 12})
|
|
|
|
|
call VerifyScreenDump(buf, 'Test_quickfix_cwindow_1', {})
|
|
|
|
|
|
|
|
|
@@ -3152,7 +3127,6 @@ func Test_cwindow_highlight()
|
|
|
|
|
|
|
|
|
|
" clean up
|
|
|
|
|
call StopVimInTerminal(buf)
|
|
|
|
|
call delete('XtestCwindow')
|
|
|
|
|
call delete('XCwindow')
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
@@ -3164,8 +3138,8 @@ func XvimgrepTests(cchar)
|
|
|
|
|
Editor:Emacs EmAcS
|
|
|
|
|
Editor:Notepad NOTEPAD
|
|
|
|
|
END
|
|
|
|
|
call writefile(lines, 'Xtestfile1')
|
|
|
|
|
call writefile(['Linux', 'macOS', 'MS-Windows'], 'Xtestfile2')
|
|
|
|
|
call writefile(lines, 'Xtestfile1', 'D')
|
|
|
|
|
call writefile(['Linux', 'macOS', 'MS-Windows'], 'Xtestfile2', 'D')
|
|
|
|
|
|
|
|
|
|
" Error cases
|
|
|
|
|
call assert_fails('Xvimgrep /abc *', 'E682:')
|
|
|
|
@@ -3221,9 +3195,6 @@ func XvimgrepTests(cchar)
|
|
|
|
|
augroup QF_Test
|
|
|
|
|
au!
|
|
|
|
|
augroup END
|
|
|
|
|
|
|
|
|
|
call delete('Xtestfile1')
|
|
|
|
|
call delete('Xtestfile2')
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
|
" Tests for the :vimgrep command
|
|
|
|
@@ -3261,11 +3232,10 @@ func Test_vimgrep_with_no_last_search_pat()
|
|
|
|
|
call writefile(v:errors, 'Xresult')
|
|
|
|
|
qall!
|
|
|
|
|
[SCRIPT]
|
|
|
|
|
call writefile(lines, 'Xscript')
|
|
|
|
|
call writefile(lines, 'Xscript', 'D')
|
|
|
|
|
if RunVim([], [], '--clean -S Xscript')
|
|
|
|
|
call assert_equal([], readfile('Xresult'))
|
|
|
|
|
endif
|
|
|
|
|
call delete('Xscript')
|
|
|
|
|
call delete('Xresult')
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
@@ -3276,17 +3246,16 @@ func Test_vimgrep_without_swap_file()
|
|
|
|
|
call writefile(['done'], 'Xresult')
|
|
|
|
|
qall!
|
|
|
|
|
[SCRIPT]
|
|
|
|
|
call writefile(lines, 'Xscript')
|
|
|
|
|
call writefile(lines, 'Xscript', 'D')
|
|
|
|
|
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')
|
|
|
|
|
call writefile(['match apple with apple'], 'Xapple', 'D')
|
|
|
|
|
call writefile(['swapfile'], '.Xapple.swp', 'D')
|
|
|
|
|
let g:foundSwap = 0
|
|
|
|
|
let g:ignoreSwapExists = 1
|
|
|
|
|
augroup grep
|
|
|
|
@@ -3296,8 +3265,6 @@ func Test_vimgrep_existing_swapfile()
|
|
|
|
|
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
|
|
|
|
@@ -3638,8 +3605,8 @@ func Xmultidirstack_tests(cchar)
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
|
func Test_multidirstack()
|
|
|
|
|
call mkdir('Xone/a', 'p')
|
|
|
|
|
call mkdir('Xtwo/a', 'p')
|
|
|
|
|
call mkdir('Xone/a', 'pR')
|
|
|
|
|
call mkdir('Xtwo/a', 'pR')
|
|
|
|
|
let lines = ['1', '2', 'one one one', '4', 'two two two', '6', '7']
|
|
|
|
|
call writefile(lines, 'Xone/a/one.txt')
|
|
|
|
|
call writefile(lines, 'Xtwo/a/two.txt')
|
|
|
|
@@ -3650,8 +3617,6 @@ func Test_multidirstack()
|
|
|
|
|
call Xmultidirstack_tests('l')
|
|
|
|
|
|
|
|
|
|
let &efm = save_efm
|
|
|
|
|
call delete('Xone', 'rf')
|
|
|
|
|
call delete('Xtwo', 'rf')
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
|
" Tests for per quickfix/location list file stack
|
|
|
|
@@ -3700,8 +3665,8 @@ endfunc
|
|
|
|
|
|
|
|
|
|
func Test_multifilestack()
|
|
|
|
|
let lines = ['1', '2', 'one one one', '4', 'two two two', '6', '7']
|
|
|
|
|
call writefile(lines, 'one.txt')
|
|
|
|
|
call writefile(lines, 'two.txt')
|
|
|
|
|
call writefile(lines, 'one.txt', 'D')
|
|
|
|
|
call writefile(lines, 'two.txt', 'D')
|
|
|
|
|
let save_efm = &efm
|
|
|
|
|
set efm=%+P[%f],(%l\\,%c)\ %m,%-Q
|
|
|
|
|
|
|
|
|
@@ -3709,14 +3674,12 @@ func Test_multifilestack()
|
|
|
|
|
call Xmultifilestack_tests('l')
|
|
|
|
|
|
|
|
|
|
let &efm = save_efm
|
|
|
|
|
call delete('one.txt')
|
|
|
|
|
call delete('two.txt')
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
|
" Tests for per buffer 'efm' setting
|
|
|
|
|
func Test_perbuf_efm()
|
|
|
|
|
call writefile(["File1-10-Line10"], 'one.txt')
|
|
|
|
|
call writefile(["File2#20#Line20"], 'two.txt')
|
|
|
|
|
call writefile(["File1-10-Line10"], 'one.txt', 'D')
|
|
|
|
|
call writefile(["File2#20#Line20"], 'two.txt', 'D')
|
|
|
|
|
set efm=%f#%l#%m
|
|
|
|
|
new | only
|
|
|
|
|
new
|
|
|
|
@@ -3731,8 +3694,6 @@ func Test_perbuf_efm()
|
|
|
|
|
|
|
|
|
|
set efm&
|
|
|
|
|
new | only
|
|
|
|
|
call delete('one.txt')
|
|
|
|
|
call delete('two.txt')
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
|
" Open multiple help windows using ":lhelpgrep
|
|
|
|
@@ -3908,9 +3869,9 @@ endfunc
|
|
|
|
|
func Xqfjump_tests(cchar)
|
|
|
|
|
call s:setup_commands(a:cchar)
|
|
|
|
|
|
|
|
|
|
call writefile(["Line1\tFoo", "Line2"], 'F1')
|
|
|
|
|
call writefile(["Line1\tBar", "Line2"], 'F2')
|
|
|
|
|
call writefile(["Line1\tBaz", "Line2"], 'F3')
|
|
|
|
|
call writefile(["Line1\tFoo", "Line2"], 'F1', 'D')
|
|
|
|
|
call writefile(["Line1\tBar", "Line2"], 'F2', 'D')
|
|
|
|
|
call writefile(["Line1\tBaz", "Line2"], 'F3', 'D')
|
|
|
|
|
|
|
|
|
|
call g:Xsetlist([], 'f')
|
|
|
|
|
|
|
|
|
@@ -3999,10 +3960,6 @@ func Xqfjump_tests(cchar)
|
|
|
|
|
" Cleanup
|
|
|
|
|
enew!
|
|
|
|
|
new | only
|
|
|
|
|
|
|
|
|
|
call delete('F1')
|
|
|
|
|
call delete('F2')
|
|
|
|
|
call delete('F3')
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
|
func Test_qfjump()
|
|
|
|
@@ -4118,9 +4075,8 @@ func Test_empty_list_quickfixtextfunc()
|
|
|
|
|
let &quickfixtextfunc = 's:Func'
|
|
|
|
|
cgetfile [ex
|
|
|
|
|
END
|
|
|
|
|
call writefile(lines, 'Xquickfixtextfunc')
|
|
|
|
|
call writefile(lines, 'Xquickfixtextfunc', 'D')
|
|
|
|
|
call RunVim([], [], '-e -s -S Xquickfixtextfunc -c qa')
|
|
|
|
|
call delete('Xquickfixtextfunc')
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
|
func Test_getqflist()
|
|
|
|
@@ -4173,7 +4129,7 @@ func Xqftick_tests(cchar)
|
|
|
|
|
\ {'filename' : 'F7', 'lnum' : 11, 'text' : 'L11'}], 'r')
|
|
|
|
|
call assert_equal(2, g:Xgetlist({'changedtick' : 0}).changedtick)
|
|
|
|
|
|
|
|
|
|
call writefile(["F8:80:L80", "F8:81:L81"], "Xone")
|
|
|
|
|
call writefile(["F8:80:L80", "F8:81:L81"], "Xone", 'D')
|
|
|
|
|
Xfile Xone
|
|
|
|
|
call assert_equal(1, g:Xgetlist({'changedtick' : 0}).changedtick)
|
|
|
|
|
Xaddfile Xone
|
|
|
|
@@ -4186,8 +4142,6 @@ func Xqftick_tests(cchar)
|
|
|
|
|
call g:Xsetlist([], 'a', {'nr' : 1, "lines" : ["F10:10:L10"]})
|
|
|
|
|
call assert_equal(1, g:Xgetlist({'changedtick' : 0}).changedtick)
|
|
|
|
|
call assert_equal(2, g:Xgetlist({'nr' : 1, 'changedtick' : 0}).changedtick)
|
|
|
|
|
|
|
|
|
|
call delete("Xone")
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
|
func Test_qf_tick()
|
|
|
|
@@ -4341,8 +4295,8 @@ endfunc
|
|
|
|
|
" :vimgrep/:lvimgrep commands are running.
|
|
|
|
|
func Test_vimgrep_autocmd()
|
|
|
|
|
call setqflist([], 'f')
|
|
|
|
|
call writefile(['stars'], 'Xtest1.txt')
|
|
|
|
|
call writefile(['stars'], 'Xtest2.txt')
|
|
|
|
|
call writefile(['stars'], 'Xtest1.txt', 'D')
|
|
|
|
|
call writefile(['stars'], 'Xtest2.txt', 'D')
|
|
|
|
|
|
|
|
|
|
" Test 1:
|
|
|
|
|
" When searching for a pattern using :vimgrep, if the quickfix list is
|
|
|
|
@@ -4373,8 +4327,6 @@ func Test_vimgrep_autocmd()
|
|
|
|
|
call assert_fails('lvimgrep stars Xtest*.txt', 'E926:')
|
|
|
|
|
au! BufRead Xtest2.txt
|
|
|
|
|
|
|
|
|
|
call delete('Xtest1.txt')
|
|
|
|
|
call delete('Xtest2.txt')
|
|
|
|
|
call setqflist([], 'f')
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
@@ -4403,14 +4355,13 @@ func Xvimgrep_autocmd_cd(cchar)
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
|
func Test_vimgrep_autocmd_cd()
|
|
|
|
|
call mkdir('Xgrepdir/a', 'p')
|
|
|
|
|
call mkdir('Xgrepdir/b', 'p')
|
|
|
|
|
call mkdir('Xgrepdir/a', 'pR')
|
|
|
|
|
call mkdir('Xgrepdir/b', 'pR')
|
|
|
|
|
call writefile(['a_L1_vim', 'a_L2_vim'], 'Xgrepdir/a/f1.txt')
|
|
|
|
|
call writefile(['b_L1_vim', 'b_L2_vim'], 'Xgrepdir/b/f2.txt')
|
|
|
|
|
call Xvimgrep_autocmd_cd('c')
|
|
|
|
|
call Xvimgrep_autocmd_cd('l')
|
|
|
|
|
%bwipe
|
|
|
|
|
call delete('Xgrepdir', 'rf')
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
|
" The following test used to crash Vim
|
|
|
|
@@ -4539,7 +4490,7 @@ endfunc
|
|
|
|
|
" Otherwise due to indentation, the title is set with spaces at the beginning
|
|
|
|
|
" of the command.
|
|
|
|
|
func Test_qftitle()
|
|
|
|
|
call writefile(["F1:1:Line1"], 'Xerr')
|
|
|
|
|
call writefile(["F1:1:Line1"], 'Xerr', 'D')
|
|
|
|
|
|
|
|
|
|
" :cexpr
|
|
|
|
|
exe "cexpr readfile('Xerr')"
|
|
|
|
@@ -4617,7 +4568,6 @@ func Test_qftitle()
|
|
|
|
|
call assert_equal(':setqflist()', getqflist({'title' : 1}).title)
|
|
|
|
|
|
|
|
|
|
close
|
|
|
|
|
call delete('Xerr')
|
|
|
|
|
|
|
|
|
|
call setqflist([], ' ', {'title' : 'Errors'})
|
|
|
|
|
copen
|
|
|
|
@@ -4700,7 +4650,7 @@ func Xjumpto_first_error_test(cchar)
|
|
|
|
|
|
|
|
|
|
" Test for cfile/lfile
|
|
|
|
|
enew
|
|
|
|
|
call writefile(l, 'Xerr')
|
|
|
|
|
call writefile(l, 'Xerr', 'D')
|
|
|
|
|
Xfile Xerr
|
|
|
|
|
call assert_equal('Xtestfile1', @%)
|
|
|
|
|
call assert_equal(2, line('.'))
|
|
|
|
@@ -4711,7 +4661,6 @@ func Xjumpto_first_error_test(cchar)
|
|
|
|
|
call assert_equal('Xtestfile1', @%)
|
|
|
|
|
call assert_equal(2, line('.'))
|
|
|
|
|
|
|
|
|
|
call delete('Xerr')
|
|
|
|
|
call delete('Xtestfile1')
|
|
|
|
|
call delete('Xtestfile2')
|
|
|
|
|
endfunc
|
|
|
|
@@ -4731,7 +4680,7 @@ func Xautocmd_changelist(cchar)
|
|
|
|
|
call s:create_test_file('Xtestfile2')
|
|
|
|
|
Xexpr 'Xtestfile1:2:Line2'
|
|
|
|
|
autocmd QuickFixCmdPost * Xolder
|
|
|
|
|
call writefile(['Xtestfile2:4:Line4'], 'Xerr')
|
|
|
|
|
call writefile(['Xtestfile2:4:Line4'], 'Xerr', 'D')
|
|
|
|
|
Xfile Xerr
|
|
|
|
|
call assert_equal('Xtestfile2', @%)
|
|
|
|
|
call assert_equal(4, line('.'))
|
|
|
|
@@ -4802,7 +4751,6 @@ func Xautocmd_changelist(cchar)
|
|
|
|
|
call assert_fails('silent Xvimgrep Line5 Xtestfile2', 'E480:')
|
|
|
|
|
autocmd! QuickFixCmdPost
|
|
|
|
|
|
|
|
|
|
call delete('Xerr')
|
|
|
|
|
call delete('Xtestfile1')
|
|
|
|
|
call delete('Xtestfile2')
|
|
|
|
|
endfunc
|
|
|
|
@@ -4919,7 +4867,7 @@ endfunc
|
|
|
|
|
" Test for parsing entries using visual screen column
|
|
|
|
|
func Test_viscol()
|
|
|
|
|
enew
|
|
|
|
|
call writefile(["Col1\tCol2\tCol3"], 'Xfile1')
|
|
|
|
|
call writefile(["Col1\tCol2\tCol3"], 'Xfile1', 'D')
|
|
|
|
|
edit Xfile1
|
|
|
|
|
|
|
|
|
|
" Use byte offset for column number
|
|
|
|
@@ -4984,7 +4932,6 @@ func Test_viscol()
|
|
|
|
|
|
|
|
|
|
enew | only
|
|
|
|
|
set efm&
|
|
|
|
|
call delete('Xfile1')
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
|
" Test for the quickfix window buffer
|
|
|
|
@@ -5101,14 +5048,13 @@ endfunc
|
|
|
|
|
" a normal buffer.
|
|
|
|
|
func Test_empty_qfbuf()
|
|
|
|
|
enew | only
|
|
|
|
|
call writefile(["Test"], 'Xfile1')
|
|
|
|
|
call writefile(["Test"], 'Xfile1', 'D')
|
|
|
|
|
call setqflist([], 'f')
|
|
|
|
|
copen | only
|
|
|
|
|
let qfbuf = bufnr('')
|
|
|
|
|
edit Xfile1
|
|
|
|
|
call assert_notequal(qfbuf, bufnr(''))
|
|
|
|
|
enew
|
|
|
|
|
call delete('Xfile1')
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
|
" Test for the :cbelow, :cabove, :lbelow and :labove commands.
|
|
|
|
@@ -5341,7 +5287,7 @@ func Xtest_qfcmd_abort(cchar)
|
|
|
|
|
call assert_equal(0, g:Xgetlist({'nr' : '$'}).nr)
|
|
|
|
|
|
|
|
|
|
" cfile/lfile
|
|
|
|
|
call writefile(["F1:10:Line10", "F2:20:Line20"], 'Xfile1')
|
|
|
|
|
call writefile(["F1:10:Line10", "F2:20:Line20"], 'Xfile1', 'D')
|
|
|
|
|
let e = ''
|
|
|
|
|
try
|
|
|
|
|
Xfile Xfile1
|
|
|
|
@@ -5350,7 +5296,6 @@ func Xtest_qfcmd_abort(cchar)
|
|
|
|
|
endtry
|
|
|
|
|
call assert_equal('AbortCmd', e)
|
|
|
|
|
call assert_equal(0, g:Xgetlist({'nr' : '$'}).nr)
|
|
|
|
|
call delete('Xfile1')
|
|
|
|
|
|
|
|
|
|
" cgetbuffer/lgetbuffer
|
|
|
|
|
enew!
|
|
|
|
@@ -5414,7 +5359,7 @@ endfunc
|
|
|
|
|
|
|
|
|
|
" Test for using a file in one of the parent directories.
|
|
|
|
|
func Test_search_in_dirstack()
|
|
|
|
|
call mkdir('Xtestdir/a/b/c', 'p')
|
|
|
|
|
call mkdir('Xtestdir/a/b/c', 'pR')
|
|
|
|
|
let save_cwd = getcwd()
|
|
|
|
|
call writefile(["X1_L1", "X1_L2"], 'Xtestdir/Xfile1')
|
|
|
|
|
call writefile(["X2_L1", "X2_L2"], 'Xtestdir/a/Xfile2')
|
|
|
|
@@ -5451,7 +5396,6 @@ func Test_search_in_dirstack()
|
|
|
|
|
|
|
|
|
|
set efm&
|
|
|
|
|
exe 'cd ' . save_cwd
|
|
|
|
|
call delete('Xtestdir', 'rf')
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
|
" Test for :cquit
|
|
|
|
@@ -5895,7 +5839,7 @@ endfunc
|
|
|
|
|
" Running :lhelpgrep command more than once in a help window, doesn't jump to
|
|
|
|
|
" the help topic
|
|
|
|
|
func Test_lhelpgrep_from_help_window()
|
|
|
|
|
call mkdir('Xtestdir/doc', 'p')
|
|
|
|
|
call mkdir('Xtestdir/doc', 'pR')
|
|
|
|
|
call writefile(['window'], 'Xtestdir/doc/a.txt')
|
|
|
|
|
call writefile(['buffer'], 'Xtestdir/doc/b.txt')
|
|
|
|
|
let save_rtp = &rtp
|
|
|
|
@@ -5906,7 +5850,6 @@ func Test_lhelpgrep_from_help_window()
|
|
|
|
|
lhelpgrep window
|
|
|
|
|
call assert_equal('a.txt', fnamemodify(@%, ":p:t"))
|
|
|
|
|
let &rtp = save_rtp
|
|
|
|
|
call delete('Xtestdir', 'rf')
|
|
|
|
|
new | only!
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
@@ -5993,7 +5936,7 @@ func Test_quickfix_window_fails_to_open()
|
|
|
|
|
anything
|
|
|
|
|
endtry
|
|
|
|
|
END
|
|
|
|
|
call writefile(lines, 'XquickfixFails')
|
|
|
|
|
call writefile(lines, 'XquickfixFails', 'D')
|
|
|
|
|
|
|
|
|
|
let lines =<< trim END
|
|
|
|
|
split XquickfixFails
|
|
|
|
@@ -6004,7 +5947,7 @@ func Test_quickfix_window_fails_to_open()
|
|
|
|
|
" is aborted but the window was already split.
|
|
|
|
|
silent! cwindow
|
|
|
|
|
END
|
|
|
|
|
call writefile(lines, 'XtestWinFails')
|
|
|
|
|
call writefile(lines, 'XtestWinFails', 'D')
|
|
|
|
|
let buf = RunVimInTerminal('-S XtestWinFails', #{rows: 13})
|
|
|
|
|
call VerifyScreenDump(buf, 'Test_quickfix_window_fails', {})
|
|
|
|
|
|
|
|
|
@@ -6012,8 +5955,6 @@ func Test_quickfix_window_fails_to_open()
|
|
|
|
|
call term_sendkeys(buf, ":bwipe!\<CR>")
|
|
|
|
|
call term_wait(buf)
|
|
|
|
|
call StopVimInTerminal(buf)
|
|
|
|
|
call delete('XtestWinFails')
|
|
|
|
|
call delete('XquickfixFails')
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
|
" Test for updating the quickfix buffer whenever the associated quickfix list
|
|
|
|
@@ -6076,11 +6017,10 @@ endfunc
|
|
|
|
|
|
|
|
|
|
func Test_vimgrep_noswapfile()
|
|
|
|
|
set noswapfile
|
|
|
|
|
call writefile(['one', 'two', 'three'], 'Xgreppie')
|
|
|
|
|
call writefile(['one', 'two', 'three'], 'Xgreppie', 'D')
|
|
|
|
|
vimgrep two Xgreppie
|
|
|
|
|
call assert_equal('two', getline('.'))
|
|
|
|
|
|
|
|
|
|
call delete('Xgreppie')
|
|
|
|
|
set swapfile
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
@@ -6122,12 +6062,10 @@ func Xvimgrep_fuzzy_match(cchar)
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
|
func Test_vimgrep_fuzzy_match()
|
|
|
|
|
call writefile(['one two three', 'aaaaaa'], 'Xfile1')
|
|
|
|
|
call writefile(['one', 'three one two', 'two', 'aaathreeaaa'], 'Xfile2')
|
|
|
|
|
call writefile(['one two three', 'aaaaaa'], 'Xfile1', 'D')
|
|
|
|
|
call writefile(['one', 'three one two', 'two', 'aaathreeaaa'], 'Xfile2', 'D')
|
|
|
|
|
call Xvimgrep_fuzzy_match('c')
|
|
|
|
|
call Xvimgrep_fuzzy_match('l')
|
|
|
|
|
call delete('Xfile1')
|
|
|
|
|
call delete('Xfile2')
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
|
func Test_locationlist_open_in_newtab()
|
|
|
|
@@ -6265,12 +6203,11 @@ func Test_lopen_bwipe_all()
|
|
|
|
|
call writefile(['done'], 'Xresult')
|
|
|
|
|
qall!
|
|
|
|
|
END
|
|
|
|
|
call writefile(lines, 'Xscript')
|
|
|
|
|
call writefile(lines, 'Xscript', 'D')
|
|
|
|
|
if RunVim([], [], '-u NONE -n -X -Z -e -m -s -S Xscript')
|
|
|
|
|
call assert_equal(['done'], readfile('Xresult'))
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
call delete('Xscript')
|
|
|
|
|
call delete('Xresult')
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
|