aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2017-12-19 10:53:59 -0500
committerJames McCoy <jamessan@jamessan.com>2017-12-19 14:07:24 -0500
commit190814bdae496c0ce4dfb524f9bb5ee7a09b4f60 (patch)
treea0bc8eade01a25a5dbbb69bc20930e84ac221030 /src/nvim/testdir
parentcdd86f42cf93135d1c4dddcc2ba13b9798034350 (diff)
downloadrneovim-190814bdae496c0ce4dfb524f9bb5ee7a09b4f60.tar.gz
rneovim-190814bdae496c0ce4dfb524f9bb5ee7a09b4f60.tar.bz2
rneovim-190814bdae496c0ce4dfb524f9bb5ee7a09b4f60.zip
vim-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) https://github.com/vim/vim/commit/6e62da3e14d32f76f60d5cc8b267059923842f17
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_quickfix.vim47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_quickfix.vim b/src/nvim/testdir/test_quickfix.vim
index 1d17da31ed..30023dddc9 100644
--- a/src/nvim/testdir/test_quickfix.vim
+++ b/src/nvim/testdir/test_quickfix.vim
@@ -1786,6 +1786,37 @@ func Xproperty_tests(cchar)
call setloclist(0, [], 'f')
call assert_equal({}, getloclist(0, {'context':1}))
endif
+
+ " Test for changing the context of previous quickfix lists
+ call g:Xsetlist([], 'f')
+ Xexpr "One"
+ Xexpr "Two"
+ Xexpr "Three"
+ call g:Xsetlist([], ' ', {'context' : [1], 'nr' : 1})
+ call g:Xsetlist([], ' ', {'context' : [2], 'nr' : 2})
+ " Also, check for setting the context using quickfix list number zero.
+ call g:Xsetlist([], ' ', {'context' : [3], 'nr' : 0})
+ call test_garbagecollect_now()
+ let l = g:Xgetlist({'nr' : 1, 'context' : 1})
+ call assert_equal([1], l.context)
+ let l = g:Xgetlist({'nr' : 2, 'context' : 1})
+ call assert_equal([2], l.context)
+ let l = g:Xgetlist({'nr' : 3, 'context' : 1})
+ call assert_equal([3], l.context)
+
+ " Test for changing the context through reference and for garbage
+ " collection of quickfix context
+ let l = ["red"]
+ call g:Xsetlist([], ' ', {'context' : l})
+ call add(l, "blue")
+ let x = g:Xgetlist({'context' : 1})
+ call add(x.context, "green")
+ call assert_equal(["red", "blue", "green"], l)
+ call assert_equal(["red", "blue", "green"], x.context)
+ unlet l
+ call test_garbagecollect_now()
+ let m = g:Xgetlist({'context' : 1})
+ call assert_equal(["red", "blue", "green"], m.context)
endfunc
func Test_qf_property()
@@ -2055,3 +2086,19 @@ func Test_qf_free()
call XfreeTests('c')
call XfreeTests('l')
endfunc
+
+" Test for buffer overflow when parsing lines and adding new entries to
+" the quickfix list.
+func Test_bufoverflow()
+ set efm=%f:%l:%m
+ cgetexpr ['File1:100:' . repeat('x', 1025)]
+
+ set efm=%+GCompiler:\ %.%#,%f:%l:%m
+ cgetexpr ['Compiler: ' . repeat('a', 1015), 'File1:10:Hello World']
+
+ set efm=%DEntering\ directory\ %f,%f:%l:%m
+ cgetexpr ['Entering directory ' . repeat('a', 1006),
+ \ 'File1:10:Hello World']
+ set efm&vim
+endfunc
+