vim-patch:8.2.4735: quickfix tests can be a bit hard to read (#20631)

Problem:    Quickfix tests can be a bit hard to read.
Solution:   Use heredoc instead of strings and line continuation. (Yegappan
            Lakshmanan, closes vim/vim#10145)
4a7724a440

Cherry-pick a typo fix from patch 8.2.3637.
This commit is contained in:
zeertzjq 2022-10-13 14:31:10 +08:00 committed by GitHub
parent b55742fafd
commit 4fbf41dfb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -104,9 +104,15 @@ func XlistTests(cchar)
call assert_true(v:errmsg ==# 'E42: No Errors') call assert_true(v:errmsg ==# 'E42: No Errors')
" Populate the list and then try " Populate the list and then try
Xgetexpr ['non-error 1', 'Xtestfile1:1:3:Line1', let lines =<< trim END
\ 'non-error 2', 'Xtestfile2:2:2:Line2', non-error 1
\ 'non-error| 3', 'Xtestfile3:3:1:Line3'] Xtestfile1:1:3:Line1
non-error 2
Xtestfile2:2:2:Line2
non-error| 3
Xtestfile3:3:1:Line3
END
Xgetexpr lines
" List only valid entries " List only valid entries
let l = split(execute('Xlist', ''), "\n") let l = split(execute('Xlist', ''), "\n")
@ -272,8 +278,12 @@ func XwindowTests(cchar)
call assert_true(winnr('$') == 1) call assert_true(winnr('$') == 1)
" Create a list with valid entries " Create a list with valid entries
Xgetexpr ['Xtestfile1:1:3:Line1', 'Xtestfile2:2:2:Line2', let lines =<< trim END
\ 'Xtestfile3:3:1:Line3'] Xtestfile1:1:3:Line1
Xtestfile2:2:2:Line2
Xtestfile3:3:1:Line3
END
Xgetexpr lines
" Open the window " Open the window
Xwindow Xwindow
@ -336,8 +346,12 @@ func XwindowTests(cchar)
if a:cchar == 'c' if a:cchar == 'c'
" Opening the quickfix window in multiple tab pages should reuse the " Opening the quickfix window in multiple tab pages should reuse the
" quickfix buffer " quickfix buffer
Xgetexpr ['Xtestfile1:1:3:Line1', 'Xtestfile2:2:2:Line2', let lines =<< trim END
\ 'Xtestfile3:3:1:Line3'] Xtestfile1:1:3:Line1
Xtestfile2:2:2:Line2
Xtestfile3:3:1:Line3
END
Xgetexpr lines
Xopen Xopen
let qfbufnum = bufnr('%') let qfbufnum = bufnr('%')
tabnew tabnew
@ -372,14 +386,16 @@ func Test_copenHeight_tabline()
set tabline& showtabline& set tabline& showtabline&
endfunc endfunc
" Tests for the :cfile, :lfile, :caddfile, :laddfile, :cgetfile and :lgetfile " Tests for the :cfile, :lfile, :caddfile, :laddfile, :cgetfile and :lgetfile
" commands. " commands.
func XfileTests(cchar) func XfileTests(cchar)
call s:setup_commands(a:cchar) call s:setup_commands(a:cchar)
call writefile(['Xtestfile1:700:10:Line 700', let lines =<< trim END
\ 'Xtestfile2:800:15:Line 800'], 'Xqftestfile1') Xtestfile1:700:10:Line 700
Xtestfile2:800:15:Line 800
END
call writefile(lines, 'Xqftestfile1')
enew! enew!
Xfile Xqftestfile1 Xfile Xqftestfile1
@ -403,8 +419,11 @@ func XfileTests(cchar)
call assert_true(len(l) == 3 && call assert_true(len(l) == 3 &&
\ l[2].lnum == 900 && l[2].col == 30 && l[2].text ==# 'Line 900') \ l[2].lnum == 900 && l[2].col == 30 && l[2].text ==# 'Line 900')
call writefile(['Xtestfile1:222:77:Line 222', let lines =<< trim END
\ 'Xtestfile2:333:88:Line 333'], 'Xqftestfile1') Xtestfile1:222:77:Line 222
Xtestfile2:333:88:Line 333
END
call writefile(lines, 'Xqftestfile1')
enew! enew!
Xgetfile Xqftestfile1 Xgetfile Xqftestfile1
@ -434,8 +453,11 @@ func XbufferTests(cchar)
call s:setup_commands(a:cchar) call s:setup_commands(a:cchar)
enew! enew!
silent! call setline(1, ['Xtestfile7:700:10:Line 700', let lines =<< trim END
\ 'Xtestfile8:800:15:Line 800']) Xtestfile7:700:10:Line 700
Xtestfile8:800:15:Line 800
END
silent! call setline(1, lines)
Xbuffer! Xbuffer!
let l = g:Xgetlist() let l = g:Xgetlist()
call assert_true(len(l) == 2 && call assert_true(len(l) == 2 &&
@ -443,8 +465,11 @@ func XbufferTests(cchar)
\ l[1].lnum == 800 && l[1].col == 15 && l[1].text ==# 'Line 800') \ l[1].lnum == 800 && l[1].col == 15 && l[1].text ==# 'Line 800')
enew! enew!
silent! call setline(1, ['Xtestfile9:900:55:Line 900', let lines =<< trim END
\ 'Xtestfile10:950:66:Line 950']) Xtestfile9:900:55:Line 900
Xtestfile10:950:66:Line 950
END
silent! call setline(1, lines)
Xgetbuffer Xgetbuffer
let l = g:Xgetlist() let l = g:Xgetlist()
call assert_true(len(l) == 2 && call assert_true(len(l) == 2 &&
@ -452,8 +477,11 @@ func XbufferTests(cchar)
\ l[1].lnum == 950 && l[1].col == 66 && l[1].text ==# 'Line 950') \ l[1].lnum == 950 && l[1].col == 66 && l[1].text ==# 'Line 950')
enew! enew!
silent! call setline(1, ['Xtestfile11:700:20:Line 700', let lines =<< trim END
\ 'Xtestfile12:750:25:Line 750']) Xtestfile11:700:20:Line 700
Xtestfile12:750:25:Line 750
END
silent! call setline(1, lines)
Xaddbuffer Xaddbuffer
let l = g:Xgetlist() let l = g:Xgetlist()
call assert_true(len(l) == 4 && call assert_true(len(l) == 4 &&
@ -523,12 +551,15 @@ func Xtest_browse(cchar)
call s:create_test_file('Xqftestfile1') call s:create_test_file('Xqftestfile1')
call s:create_test_file('Xqftestfile2') call s:create_test_file('Xqftestfile2')
Xgetexpr ['Xqftestfile1:5:Line5', let lines =<< trim END
\ 'Xqftestfile1:6:Line6', Xqftestfile1:5:Line5
\ 'Xqftestfile2:10:Line10', Xqftestfile1:6:Line6
\ 'Xqftestfile2:11:Line11', Xqftestfile2:10:Line10
\ 'RegularLine1', Xqftestfile2:11:Line11
\ 'RegularLine2'] RegularLine1
RegularLine2
END
Xgetexpr lines
Xfirst Xfirst
call assert_fails('-5Xcc', 'E16:') call assert_fails('-5Xcc', 'E16:')
@ -578,10 +609,13 @@ func Xtest_browse(cchar)
call assert_equal(5, line('.')) call assert_equal(5, line('.'))
" Jumping to an error from the error window using cc command " Jumping to an error from the error window using cc command
Xgetexpr ['Xqftestfile1:5:Line5', let lines =<< trim END
\ 'Xqftestfile1:6:Line6', Xqftestfile1:5:Line5
\ 'Xqftestfile2:10:Line10', Xqftestfile1:6:Line6
\ 'Xqftestfile2:11:Line11'] Xqftestfile2:10:Line10
Xqftestfile2:11:Line11
END
Xgetexpr lines
Xopen Xopen
10Xcc 10Xcc
call assert_equal(11, line('.')) call assert_equal(11, line('.'))
@ -1109,20 +1143,21 @@ func s:dir_stack_tests(cchar)
let save_efm=&efm let save_efm=&efm
set efm=%DEntering\ dir\ '%f',%f:%l:%m,%XLeaving\ dir\ '%f' set efm=%DEntering\ dir\ '%f',%f:%l:%m,%XLeaving\ dir\ '%f'
let lines = ["Entering dir 'dir1/a'", let lines =<< trim END
\ 'habits2.txt:1:Nine Healthy Habits', Entering dir 'dir1/a'
\ "Entering dir 'b'", habits2.txt:1:Nine Healthy Habits
\ 'habits3.txt:2:0 Hours of television', Entering dir 'b'
\ 'habits2.txt:7:5 Small meals', habits3.txt:2:0 Hours of television
\ "Entering dir 'dir1/c'", habits2.txt:7:5 Small meals
\ 'habits4.txt:3:1 Hour of exercise', Entering dir 'dir1/c'
\ "Leaving dir 'dir1/c'", habits4.txt:3:1 Hour of exercise
\ "Leaving dir 'dir1/a'", Leaving dir 'dir1/c'
\ 'habits1.txt:4:2 Liters of water', Leaving dir 'dir1/a'
\ "Entering dir 'dir2'", habits1.txt:4:2 Liters of water
\ 'habits5.txt:5:3 Cups of hot green tea', Entering dir 'dir2'
\ "Leaving dir 'dir2'" habits5.txt:5:3 Cups of hot green tea
\] Leaving dir 'dir2'
END
Xexpr "" Xexpr ""
for l in lines for l in lines
@ -1156,19 +1191,19 @@ func Test_efm_dirstack()
call mkdir('dir1/c') call mkdir('dir1/c')
call mkdir('dir2') call mkdir('dir2')
let lines = ["Nine Healthy Habits", let lines =<< trim END
\ "0 Hours of television", Nine Healthy Habits
\ "1 Hour of exercise", 0 Hours of television
\ "2 Liters of water", 1 Hour of exercise
\ "3 Cups of hot green tea", 2 Liters of water
\ "4 Short mental breaks", 3 Cups of hot green tea
\ "5 Small meals", 4 Short mental breaks
\ "6 AM wake up time", 5 Small meals
\ "7 Minutes of laughter", 6 AM wake up time
\ "8 Hours of sleep (at least)", 7 Minutes of laughter
\ "9 PM end of the day and off to bed" 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')
call writefile(lines, 'dir1/a/habits2.txt') call writefile(lines, 'dir1/a/habits2.txt')
call writefile(lines, 'dir1/a/b/habits3.txt') call writefile(lines, 'dir1/a/b/habits3.txt')
@ -1194,7 +1229,13 @@ func Xefm_ignore_continuations(cchar)
\ '%-Wignored %m %l,' . \ '%-Wignored %m %l,' .
\ '%+Cmore ignored %m %l,' . \ '%+Cmore ignored %m %l,' .
\ '%Zignored end' \ '%Zignored end'
Xgetexpr ['ignored warning 1', 'more ignored continuation 2', 'ignored end', 'error resync 4'] let lines =<< trim END
ignored warning 1
more ignored continuation 2
ignored end
error resync 4
END
Xgetexpr lines
let l = map(g:Xgetlist(), '[v:val.text, v:val.valid, v:val.lnum, v:val.type]') let l = map(g:Xgetlist(), '[v:val.text, v:val.valid, v:val.lnum, v:val.type]')
call assert_equal([['resync', 1, 4, 'E']], l) call assert_equal([['resync', 1, 4, 'E']], l)
@ -1438,8 +1479,14 @@ func Test_efm_error_type()
" error type " error type
set efm=%f:%l:%t:%m set efm=%f:%l:%t:%m
cexpr ["Xfile1:10:E:msg1", "Xfile1:20:W:msg2", "Xfile1:30:I:msg3", let lines =<< trim END
\ "Xfile1:40:N:msg4", "Xfile1:50:R:msg5"] Xfile1:10:E:msg1
Xfile1:20:W:msg2
Xfile1:30:I:msg3
Xfile1:40:N:msg4
Xfile1:50:R:msg5
END
cexpr lines
let output = split(execute('clist'), "\n") let output = split(execute('clist'), "\n")
call assert_equal([ call assert_equal([
\ ' 1 Xfile1:10 error: msg1', \ ' 1 Xfile1:10 error: msg1',
@ -1450,8 +1497,14 @@ func Test_efm_error_type()
" error type and a error number " error type and a error number
set efm=%f:%l:%t:%n:%m set efm=%f:%l:%t:%n:%m
cexpr ["Xfile1:10:E:2:msg1", "Xfile1:20:W:4:msg2", "Xfile1:30:I:6:msg3", let lines =<< trim END
\ "Xfile1:40:N:8:msg4", "Xfile1:50:R:3:msg5"] Xfile1:10:E:2:msg1
Xfile1:20:W:4:msg2
Xfile1:30:I:6:msg3
Xfile1:40:N:8:msg4
Xfile1:50:R:3:msg5
END
cexpr lines
let output = split(execute('clist'), "\n") let output = split(execute('clist'), "\n")
call assert_equal([ call assert_equal([
\ ' 1 Xfile1:10 error 2: msg1', \ ' 1 Xfile1:10 error 2: msg1',
@ -1476,8 +1529,13 @@ func Test_efm_end_lnum_col()
" multiple lines " multiple lines
set efm=%A%n)%m,%Z%f:%l-%e:%c-%k set efm=%A%n)%m,%Z%f:%l-%e:%c-%k
cexpr ["1)msg1", "Xfile1:14-24:1-2", let lines =<< trim END
\ "2)msg2", "Xfile1:24-34:3-4"] 1)msg1
Xfile1:14-24:1-2
2)msg2
Xfile1:24-34:3-4
END
cexpr lines
let output = split(execute('clist'), "\n") let output = split(execute('clist'), "\n")
call assert_equal([ call assert_equal([
\ ' 1 Xfile1:14-24 col 1-2 error 1: msg1', \ ' 1 Xfile1:14-24 col 1-2 error 1: msg1',
@ -1887,12 +1945,12 @@ func Test_cgetfile_on_long_lines()
" Problematic values if the line is longer than 4096 bytes. Then 1024 bytes " Problematic values if the line is longer than 4096 bytes. Then 1024 bytes
" are read at a time. " are read at a time.
for len in [4078, 4079, 4080, 5102, 5103, 5104, 6126, 6127, 6128, 7150, 7151, 7152] for len in [4078, 4079, 4080, 5102, 5103, 5104, 6126, 6127, 6128, 7150, 7151, 7152]
let lines = [ let lines =<< trim END
\ '/tmp/file1:1:1:aaa', /tmp/file1:1:1:aaa
\ '/tmp/file2:1:1:%s', /tmp/file2:1:1:%s
\ '/tmp/file3:1:1:bbb', /tmp/file3:1:1:bbb
\ '/tmp/file4:1:1:ccc', /tmp/file4:1:1:ccc
\ ] END
let lines[1] = substitute(lines[1], '%s', repeat('x', len), '') let lines[1] = substitute(lines[1], '%s', repeat('x', len), '')
call writefile(lines, 'Xcqetfile.txt') call writefile(lines, 'Xcqetfile.txt')
cgetfile Xcqetfile.txt cgetfile Xcqetfile.txt
@ -1919,12 +1977,15 @@ func Test_switchbuf()
let file1_winid = win_getid() let file1_winid = win_getid()
new Xqftestfile2 new Xqftestfile2
let file2_winid = win_getid() let file2_winid = win_getid()
cgetexpr ['Xqftestfile1:5:Line5', let lines =<< trim END
\ 'Xqftestfile1:6:Line6', Xqftestfile1:5:Line5
\ 'Xqftestfile2:10:Line10', Xqftestfile1:6:Line6
\ 'Xqftestfile2:11:Line11', Xqftestfile2:10:Line10
\ 'Xqftestfile3:15:Line15', Xqftestfile2:11:Line11
\ 'Xqftestfile3:16:Line16'] Xqftestfile3:15:Line15
Xqftestfile3:16:Line16
END
cgetexpr lines
new new
let winid = win_getid() let winid = win_getid()
@ -2586,21 +2647,23 @@ func Test_Autocmd()
silent! cexpr non_existing_func() silent! cexpr non_existing_func()
silent! caddexpr non_existing_func() silent! caddexpr non_existing_func()
silent! cgetexpr non_existing_func() silent! cgetexpr non_existing_func()
let l = ['precexpr', let l =<< trim END
\ 'postcexpr', precexpr
\ 'precaddexpr', postcexpr
\ 'postcaddexpr', precaddexpr
\ 'precgetexpr', postcaddexpr
\ 'postcgetexpr', precgetexpr
\ 'precexpr', postcgetexpr
\ 'postcexpr', precexpr
\ 'precaddexpr', postcexpr
\ 'postcaddexpr', precaddexpr
\ 'precgetexpr', postcaddexpr
\ 'postcgetexpr', precgetexpr
\ 'precexpr', postcgetexpr
\ 'precaddexpr', precexpr
\ 'precgetexpr'] precaddexpr
precgetexpr
END
call assert_equal(l, g:acmds) call assert_equal(l, g:acmds)
let g:acmds = [] let g:acmds = []
@ -2618,15 +2681,17 @@ func Test_Autocmd()
exe 'silent! cgetbuffer ' . bnum exe 'silent! cgetbuffer ' . bnum
exe 'silent! caddbuffer ' . bnum exe 'silent! caddbuffer ' . bnum
enew! enew!
let l = ['precbuffer', let l =<< trim END
\ 'postcbuffer', precbuffer
\ 'precgetbuffer', postcbuffer
\ 'postcgetbuffer', precgetbuffer
\ 'precaddbuffer', postcgetbuffer
\ 'postcaddbuffer', precaddbuffer
\ 'precbuffer', postcaddbuffer
\ 'precgetbuffer', precbuffer
\ 'precaddbuffer'] precgetbuffer
precaddbuffer
END
call assert_equal(l, g:acmds) call assert_equal(l, g:acmds)
call writefile(['Xtest:1:Line1'], 'Xtest') call writefile(['Xtest:1:Line1'], 'Xtest')
@ -2641,24 +2706,26 @@ func Test_Autocmd()
silent! cfile do_not_exist silent! cfile do_not_exist
silent! caddfile do_not_exist silent! caddfile do_not_exist
silent! cgetfile do_not_exist silent! cgetfile do_not_exist
let l = ['precfile', let l =<< trim END
\ 'postcfile', precfile
\ 'precaddfile', postcfile
\ 'postcaddfile', precaddfile
\ 'precgetfile', postcaddfile
\ 'postcgetfile', precgetfile
\ 'precfile', postcgetfile
\ 'postcfile', precfile
\ 'precaddfile', postcfile
\ 'postcaddfile', precaddfile
\ 'precgetfile', postcaddfile
\ 'postcgetfile', precgetfile
\ 'precfile', postcgetfile
\ 'postcfile', precfile
\ 'precaddfile', postcfile
\ 'postcaddfile', precaddfile
\ 'precgetfile', postcaddfile
\ 'postcgetfile'] precgetfile
postcgetfile
END
call assert_equal(l, g:acmds) call assert_equal(l, g:acmds)
let g:acmds = [] let g:acmds = []
@ -2671,20 +2738,22 @@ func Test_Autocmd()
set makeprg= set makeprg=
silent! make silent! make
set makeprg& set makeprg&
let l = ['prehelpgrep', let l =<< trim END
\ 'posthelpgrep', prehelpgrep
\ 'prehelpgrep', posthelpgrep
\ 'posthelpgrep', prehelpgrep
\ 'previmgrep', posthelpgrep
\ 'postvimgrep', previmgrep
\ 'previmgrepadd', postvimgrep
\ 'postvimgrepadd', previmgrepadd
\ 'previmgrep', postvimgrepadd
\ 'postvimgrep', previmgrep
\ 'previmgrepadd', postvimgrep
\ 'postvimgrepadd', previmgrepadd
\ 'premake', postvimgrepadd
\ 'postmake'] premake
postmake
END
call assert_equal(l, g:acmds) call assert_equal(l, g:acmds)
if has('unix') if has('unix')
@ -2704,22 +2773,24 @@ func Test_Autocmd()
silent lgrep Grep_Autocmd_Text test_quickfix.vim silent lgrep Grep_Autocmd_Text test_quickfix.vim
silent lgrepadd GrepAdd_Autocmd_Text test_quickfix.vim silent lgrepadd GrepAdd_Autocmd_Text test_quickfix.vim
set grepprg&vim set grepprg&vim
let l = ['pregrep', let l =<< trim END
\ 'postgrep', pregrep
\ 'pregrepadd', postgrep
\ 'postgrepadd', pregrepadd
\ 'pregrep', postgrepadd
\ 'postgrep', pregrep
\ 'pregrepadd', postgrep
\ 'postgrepadd', pregrepadd
\ 'pregrep', postgrepadd
\ 'postgrep', pregrep
\ 'pregrepadd', postgrep
\ 'postgrepadd', pregrepadd
\ 'prelgrep', postgrepadd
\ 'postlgrep', prelgrep
\ 'prelgrepadd', postlgrep
\ 'postlgrepadd'] prelgrepadd
postlgrepadd
END
call assert_equal(l, g:acmds) call assert_equal(l, g:acmds)
endif endif
@ -2878,11 +2949,11 @@ func Test_cwindow_highlight()
CheckScreendump CheckScreendump
let lines =<< trim END let lines =<< trim END
call setline(1, ['some', 'text', 'with', 'matches']) call setline(1, ['some', 'text', 'with', 'matches'])
write XCwindow write XCwindow
vimgrep e XCwindow vimgrep e XCwindow
redraw redraw
cwindow 4 cwindow 4
END END
call writefile(lines, 'XtestCwindow') call writefile(lines, 'XtestCwindow')
let buf = RunVimInTerminal('-S XtestCwindow', #{rows: 12}) let buf = RunVimInTerminal('-S XtestCwindow', #{rows: 12})
@ -2899,10 +2970,13 @@ endfunc
func XvimgrepTests(cchar) func XvimgrepTests(cchar)
call s:setup_commands(a:cchar) call s:setup_commands(a:cchar)
call writefile(['Editor:VIM vim', let lines =<< trim END
\ 'Editor:Emacs EmAcS', Editor:VIM vim
\ 'Editor:Notepad NOTEPAD'], 'Xtestfile1') Editor:Emacs EmAcS
call writefile(['Linux', 'MacOS', 'MS-Windows'], 'Xtestfile2') Editor:Notepad NOTEPAD
END
call writefile(lines, 'Xtestfile1')
call writefile(['Linux', 'macOS', 'MS-Windows'], 'Xtestfile2')
" Error cases " Error cases
call assert_fails('Xvimgrep /abc *', 'E682:') call assert_fails('Xvimgrep /abc *', 'E682:')
@ -2916,7 +2990,7 @@ func XvimgrepTests(cchar)
Xexpr "" Xexpr ""
Xvimgrepadd Notepad Xtestfile1 Xvimgrepadd Notepad Xtestfile1
Xvimgrepadd MacOS Xtestfile2 Xvimgrepadd macOS Xtestfile2
let l = g:Xgetlist() let l = g:Xgetlist()
call assert_equal(2, len(l)) call assert_equal(2, len(l))
call assert_equal('Editor:Notepad NOTEPAD', l[0].text) call assert_equal('Editor:Notepad NOTEPAD', l[0].text)
@ -3412,14 +3486,15 @@ func Xmultifilestack_tests(cchar)
" error line ends with a file stack. " error line ends with a file stack.
let efm_val = 'Error\ l%l\ in\ %f,' let efm_val = 'Error\ l%l\ in\ %f,'
let efm_val .= '%-P%>(%f%r,Error\ l%l\ in\ %m,%-Q)%r' let efm_val .= '%-P%>(%f%r,Error\ l%l\ in\ %m,%-Q)%r'
let l = g:Xgetlist({'lines' : [ let lines =<< trim END
\ '(one.txt', (one.txt
\ 'Error l4 in one.txt', Error l4 in one.txt
\ ') (two.txt', ) (two.txt
\ 'Error l6 in two.txt', Error l6 in two.txt
\ ')', )
\ 'Error l8 in one.txt' Error l8 in one.txt
\ ], 'efm' : efm_val}) END
let l = g:Xgetlist({'lines': lines, 'efm' : efm_val})
call assert_equal(3, len(l.items)) call assert_equal(3, len(l.items))
call assert_equal('one.txt', bufname(l.items[0].bufnr)) call assert_equal('one.txt', bufname(l.items[0].bufnr))
call assert_equal(4, l.items[0].lnum) call assert_equal(4, l.items[0].lnum)
@ -3697,7 +3772,15 @@ func Xqfjump_tests(cchar)
call g:Xsetlist([], 'f') call g:Xsetlist([], 'f')
setlocal buftype=nofile setlocal buftype=nofile
new new
call g:Xsetlist([], ' ', {'lines' : ['F1:1:1:Line1', 'F1:2:2:Line2', 'F2:1:1:Line1', 'F2:2:2:Line2', 'F3:1:1:Line1', 'F3:2:2:Line2']}) let lines =<< trim END
F1:1:1:Line1
F1:2:2:Line2
F2:1:1:Line1
F2:2:2:Line2
F3:1:1:Line1
F3:2:2:Line2
END
call g:Xsetlist([], ' ', {'lines': lines})
Xopen Xopen
let winid = win_getid() let winid = win_getid()
wincmd p wincmd p
@ -4929,9 +5012,20 @@ func Xtest_below(cchar)
endif endif
" Test for lines with multiple quickfix entries " Test for lines with multiple quickfix entries
Xexpr ["X1:5:L5", "X2:5:1:L5_1", "X2:5:2:L5_2", "X2:5:3:L5_3", let lines =<< trim END
\ "X2:10:1:L10_1", "X2:10:2:L10_2", "X2:10:3:L10_3", X1:5:L5
\ "X2:15:1:L15_1", "X2:15:2:L15_2", "X2:15:3:L15_3", "X3:3:L3"] X2:5:1:L5_1
X2:5:2:L5_2
X2:5:3:L5_3
X2:10:1:L10_1
X2:10:2:L10_2
X2:10:3:L10_3
X2:15:1:L15_1
X2:15:2:L15_2
X2:15:3:L15_3
X3:3:L3
END
Xexpr lines
edit +1 X2 edit +1 X2
Xbelow 2 Xbelow 2
call assert_equal(['X2', 10, 1], [@%, line('.'), col('.')]) call assert_equal(['X2', 10, 1], [@%, line('.'), col('.')])
@ -4995,33 +5089,32 @@ func Test_cbelow()
endfunc endfunc
func Test_quickfix_count() func Test_quickfix_count()
let commands = [ let commands =<< trim END
\ 'cNext', cNext
\ 'cNfile', cNfile
\ 'cabove', cabove
\ 'cbelow', cbelow
\ 'cfirst', cfirst
\ 'clast', clast
\ 'cnewer', cnewer
\ 'cnext', cnext
\ 'cnfile', cnfile
\ 'colder', colder
\ 'cprevious', cprevious
\ 'crewind', crewind
\ lNext
\ 'lNext', lNfile
\ 'lNfile', labove
\ 'labove', lbelow
\ 'lbelow', lfirst
\ 'lfirst', llast
\ 'llast', lnewer
\ 'lnewer', lnext
\ 'lnext', lnfile
\ 'lnfile', lolder
\ 'lolder', lprevious
\ 'lprevious', lrewind
\ 'lrewind', END
\ ]
for cmd in commands for cmd in commands
call assert_fails('-1' .. cmd, 'E16:') call assert_fails('-1' .. cmd, 'E16:')
call assert_fails('.' .. cmd, 'E16:') call assert_fails('.' .. cmd, 'E16:')
@ -5662,9 +5755,12 @@ func Test_locationlist_open_in_newtab()
%bwipe! %bwipe!
lgetexpr ['Xqftestfile1:5:Line5', let lines =<< trim END
\ 'Xqftestfile2:10:Line10', Xqftestfile1:5:Line5
\ 'Xqftestfile3:16:Line16'] Xqftestfile2:10:Line10
Xqftestfile3:16:Line16
END
lgetexpr lines
silent! llast silent! llast
call assert_equal(1, tabpagenr('$')) call assert_equal(1, tabpagenr('$'))