Mercurial > vim
diff src/testdir/test_functions.vim @ 22355:0491b9cafd44 v8.2.1726
patch 8.2.1726: fuzzy matching only works on strings
Commit: https://github.com/vim/vim/commit/4f73b8e9cc83f647b34002554a8bdf9abec0a82f
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Sep 22 20:33:50 2020 +0200
patch 8.2.1726: fuzzy matching only works on strings
Problem: Fuzzy matching only works on strings.
Solution: Support passing a dict. Add matchfuzzypos() to also get the match
positions. (Yegappan Lakshmanan, closes #6947)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 22 Sep 2020 20:45:04 +0200 |
parents | f22acf6472da |
children | 0e231e8e70f8 |
line wrap: on
line diff
--- a/src/testdir/test_functions.vim +++ b/src/testdir/test_functions.vim @@ -2554,28 +2554,4 @@ func Test_browsedir() call assert_fails('call browsedir("open", [])', 'E730:') endfunc -" Test for matchfuzzy() -func Test_matchfuzzy() - call assert_fails('call matchfuzzy(10, "abc")', 'E714:') - call assert_fails('call matchfuzzy(["abc"], [])', 'E730:') - call assert_equal([], matchfuzzy([], 'abc')) - call assert_equal([], matchfuzzy(['abc'], '')) - call assert_equal(['abc'], matchfuzzy(['abc', 10], 'ac')) - call assert_equal([], matchfuzzy([10, 20], 'ac')) - call assert_equal(['abc'], matchfuzzy(['abc'], 'abc')) - call assert_equal(['crayon', 'camera'], matchfuzzy(['camera', 'crayon'], 'cra')) - call assert_equal(['aabbaa', 'aaabbbaaa', 'aaaabbbbaaaa', 'aba'], matchfuzzy(['aba', 'aabbaa', 'aaabbbaaa', 'aaaabbbbaaaa'], 'aa')) - call assert_equal(['one'], matchfuzzy(['one', 'two'], 'one')) - call assert_equal(['oneTwo', 'onetwo'], matchfuzzy(['onetwo', 'oneTwo'], 'oneTwo')) - call assert_equal(['one_two', 'onetwo'], matchfuzzy(['onetwo', 'one_two'], 'oneTwo')) - call assert_equal(['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'], matchfuzzy(['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'], 'aa')) - call assert_equal([], matchfuzzy([repeat('a', 300)], repeat('a', 257))) - - %bw! - eval ['somebuf', 'anotherone', 'needle', 'yetanotherone']->map({_, v -> bufadd(v) + bufload(v)}) - let l = getbufinfo()->map({_, v -> v.name})->matchfuzzy('ndl') - call assert_equal(1, len(l)) - call assert_match('needle', l[0]) -endfunc - " vim: shiftwidth=2 sts=2 expandtab