Mercurial > vim
diff src/testdir/test_quickfix.vim @ 12321:2779d593a706 v8.0.1040
patch 8.0.1040: cannot use another error format in getqflist()
commit https://github.com/vim/vim/commit/3653822546fb0f1005c32bb5b70dc9bfacdfc954
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Sep 2 19:51:44 2017 +0200
patch 8.0.1040: cannot use another error format in getqflist()
Problem: Cannot use another error format in getqflist().
Solution: Add the "efm" argument to getqflist(). (Yegappan Lakshmanan)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 02 Sep 2017 20:00:06 +0200 |
parents | ec7a4fd21dd5 |
children | fc3e2d5614dd |
line wrap: on
line diff
--- a/src/testdir/test_quickfix.vim +++ b/src/testdir/test_quickfix.vim @@ -2321,6 +2321,17 @@ func Xsetexpr_tests(cchar) call g:Xsetlist([], 'a', {'nr' : 2, 'lines' : ["File2:25:Line25"]}) call assert_equal('Line15', g:Xgetlist({'nr':1, 'items':1}).items[1].text) call assert_equal('Line25', g:Xgetlist({'nr':2, 'items':1}).items[1].text) + + " Adding entries using a custom efm + set efm& + call g:Xsetlist([], ' ', {'efm' : '%f#%l#%m', + \ 'lines' : ["F1#10#L10", "F2#20#L20"]}) + call assert_equal(20, g:Xgetlist({'items':1}).items[1].lnum) + call g:Xsetlist([], 'a', {'efm' : '%f#%l#%m', 'lines' : ["F3:30:L30"]}) + call assert_equal('F3:30:L30', g:Xgetlist({'items':1}).items[2].text) + call assert_equal(20, g:Xgetlist({'items':1}).items[1].lnum) + call assert_equal(-1, g:Xsetlist([], 'a', {'efm' : [], + \ 'lines' : ['F1:10:L10']})) endfunc func Test_setexpr() @@ -2537,6 +2548,17 @@ func XgetListFromLines(cchar) call assert_equal([], g:Xgetlist({'lines' : []}).items) call assert_equal([], g:Xgetlist({'lines' : [10, 20]}).items) + " Parse text using a custom efm + set efm& + let l = g:Xgetlist({'lines':['File3#30#Line30'], 'efm' : '%f#%l#%m'}).items + call assert_equal('Line30', l[0].text) + let l = g:Xgetlist({'lines':['File3:30:Line30'], 'efm' : '%f-%l-%m'}).items + call assert_equal('File3:30:Line30', l[0].text) + let l = g:Xgetlist({'lines':['File3:30:Line30'], 'efm' : [1,2]}) + call assert_equal({}, l) + call assert_fails("call g:Xgetlist({'lines':['abc'], 'efm':'%2'})", 'E376:') + call assert_fails("call g:Xgetlist({'lines':['abc'], 'efm':''})", 'E378:') + " Make sure that the quickfix stack is not modified call assert_equal(0, g:Xgetlist({'nr' : '$'}).nr) endfunc