summaryrefslogtreecommitdiffstats
path: root/src/testdir
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-10-30 21:48:41 +0100
committerBram Moolenaar <Bram@vim.org>2017-10-30 21:48:41 +0100
commit48570488f17e397183ea7d5c7ca67d6e4ffb013d (patch)
treef9bbc935f2f0d999e16d047056c747168791cb3e /src/testdir
parent2e51d9a0972080b087d566608472928d5b7b35d7 (diff)
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()v8.0.1239
Problem: Cannot use a lambda for the skip argument to searchpair(). Solution: Evaluate a partial, funcref and lambda. (LemonBoy, closes #1454, closes #2265)
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/test_search.vim19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim
index eb781106a9..b863fcbba3 100644
--- a/src/testdir/test_search.vim
+++ b/src/testdir/test_search.vim
@@ -296,6 +296,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