comparison src/testdir/test_quickfix.vim @ 11378:2ed7a34ecc54 v8.0.0574

patch 8.0.0574: get only one quickfix list after :caddbuf commit https://github.com/vim/vim/commit/99895eac1cf71be43ece7e14b50e206e041fbe9f Author: Bram Moolenaar <Bram@vim.org> Date: Thu Apr 20 22:44:47 2017 +0200 patch 8.0.0574: get only one quickfix list after :caddbuf Problem: Get only one quickfix list after :caddbuf. Solution: Reset qf_multiline. (Yegappan Lakshmanan)
author Christian Brabandt <cb@256bit.org>
date Thu, 20 Apr 2017 22:45:04 +0200
parents cc8ece2aa389
children c3ebb7d533c6
comparison
equal deleted inserted replaced
11377:b83ee5799d5f 11378:2ed7a34ecc54
22 command! -nargs=* Xaddfile <mods>caddfile <args> 22 command! -nargs=* Xaddfile <mods>caddfile <args>
23 command! -nargs=* -bang Xbuffer <mods>cbuffer<bang> <args> 23 command! -nargs=* -bang Xbuffer <mods>cbuffer<bang> <args>
24 command! -nargs=* Xgetbuffer <mods>cgetbuffer <args> 24 command! -nargs=* Xgetbuffer <mods>cgetbuffer <args>
25 command! -nargs=* Xaddbuffer <mods>caddbuffer <args> 25 command! -nargs=* Xaddbuffer <mods>caddbuffer <args>
26 command! -nargs=* Xrewind <mods>crewind <args> 26 command! -nargs=* Xrewind <mods>crewind <args>
27 command! -nargs=* -bang Xnext <mods>cnext<bang> <args> 27 command! -count -nargs=* -bang Xnext <mods><count>cnext<bang> <args>
28 command! -nargs=* -bang Xprev <mods>cprev<bang> <args> 28 command! -count -nargs=* -bang Xprev <mods><count>cprev<bang> <args>
29 command! -nargs=* -bang Xfirst <mods>cfirst<bang> <args> 29 command! -nargs=* -bang Xfirst <mods>cfirst<bang> <args>
30 command! -nargs=* -bang Xlast <mods>clast<bang> <args> 30 command! -nargs=* -bang Xlast <mods>clast<bang> <args>
31 command! -nargs=* -bang Xnfile <mods>cnfile<bang> <args> 31 command! -nargs=* -bang Xnfile <mods>cnfile<bang> <args>
32 command! -nargs=* -bang Xpfile <mods>cpfile<bang> <args> 32 command! -nargs=* -bang Xpfile <mods>cpfile<bang> <args>
33 command! -nargs=* Xexpr <mods>cexpr <args> 33 command! -nargs=* Xexpr <mods>cexpr <args>
54 command! -nargs=* Xaddfile <mods>laddfile <args> 54 command! -nargs=* Xaddfile <mods>laddfile <args>
55 command! -nargs=* -bang Xbuffer <mods>lbuffer<bang> <args> 55 command! -nargs=* -bang Xbuffer <mods>lbuffer<bang> <args>
56 command! -nargs=* Xgetbuffer <mods>lgetbuffer <args> 56 command! -nargs=* Xgetbuffer <mods>lgetbuffer <args>
57 command! -nargs=* Xaddbuffer <mods>laddbuffer <args> 57 command! -nargs=* Xaddbuffer <mods>laddbuffer <args>
58 command! -nargs=* Xrewind <mods>lrewind <args> 58 command! -nargs=* Xrewind <mods>lrewind <args>
59 command! -nargs=* -bang Xnext <mods>lnext<bang> <args> 59 command! -count -nargs=* -bang Xnext <mods><count>lnext<bang> <args>
60 command! -nargs=* -bang Xprev <mods>lprev<bang> <args> 60 command! -count -nargs=* -bang Xprev <mods><count>lprev<bang> <args>
61 command! -nargs=* -bang Xfirst <mods>lfirst<bang> <args> 61 command! -nargs=* -bang Xfirst <mods>lfirst<bang> <args>
62 command! -nargs=* -bang Xlast <mods>llast<bang> <args> 62 command! -nargs=* -bang Xlast <mods>llast<bang> <args>
63 command! -nargs=* -bang Xnfile <mods>lnfile<bang> <args> 63 command! -nargs=* -bang Xnfile <mods>lnfile<bang> <args>
64 command! -nargs=* -bang Xpfile <mods>lpfile<bang> <args> 64 command! -nargs=* -bang Xpfile <mods>lpfile<bang> <args>
65 command! -nargs=* Xexpr <mods>lexpr <args> 65 command! -nargs=* Xexpr <mods>lexpr <args>
393 call s:create_test_file('Xqftestfile2') 393 call s:create_test_file('Xqftestfile2')
394 394
395 Xgetexpr ['Xqftestfile1:5:Line5', 395 Xgetexpr ['Xqftestfile1:5:Line5',
396 \ 'Xqftestfile1:6:Line6', 396 \ 'Xqftestfile1:6:Line6',
397 \ 'Xqftestfile2:10:Line10', 397 \ 'Xqftestfile2:10:Line10',
398 \ 'Xqftestfile2:11:Line11'] 398 \ 'Xqftestfile2:11:Line11',
399 \ 'RegularLine1',
400 \ 'RegularLine2']
399 401
400 Xfirst 402 Xfirst
401 call assert_fails('Xprev', 'E553') 403 call assert_fails('Xprev', 'E553')
402 call assert_fails('Xpfile', 'E553') 404 call assert_fails('Xpfile', 'E553')
403 Xnfile 405 Xnfile
405 call assert_equal(10, line('.')) 407 call assert_equal(10, line('.'))
406 Xpfile 408 Xpfile
407 call assert_equal('Xqftestfile1', bufname('%')) 409 call assert_equal('Xqftestfile1', bufname('%'))
408 call assert_equal(6, line('.')) 410 call assert_equal(6, line('.'))
409 Xlast 411 Xlast
412 Xprev
410 call assert_equal('Xqftestfile2', bufname('%')) 413 call assert_equal('Xqftestfile2', bufname('%'))
411 call assert_equal(11, line('.')) 414 call assert_equal(11, line('.'))
412 call assert_fails('Xnext', 'E553') 415 call assert_fails('Xnext', 'E553')
413 call assert_fails('Xnfile', 'E553') 416 call assert_fails('Xnfile', 'E553')
414 Xrewind 417 Xrewind
418 call assert_equal('Xqftestfile1', bufname('%'))
419 call assert_equal(5, line('.'))
420
421 10Xnext
422 call assert_equal('Xqftestfile2', bufname('%'))
423 call assert_equal(11, line('.'))
424 10Xprev
415 call assert_equal('Xqftestfile1', bufname('%')) 425 call assert_equal('Xqftestfile1', bufname('%'))
416 call assert_equal(5, line('.')) 426 call assert_equal(5, line('.'))
417 427
418 Xexpr "" 428 Xexpr ""
419 call assert_fails('Xnext', 'E42:') 429 call assert_fails('Xnext', 'E42:')
453 let title_text = ':helpgrep quickfix' 463 let title_text = ':helpgrep quickfix'
454 else 464 else
455 let title_text = ':lhelpgrep quickfix' 465 let title_text = ':lhelpgrep quickfix'
456 endif 466 endif
457 call assert_true(w:quickfix_title =~ title_text, w:quickfix_title) 467 call assert_true(w:quickfix_title =~ title_text, w:quickfix_title)
468
469 " Jumping to a help topic should open the help window
470 only
471 Xnext
472 call assert_true(&buftype == 'help')
473 call assert_true(winnr('$') == 2)
474 " Jumping to the next match should reuse the help window
475 Xnext
476 call assert_true(&buftype == 'help')
477 call assert_true(winnr() == 1)
478 call assert_true(winnr('$') == 2)
479 " Jumping to the next match from the quickfix window should reuse the help
480 " window
481 Xopen
482 Xnext
483 call assert_true(&buftype == 'help')
484 call assert_true(winnr() == 1)
485 call assert_true(winnr('$') == 2)
486
458 " This wipes out the buffer, make sure that doesn't cause trouble. 487 " This wipes out the buffer, make sure that doesn't cause trouble.
459 Xclose 488 Xclose
489
490 new | only
460 491
461 " Search for non existing help string 492 " Search for non existing help string
462 call assert_fails('Xhelpgrep a1b2c3', 'E480:') 493 call assert_fails('Xhelpgrep a1b2c3', 'E480:')
463 endfunc 494 endfunc
464 495
594 625
595 " Test A 626 " Test A
596 lrewind 627 lrewind
597 enew 628 enew
598 lopen 629 lopen
599 lnext 630 4lnext
600 lnext
601 lnext
602 lnext
603 vert split 631 vert split
604 wincmd L 632 wincmd L
605 lopen 633 lopen
606 wincmd p 634 wincmd p
607 lnext 635 lnext
1055 call assert_equal(8, len(l)) 1083 call assert_equal(8, len(l))
1056 call assert_equal(89, l[4].lnum) 1084 call assert_equal(89, l[4].lnum)
1057 call assert_equal(1, l[4].valid) 1085 call assert_equal(1, l[4].valid)
1058 call assert_equal('unittests/dbfacadeTest.py', bufname(l[4].bufnr)) 1086 call assert_equal('unittests/dbfacadeTest.py', bufname(l[4].bufnr))
1059 1087
1088 " The following sequence of commands used to crash Vim
1089 set efm=%W%m
1090 cgetexpr ['msg1']
1091 let l = getqflist()
1092 call assert_equal(1, len(l), string(l))
1093 call assert_equal('msg1', l[0].text)
1094 set efm=%C%m
1095 lexpr 'msg2'
1096 let l = getloclist(0)
1097 call assert_equal(1, len(l), string(l))
1098 call assert_equal('msg2', l[0].text)
1099 lopen
1100 call setqflist([], 'r')
1101 caddbuf
1102 let l = getqflist()
1103 call assert_equal(1, len(l), string(l))
1104 call assert_equal('|| msg2', l[0].text)
1105
1106 new | only
1060 let &efm = save_efm 1107 let &efm = save_efm
1061 endfunc 1108 endfunc
1062 1109
1063 func XquickfixChangedByAutocmd(cchar) 1110 func XquickfixChangedByAutocmd(cchar)
1064 call s:setup_commands(a:cchar) 1111 call s:setup_commands(a:cchar)
1385 1432
1386 new 1433 new
1387 let winid = win_getid() 1434 let winid = win_getid()
1388 cfirst | cnext 1435 cfirst | cnext
1389 call assert_equal(winid, win_getid()) 1436 call assert_equal(winid, win_getid())
1390 cnext | cnext 1437 2cnext
1391 call assert_equal(winid, win_getid()) 1438 call assert_equal(winid, win_getid())
1392 cnext | cnext 1439 2cnext
1393 call assert_equal(winid, win_getid()) 1440 call assert_equal(winid, win_getid())
1394 enew 1441 enew
1395 1442
1396 set switchbuf=useopen 1443 set switchbuf=useopen
1397 cfirst | cnext 1444 cfirst | cnext
1398 call assert_equal(file1_winid, win_getid()) 1445 call assert_equal(file1_winid, win_getid())
1399 cnext | cnext 1446 2cnext
1400 call assert_equal(file2_winid, win_getid()) 1447 call assert_equal(file2_winid, win_getid())
1401 cnext | cnext 1448 2cnext
1402 call assert_equal(file2_winid, win_getid()) 1449 call assert_equal(file2_winid, win_getid())
1403 1450
1404 enew | only 1451 enew | only
1405 set switchbuf=usetab 1452 set switchbuf=usetab
1406 tabedit Xqftestfile1 1453 tabedit Xqftestfile1
1407 tabedit Xqftestfile2 1454 tabedit Xqftestfile2
1408 tabfirst 1455 tabfirst
1409 cfirst | cnext 1456 cfirst | cnext
1410 call assert_equal(2, tabpagenr()) 1457 call assert_equal(2, tabpagenr())
1411 cnext | cnext 1458 2cnext
1412 call assert_equal(3, tabpagenr()) 1459 call assert_equal(3, tabpagenr())
1413 cnext | cnext 1460 2cnext
1414 call assert_equal(3, tabpagenr()) 1461 call assert_equal(3, tabpagenr())
1415 tabfirst | tabonly | enew 1462 tabfirst | tabonly | enew
1416 1463
1417 set switchbuf=split 1464 set switchbuf=split
1418 cfirst | cnext 1465 cfirst | cnext
1973 " Tests for the quickifx free functionality 2020 " Tests for the quickifx free functionality
1974 func Test_qf_free() 2021 func Test_qf_free()
1975 call XfreeTests('c') 2022 call XfreeTests('c')
1976 call XfreeTests('l') 2023 call XfreeTests('l')
1977 endfunc 2024 endfunc
2025
2026 func Test_no_reuse_mem()
2027 set efm=E,%W%m,
2028 cgetexpr ['C']
2029 set efm=%C%m
2030 lexpr '0'
2031 lopen
2032 call setqflist([], 'r')
2033 caddbuf
2034
2035 set efm&
2036 endfunc