comparison src/testdir/test_quickfix.vim @ 12427:fc3e2d5614dd v8.0.1093

patch 8.0.1093: various small quickfix issues commit https://github.com/vim/vim/commit/b4d5fbabc99917a8069ba32a60c2d73d4f60e128 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Sep 11 19:31:28 2017 +0200 patch 8.0.1093: various small quickfix issues Problem: Various small quickfix issues. Solution: Remove ":" prefix from title set by a user. Add the qf_id2nr(). function. Add a couple more tests. Update documentation. (Yegappan Lakshmanan)
author Christian Brabandt <cb@256bit.org>
date Mon, 11 Sep 2017 19:45:04 +0200
parents 2779d593a706
children 805f7fd40e0d
comparison
equal deleted inserted replaced
12426:510faba3f8e5 12427:fc3e2d5614dd
485 call assert_true(winnr('$') == 2) 485 call assert_true(winnr('$') == 2)
486 486
487 " 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.
488 Xclose 488 Xclose
489 489
490 if a:cchar == 'l'
491 " When a help window is present, running :lhelpgrep should reuse the
492 " help window and not the current window
493 new | only
494 call g:Xsetlist([], 'f')
495 help index.txt
496 wincmd w
497 lhelpgrep quickfix
498 call assert_equal(1, winnr())
499 call assert_notequal([], getloclist(1))
500 call assert_equal([], getloclist(2))
501 endif
502
490 new | only 503 new | only
491 504
492 " Search for non existing help string 505 " Search for non existing help string
493 call assert_fails('Xhelpgrep a1b2c3', 'E480:') 506 call assert_fails('Xhelpgrep a1b2c3', 'E480:')
494 endfunc 507 endfunc
1682 call assert_equal(3, len(res)) 1695 call assert_equal(3, len(res))
1683 let common = 'errors :set' . (a:cchar == 'c' ? 'qf' : 'loc') . 'list()' 1696 let common = 'errors :set' . (a:cchar == 'c' ? 'qf' : 'loc') . 'list()'
1684 call assert_equal(' error list 1 of 3; 1 ' . common, res[0]) 1697 call assert_equal(' error list 1 of 3; 1 ' . common, res[0])
1685 call assert_equal(' error list 2 of 3; 2 ' . common, res[1]) 1698 call assert_equal(' error list 2 of 3; 2 ' . common, res[1])
1686 call assert_equal('> error list 3 of 3; 3 ' . common, res[2]) 1699 call assert_equal('> error list 3 of 3; 3 ' . common, res[2])
1700
1701 call g:Xsetlist([], 'f')
1702 let l = split(execute(a:cchar . 'hist'), "\n")
1703 call assert_equal('No entries', l[0])
1687 endfunc 1704 endfunc
1688 1705
1689 func Test_history() 1706 func Test_history()
1690 call HistoryTest('c') 1707 call HistoryTest('c')
1691 call HistoryTest('l') 1708 call HistoryTest('l')
1860 call assert_equal(40, l.items[0].lnum) 1877 call assert_equal(40, l.items[0].lnum)
1861 call g:Xsetlist([], 'r', {'items' : []}) 1878 call g:Xsetlist([], 'r', {'items' : []})
1862 let l = g:Xgetlist({'items':1}) 1879 let l = g:Xgetlist({'items':1})
1863 call assert_equal(0, len(l.items)) 1880 call assert_equal(0, len(l.items))
1864 1881
1882 call g:Xsetlist([], 'r', {'title' : 'TestTitle'})
1883 call g:Xsetlist([], 'r', {'items' : [{'filename' : 'F1', 'lnum' : 10, 'text' : 'L10'}]})
1884 call g:Xsetlist([], 'r', {'items' : [{'filename' : 'F1', 'lnum' : 10, 'text' : 'L10'}]})
1885 call assert_equal('TestTitle', g:Xgetlist({'title' : 1}).title)
1886
1865 " The following used to crash Vim with address sanitizer 1887 " The following used to crash Vim with address sanitizer
1866 call g:Xsetlist([], 'f') 1888 call g:Xsetlist([], 'f')
1867 call g:Xsetlist([], 'a', {'items' : [{'filename':'F1', 'lnum':10}]}) 1889 call g:Xsetlist([], 'a', {'items' : [{'filename':'F1', 'lnum':10}]})
1868 call assert_equal(10, g:Xgetlist({'items':1}).items[0].lnum) 1890 call assert_equal(10, g:Xgetlist({'items':1}).items[0].lnum)
1869 1891
1902 let l2.id=save_id 1924 let l2.id=save_id
1903 call g:Xsetlist([], 'r', l1) 1925 call g:Xsetlist([], 'r', l1)
1904 call g:Xsetlist([], 'r', l2) 1926 call g:Xsetlist([], 'r', l2)
1905 let newl1=g:Xgetlist({'nr':1,'all':1}) 1927 let newl1=g:Xgetlist({'nr':1,'all':1})
1906 let newl2=g:Xgetlist({'nr':2,'all':1}) 1928 let newl2=g:Xgetlist({'nr':2,'all':1})
1907 call assert_equal(':Fruits', newl1.title) 1929 call assert_equal('Fruits', newl1.title)
1908 call assert_equal(['Fruits'], newl1.context) 1930 call assert_equal(['Fruits'], newl1.context)
1909 call assert_equal('Line20', newl1.items[0].text) 1931 call assert_equal('Line20', newl1.items[0].text)
1910 call assert_equal(':Colors', newl2.title) 1932 call assert_equal('Colors', newl2.title)
1911 call assert_equal(['Colors'], newl2.context) 1933 call assert_equal(['Colors'], newl2.context)
1912 call assert_equal('Line10', newl2.items[0].text) 1934 call assert_equal('Line10', newl2.items[0].text)
1913 call g:Xsetlist([], 'f') 1935 call g:Xsetlist([], 'f')
1914 endfunc 1936 endfunc
1915 1937