aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-04-26 08:38:21 +0800
committerGitHub <noreply@github.com>2022-04-26 08:38:21 +0800
commitd7a731595752244380090dfbe776b8c1334b93cb (patch)
tree35fc0d09a0eab693f7bf1110f0433a8f54448bb4 /src/nvim/testdir
parentaf82eab946cf9f36e544b0591b8c8c02e8ddf316 (diff)
parent13e54f713034e1a38eaf613d11b43ea8c42ca7df (diff)
downloadrneovim-d7a731595752244380090dfbe776b8c1334b93cb.tar.gz
rneovim-d7a731595752244380090dfbe776b8c1334b93cb.tar.bz2
rneovim-d7a731595752244380090dfbe776b8c1334b93cb.zip
Merge pull request #18249 from zeertzjq/vim-8.2.4760
vim-patch:8.2.{4760,4765}: matchfuzzy() limit
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_matchfuzzy.vim12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_matchfuzzy.vim b/src/nvim/testdir/test_matchfuzzy.vim
index abcc9b40c1..d53f8b0f4d 100644
--- a/src/nvim/testdir/test_matchfuzzy.vim
+++ b/src/nvim/testdir/test_matchfuzzy.vim
@@ -245,4 +245,16 @@ func Test_matchfuzzypos_mbyte()
call assert_equal([['xффйд'], [[2, 3, 4]], [168]], matchfuzzypos(['xффйд'], 'фйд'))
endfunc
+" Test for matchfuzzy() with limit
+func Test_matchfuzzy_limit()
+ let x = ['1', '2', '3', '2']
+ call assert_equal(['2', '2'], x->matchfuzzy('2'))
+ call assert_equal(['2', '2'], x->matchfuzzy('2', #{}))
+ call assert_equal(['2', '2'], x->matchfuzzy('2', #{limit: 0}))
+ call assert_equal(['2'], x->matchfuzzy('2', #{limit: 1}))
+ call assert_equal(['2', '2'], x->matchfuzzy('2', #{limit: 2}))
+ call assert_equal(['2', '2'], x->matchfuzzy('2', #{limit: 3}))
+ call assert_fails("call matchfuzzy(x, '2', #{limit: '2'})", 'E475:')
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab