summaryrefslogtreecommitdiff
path: root/src/testdir/test_matchfuzzy.vim
diff options
context:
space:
mode:
authorKazuyuki Miyagi <yuzu3886@gmail.com>2022-06-17 18:30:03 +0100
committerBram Moolenaar <Bram@vim.org>2022-06-17 18:30:03 +0100
commit47f1a55849a73cefe738a246798221e45448546a (patch)
tree5f3cd273b71e510e46ded724512a5cff1d1600fe /src/testdir/test_matchfuzzy.vim
parentd592deb336523a5448779ee3d4bba80334cff1f7 (diff)
downloadvim-git-47f1a55849a73cefe738a246798221e45448546a.tar.gz
patch 8.2.5116: "limit" option of matchfuzzy() not always respectedv8.2.5116
Problem: "limit" option of matchfuzzy() not always respected. Solution: Remove "else". (Kazuyuki Miyagi, closes #10586)
Diffstat (limited to 'src/testdir/test_matchfuzzy.vim')
-rw-r--r--src/testdir/test_matchfuzzy.vim8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/testdir/test_matchfuzzy.vim b/src/testdir/test_matchfuzzy.vim
index b397392a7..02a74469e 100644
--- a/src/testdir/test_matchfuzzy.vim
+++ b/src/testdir/test_matchfuzzy.vim
@@ -243,6 +243,14 @@ func Test_matchfuzzy_limit()
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:')
+
+ let l = [{'id': 5, 'val': 'crayon'}, {'id': 6, 'val': 'camera'}]
+ call assert_equal([{'id': 5, 'val': 'crayon'}, {'id': 6, 'val': 'camera'}], l->matchfuzzy('c', #{text_cb: {v -> v.val}}))
+ call assert_equal([{'id': 5, 'val': 'crayon'}, {'id': 6, 'val': 'camera'}], l->matchfuzzy('c', #{key: 'val'}))
+ call assert_equal([{'id': 5, 'val': 'crayon'}, {'id': 6, 'val': 'camera'}], l->matchfuzzy('c', #{text_cb: {v -> v.val}, limit: 0}))
+ call assert_equal([{'id': 5, 'val': 'crayon'}, {'id': 6, 'val': 'camera'}], l->matchfuzzy('c', #{key: 'val', limit: 0}))
+ call assert_equal([{'id': 5, 'val': 'crayon'}], l->matchfuzzy('c', #{text_cb: {v -> v.val}, limit: 1}))
+ call assert_equal([{'id': 5, 'val': 'crayon'}], l->matchfuzzy('c', #{key: 'val', limit: 1}))
endfunc
" vim: shiftwidth=2 sts=2 expandtab