comparison src/testdir/test_matchfuzzy.vim @ 29194:f92f658585e6 v8.2.5116

patch 8.2.5116: "limit" option of matchfuzzy() not always respected Commit: https://github.com/vim/vim/commit/47f1a55849a73cefe738a246798221e45448546a Author: Kazuyuki Miyagi <yuzu3886@gmail.com> Date: Fri Jun 17 18:30:03 2022 +0100 patch 8.2.5116: "limit" option of matchfuzzy() not always respected Problem: "limit" option of matchfuzzy() not always respected. Solution: Remove "else". (Kazuyuki Miyagi, closes https://github.com/vim/vim/issues/10586)
author Bram Moolenaar <Bram@vim.org>
date Fri, 17 Jun 2022 19:45:02 +0200
parents b5c46d447518
children 209420b9d2dd
comparison
equal deleted inserted replaced
29193:1e9e9d89f0ee 29194:f92f658585e6
241 call assert_equal(['2', '2'], x->matchfuzzy('2', #{limit: 0})) 241 call assert_equal(['2', '2'], x->matchfuzzy('2', #{limit: 0}))
242 call assert_equal(['2'], x->matchfuzzy('2', #{limit: 1})) 242 call assert_equal(['2'], x->matchfuzzy('2', #{limit: 1}))
243 call assert_equal(['2', '2'], x->matchfuzzy('2', #{limit: 2})) 243 call assert_equal(['2', '2'], x->matchfuzzy('2', #{limit: 2}))
244 call assert_equal(['2', '2'], x->matchfuzzy('2', #{limit: 3})) 244 call assert_equal(['2', '2'], x->matchfuzzy('2', #{limit: 3}))
245 call assert_fails("call matchfuzzy(x, '2', #{limit: '2'})", 'E475:') 245 call assert_fails("call matchfuzzy(x, '2', #{limit: '2'})", 'E475:')
246
247 let l = [{'id': 5, 'val': 'crayon'}, {'id': 6, 'val': 'camera'}]
248 call assert_equal([{'id': 5, 'val': 'crayon'}, {'id': 6, 'val': 'camera'}], l->matchfuzzy('c', #{text_cb: {v -> v.val}}))
249 call assert_equal([{'id': 5, 'val': 'crayon'}, {'id': 6, 'val': 'camera'}], l->matchfuzzy('c', #{key: 'val'}))
250 call assert_equal([{'id': 5, 'val': 'crayon'}, {'id': 6, 'val': 'camera'}], l->matchfuzzy('c', #{text_cb: {v -> v.val}, limit: 0}))
251 call assert_equal([{'id': 5, 'val': 'crayon'}, {'id': 6, 'val': 'camera'}], l->matchfuzzy('c', #{key: 'val', limit: 0}))
252 call assert_equal([{'id': 5, 'val': 'crayon'}], l->matchfuzzy('c', #{text_cb: {v -> v.val}, limit: 1}))
253 call assert_equal([{'id': 5, 'val': 'crayon'}], l->matchfuzzy('c', #{key: 'val', limit: 1}))
246 endfunc 254 endfunc
247 255
248 " vim: shiftwidth=2 sts=2 expandtab 256 " vim: shiftwidth=2 sts=2 expandtab