diff options
| author | TJ DeVries <devries.timothyj@gmail.com> | 2020-09-01 22:00:55 -0400 |
|---|---|---|
| committer | TJ DeVries <devries.timothyj@gmail.com> | 2020-09-01 22:00:55 -0400 |
| commit | c11a6613625008c7d45702301cdf404873674c58 (patch) | |
| tree | fa39a75d0c0bfca81e8ec9acc21e43f7275e9231 /lua/tests/telescope_spec.lua | |
| parent | 4ac50c68ca43a0be7e8e238b7f781ad5074d8669 (diff) | |
feat: new fuzzy sorter
Diffstat (limited to 'lua/tests/telescope_spec.lua')
| -rw-r--r-- | lua/tests/telescope_spec.lua | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/lua/tests/telescope_spec.lua b/lua/tests/telescope_spec.lua index 8d20c5d..4579902 100644 --- a/lua/tests/telescope_spec.lua +++ b/lua/tests/telescope_spec.lua @@ -237,13 +237,25 @@ describe('Sorters', function() it('sort matches well', function() local sorter = require('telescope.sorters').get_fuzzy_file() - local exact_match = sorter:score('hello', 'hello') + local exact_match = sorter:score('abcdef', 'abcdef') local no_match = sorter:score('abcdef', 'ghijkl') local ok_match = sorter:score('abcdef', 'ab') - assert(exact_match < no_match) - assert(exact_match < ok_match) - assert(ok_match < no_match) + assert( + exact_match < no_match, + string.format("Exact match better than no match: %s %s", exact_match, no_match) + ) + assert(exact_match < ok_match, "Exact match better than OK match") + assert(ok_match < no_match, "OK match better than no match") + end) + + it('sorts matches after last os sep better', function() + local sorter = require('telescope.sorters').get_fuzzy_file() + + local exact_match = sorter:score('aaa/bbb', 'aaa') + local ok_match = sorter:score('bbb/aaa', 'aaa') + + assert(exact_match < ok_match, "Exact match better than OK match") end) -- it('sorts multiple finds better', function() |
