Mercurial > vim
comparison src/testdir/test_quickfix.vim @ 11445:461ac47c3793 v8.0.0606
patch 8.0.0606: cannot set the context for a specified quickfix list
commit https://github.com/vim/vim/commit/6e62da3e14d32f76f60d5cc8b267059923842f17
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun May 28 08:16:25 2017 +0200
patch 8.0.0606: cannot set the context for a specified quickfix list
Problem: Cannot set the context for a specified quickfix list.
Solution: Use the list index instead of the current list. (Yegappan
Lakshmanan)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 28 May 2017 08:30:03 +0200 |
parents | 84baca75b7f2 |
children | 46bbef0ee9a6 |
comparison
equal
deleted
inserted
replaced
11444:ed1124a576da | 11445:461ac47c3793 |
---|---|
1802 call assert_equal([1, 2], getloclist(w2_id, {'context':1}).context) | 1802 call assert_equal([1, 2], getloclist(w2_id, {'context':1}).context) |
1803 only | 1803 only |
1804 call setloclist(0, [], 'f') | 1804 call setloclist(0, [], 'f') |
1805 call assert_equal({}, getloclist(0, {'context':1})) | 1805 call assert_equal({}, getloclist(0, {'context':1})) |
1806 endif | 1806 endif |
1807 | |
1808 " Test for changing the context of previous quickfix lists | |
1809 call g:Xsetlist([], 'f') | |
1810 Xexpr "One" | |
1811 Xexpr "Two" | |
1812 Xexpr "Three" | |
1813 call g:Xsetlist([], ' ', {'context' : [1], 'nr' : 1}) | |
1814 call g:Xsetlist([], ' ', {'context' : [2], 'nr' : 2}) | |
1815 " Also, check for setting the context using quickfix list number zero. | |
1816 call g:Xsetlist([], ' ', {'context' : [3], 'nr' : 0}) | |
1817 call test_garbagecollect_now() | |
1818 let l = g:Xgetlist({'nr' : 1, 'context' : 1}) | |
1819 call assert_equal([1], l.context) | |
1820 let l = g:Xgetlist({'nr' : 2, 'context' : 1}) | |
1821 call assert_equal([2], l.context) | |
1822 let l = g:Xgetlist({'nr' : 3, 'context' : 1}) | |
1823 call assert_equal([3], l.context) | |
1824 | |
1825 " Test for changing the context through reference and for garbage | |
1826 " collection of quickfix context | |
1827 let l = ["red"] | |
1828 call g:Xsetlist([], ' ', {'context' : l}) | |
1829 call add(l, "blue") | |
1830 let x = g:Xgetlist({'context' : 1}) | |
1831 call add(x.context, "green") | |
1832 call assert_equal(["red", "blue", "green"], l) | |
1833 call assert_equal(["red", "blue", "green"], x.context) | |
1834 unlet l | |
1835 call test_garbagecollect_now() | |
1836 let m = g:Xgetlist({'context' : 1}) | |
1837 call assert_equal(["red", "blue", "green"], m.context) | |
1807 endfunc | 1838 endfunc |
1808 | 1839 |
1809 func Test_qf_property() | 1840 func Test_qf_property() |
1810 call Xproperty_tests('c') | 1841 call Xproperty_tests('c') |
1811 call Xproperty_tests('l') | 1842 call Xproperty_tests('l') |
2071 " Tests for the quickifx free functionality | 2102 " Tests for the quickifx free functionality |
2072 func Test_qf_free() | 2103 func Test_qf_free() |
2073 call XfreeTests('c') | 2104 call XfreeTests('c') |
2074 call XfreeTests('l') | 2105 call XfreeTests('l') |
2075 endfunc | 2106 endfunc |
2107 | |
2108 " Test for buffer overflow when parsing lines and adding new entries to | |
2109 " the quickfix list. | |
2110 func Test_bufoverflow() | |
2111 set efm=%f:%l:%m | |
2112 cgetexpr ['File1:100:' . repeat('x', 1025)] | |
2113 | |
2114 set efm=%+GCompiler:\ %.%#,%f:%l:%m | |
2115 cgetexpr ['Compiler: ' . repeat('a', 1015), 'File1:10:Hello World'] | |
2116 | |
2117 set efm=%DEntering\ directory\ %f,%f:%l:%m | |
2118 cgetexpr ['Entering directory ' . repeat('a', 1006), | |
2119 \ 'File1:10:Hello World'] | |
2120 set efm&vim | |
2121 endfunc | |
2122 |