aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-06-20 22:05:29 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-06-23 18:17:08 -0400
commit83ef740e150c5f29bd8ed92681d892160474fd7f (patch)
tree99f548552347978aca8a0cf6849d0e4525d289cd /src/nvim/testdir
parent0bdeec8ef02bcd497f6df77b2a00420c948c9438 (diff)
downloadrneovim-83ef740e150c5f29bd8ed92681d892160474fd7f.tar.gz
rneovim-83ef740e150c5f29bd8ed92681d892160474fd7f.tar.bz2
rneovim-83ef740e150c5f29bd8ed92681d892160474fd7f.zip
vim-patch:8.0.1239: cannot use a lambda for the skip argument to searchpair()
Problem: Cannot use a lambda for the skip argument to searchpair(). Solution: Evaluate a partial, funcref and lambda. (LemonBoy, closes vim/vim#1454, closes vim/vim#2265) https://github.com/vim/vim/commit/48570488f17e397183ea7d5c7ca67d6e4ffb013d
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_search.vim19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim
index 87cad241e2..24ea8cd75a 100644
--- a/src/nvim/testdir/test_search.vim
+++ b/src/nvim/testdir/test_search.vim
@@ -298,6 +298,25 @@ func Test_searchpair()
q!
endfunc
+func Test_searchpair_skip()
+ func Zero()
+ return 0
+ endfunc
+ func Partial(x)
+ return a:x
+ endfunc
+ new
+ call setline(1, ['{', 'foo', 'foo', 'foo', '}'])
+ 3 | call assert_equal(1, searchpair('{', '', '}', 'bWn', ''))
+ 3 | call assert_equal(1, searchpair('{', '', '}', 'bWn', '0'))
+ 3 | call assert_equal(1, searchpair('{', '', '}', 'bWn', {-> 0}))
+ 3 | call assert_equal(1, searchpair('{', '', '}', 'bWn', function('Zero')))
+ 3 | call assert_equal(1, searchpair('{', '', '}', 'bWn', function('Partial', [0])))
+ " invalid argument
+ 3 | call assert_equal(0, searchpair('{', '', '}', 'bWn', 0))
+ bw!
+endfunc
+
func Test_searchc()
" These commands used to cause memory overflow in searchc().
new