summaryrefslogtreecommitdiff
path: root/scratch/test_fuzzy_file.lua
diff options
context:
space:
mode:
authorTJ DeVries <devries.timothyj@gmail.com>2020-09-01 22:00:55 -0400
committerTJ DeVries <devries.timothyj@gmail.com>2020-09-01 22:00:55 -0400
commitc11a6613625008c7d45702301cdf404873674c58 (patch)
treefa39a75d0c0bfca81e8ec9acc21e43f7275e9231 /scratch/test_fuzzy_file.lua
parent4ac50c68ca43a0be7e8e238b7f781ad5074d8669 (diff)
feat: new fuzzy sorter
Diffstat (limited to 'scratch/test_fuzzy_file.lua')
-rw-r--r--scratch/test_fuzzy_file.lua20
1 files changed, 20 insertions, 0 deletions
diff --git a/scratch/test_fuzzy_file.lua b/scratch/test_fuzzy_file.lua
new file mode 100644
index 0000000..85d083a
--- /dev/null
+++ b/scratch/test_fuzzy_file.lua
@@ -0,0 +1,20 @@
+RELOAD('telescope')
+
+local sorter = require('telescope.sorters').get_fuzzy_file()
+
+-- Test for tail.
+assert(sorter:score("aaa", "aaa/bbb") > sorter:score("aaa", "bbb/aaa"))
+assert(
+ sorter:score("path", "/path/to/directory/file.txt")
+ > sorter:score("path", "/file/to/directory/path.txt")
+)
+
+-- Matches well for UpperCase (basically just bonus points for having uppercase letters)
+assert(sorter:score("AAA", "/blah/this/aaa/that") > sorter:score("AAA", "/blah/this/AAA/that"))
+
+-- TODO: Determine our strategy for these
+-- TODO: Make it so that capital letters count extra for being after a path sep.
+-- assert(sorter:score("ftp", "/folder/to/python") > sorter:score("FTP", "/folder/to/python"))
+
+-- TODO: Make it so that
+-- assert(sorter:score("build", "/home/tj/build/neovim") > sorter:score("htbn", "/home/tj/build/neovim"))