summaryrefslogtreecommitdiff
path: root/src/testdir/test_quickfix.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-09-01 18:34:02 +0200
committerBram Moolenaar <Bram@vim.org>2017-09-01 18:34:02 +0200
commit2c809b7c7d2bb5e4b7fd09c3d312cadecf0c1ff0 (patch)
treec64d894616ef09e1e92bec3a94d385d913ec48d6 /src/testdir/test_quickfix.vim
parent9e8dcf9d6fa15523800005a32d40cf0382178ab0 (diff)
downloadvim-git-2c809b7c7d2bb5e4b7fd09c3d312cadecf0c1ff0.tar.gz
patch 8.0.1031: "text" argument for getqflist() is confusingv8.0.1031
Problem: "text" argument for getqflist() is confusing. (Lcd47) Solution: Use "lines" instead. (Yegappan Lakshmanan)
Diffstat (limited to 'src/testdir/test_quickfix.vim')
-rw-r--r--src/testdir/test_quickfix.vim55
1 files changed, 27 insertions, 28 deletions
diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim
index d6b65e339..64f1baea2 100644
--- a/src/testdir/test_quickfix.vim
+++ b/src/testdir/test_quickfix.vim
@@ -2299,25 +2299,26 @@ func Xsetexpr_tests(cchar)
call s:setup_commands(a:cchar)
let t = ["File1:10:Line10", "File1:20:Line20"]
- call g:Xsetlist([], ' ', {'text' : t})
- call g:Xsetlist([], 'a', {'text' : "File1:30:Line30"})
+ call g:Xsetlist([], ' ', {'lines' : t})
+ call g:Xsetlist([], 'a', {'lines' : ["File1:30:Line30"]})
let l = g:Xgetlist()
call assert_equal(3, len(l))
call assert_equal(20, l[1].lnum)
call assert_equal('Line30', l[2].text)
- call g:Xsetlist([], 'r', {'text' : "File2:5:Line5"})
+ call g:Xsetlist([], 'r', {'lines' : ["File2:5:Line5"]})
let l = g:Xgetlist()
call assert_equal(1, len(l))
call assert_equal('Line5', l[0].text)
- call assert_equal(-1, g:Xsetlist([], 'a', {'text' : 10}))
+ call assert_equal(-1, g:Xsetlist([], 'a', {'lines' : 10}))
+ call assert_equal(-1, g:Xsetlist([], 'a', {'lines' : "F1:10:L10"}))
call g:Xsetlist([], 'f')
" Add entries to multiple lists
- call g:Xsetlist([], 'a', {'nr' : 1, 'text' : ["File1:10:Line10"]})
- call g:Xsetlist([], 'a', {'nr' : 2, 'text' : ["File2:20:Line20"]})
- call g:Xsetlist([], 'a', {'nr' : 1, 'text' : ["File1:15:Line15"]})
- call g:Xsetlist([], 'a', {'nr' : 2, 'text' : ["File2:25:Line25"]})
+ call g:Xsetlist([], 'a', {'nr' : 1, 'lines' : ["File1:10:Line10"]})
+ call g:Xsetlist([], 'a', {'nr' : 2, 'lines' : ["File2:20:Line20"]})
+ call g:Xsetlist([], 'a', {'nr' : 1, 'lines' : ["File1:15:Line15"]})
+ 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)
endfunc
@@ -2334,10 +2335,10 @@ func Xmultidirstack_tests(cchar)
call g:Xsetlist([], 'f')
Xexpr "" | Xexpr ""
- call g:Xsetlist([], 'a', {'nr' : 1, 'text' : "Entering dir 'Xone/a'"})
- call g:Xsetlist([], 'a', {'nr' : 2, 'text' : "Entering dir 'Xtwo/a'"})
- call g:Xsetlist([], 'a', {'nr' : 1, 'text' : "one.txt:3:one one one"})
- call g:Xsetlist([], 'a', {'nr' : 2, 'text' : "two.txt:5:two two two"})
+ call g:Xsetlist([], 'a', {'nr' : 1, 'lines' : ["Entering dir 'Xone/a'"]})
+ call g:Xsetlist([], 'a', {'nr' : 2, 'lines' : ["Entering dir 'Xtwo/a'"]})
+ call g:Xsetlist([], 'a', {'nr' : 1, 'lines' : ["one.txt:3:one one one"]})
+ call g:Xsetlist([], 'a', {'nr' : 2, 'lines' : ["two.txt:5:two two two"]})
let l1 = g:Xgetlist({'nr':1, 'items':1})
let l2 = g:Xgetlist({'nr':2, 'items':1})
@@ -2371,10 +2372,10 @@ func Xmultifilestack_tests(cchar)
call g:Xsetlist([], 'f')
Xexpr "" | Xexpr ""
- call g:Xsetlist([], 'a', {'nr' : 1, 'text' : "[one.txt]"})
- call g:Xsetlist([], 'a', {'nr' : 2, 'text' : "[two.txt]"})
- call g:Xsetlist([], 'a', {'nr' : 1, 'text' : "(3,5) one one one"})
- call g:Xsetlist([], 'a', {'nr' : 2, 'text' : "(5,9) two two two"})
+ call g:Xsetlist([], 'a', {'nr' : 1, 'lines' : ["[one.txt]"]})
+ call g:Xsetlist([], 'a', {'nr' : 2, 'lines' : ["[two.txt]"]})
+ call g:Xsetlist([], 'a', {'nr' : 1, 'lines' : ["(3,5) one one one"]})
+ call g:Xsetlist([], 'a', {'nr' : 2, 'lines' : ["(5,9) two two two"]})
let l1 = g:Xgetlist({'nr':1, 'items':1})
let l2 = g:Xgetlist({'nr':2, 'items':1})
@@ -2523,28 +2524,26 @@ endfunc
" Test for getting the quickfix list items from some text without modifying
" the quickfix stack
-func XgetListFromText(cchar)
+func XgetListFromLines(cchar)
call s:setup_commands(a:cchar)
call g:Xsetlist([], 'f')
- let l = g:Xgetlist({'text' : "File1:10:Line10"}).items
- call assert_equal(1, len(l))
- call assert_equal('Line10', l[0].text)
-
- let l = g:Xgetlist({'text' : ["File2:20:Line20", "File2:30:Line30"]}).items
+ let l = g:Xgetlist({'lines' : ["File2:20:Line20", "File2:30:Line30"]}).items
call assert_equal(2, len(l))
call assert_equal(30, l[1].lnum)
- call assert_equal({}, g:Xgetlist({'text' : 10}))
- call assert_equal([], g:Xgetlist({'text' : []}).items)
+ call assert_equal({}, g:Xgetlist({'lines' : 10}))
+ call assert_equal({}, g:Xgetlist({'lines' : 'File1:10:Line10'}))
+ call assert_equal([], g:Xgetlist({'lines' : []}).items)
+ call assert_equal([], g:Xgetlist({'lines' : [10, 20]}).items)
" Make sure that the quickfix stack is not modified
call assert_equal(0, g:Xgetlist({'nr' : '$'}).nr)
endfunc
-func Test_get_list_from_text()
- call XgetListFromText('c')
- call XgetListFromText('l')
+func Test_get_list_from_lines()
+ call XgetListFromLines('c')
+ call XgetListFromLines('l')
endfunc
" Tests for the quickfix list id
@@ -2567,7 +2566,7 @@ func Xqfid_tests(cchar)
call g:Xsetlist([], 'a', {'id':start_id, 'context':[1,2]})
call assert_equal([1,2], g:Xgetlist({'nr':1, 'context':1}).context)
- call g:Xsetlist([], 'a', {'id':start_id+1, 'text':'F1:10:L10'})
+ call g:Xsetlist([], 'a', {'id':start_id+1, 'lines':['F1:10:L10']})
call assert_equal('L10', g:Xgetlist({'nr':2, 'items':1}).items[0].text)
call assert_equal(-1, g:Xsetlist([], 'a', {'id':999, 'title':'Vim'}))
call assert_equal(-1, g:Xsetlist([], 'a', {'id':'abc', 'title':'Vim'}))