summaryrefslogtreecommitdiff
path: root/lua/telescope/pickers/_test_helpers.lua
diff options
context:
space:
mode:
authorTJ DeVries <devries.timothyj@gmail.com>2021-01-11 13:29:37 -0500
committerGitHub <noreply@github.com>2021-01-11 13:29:37 -0500
commit8783bea06e1e0dfa8dfd4834058923088471d832 (patch)
tree050096ba649a94bb01e7c0b3a029e9b4eb060029 /lua/telescope/pickers/_test_helpers.lua
parentde80a9837cd1d207981c1f6dbf504436f8bfee13 (diff)
feat: quickfix (#293)
* feat: quickfix (not implemented) * [WIP]: Wed 09 Dec 2020 11:11:30 PM EST * somewhat working linked list impl * getting closer * might be working * might be working for real * works and implemented basic example * dont forget to close prompt * fix descending and add more tests * test fixes * fix test * more logging * Fix some more tests * Fix logging messing up tests * fix: lint * fix: multi select stuffs
Diffstat (limited to 'lua/telescope/pickers/_test_helpers.lua')
-rw-r--r--lua/telescope/pickers/_test_helpers.lua12
1 files changed, 9 insertions, 3 deletions
diff --git a/lua/telescope/pickers/_test_helpers.lua b/lua/telescope/pickers/_test_helpers.lua
index a430fae..63d1a0f 100644
--- a/lua/telescope/pickers/_test_helpers.lua
+++ b/lua/telescope/pickers/_test_helpers.lua
@@ -22,9 +22,15 @@ test_helpers.get_results = function()
return vim.api.nvim_buf_get_lines(test_helpers.get_results_bufnr(), 0, -1, false)
end
-test_helpers.get_last_result = function()
+test_helpers.get_best_result = function()
local results = test_helpers.get_results()
- return results[#results]
+ local picker = test_helpers.get_picker ()
+
+ if picker.sorting_strategy == 'ascending' then
+ return results[1]
+ else
+ return results[#results]
+ end
end
test_helpers.get_selection = function()
@@ -41,7 +47,7 @@ test_helpers.make_globals = function()
GetPrompt = test_helpers.get_prompt -- luacheck: globals GetPrompt
GetResults = test_helpers.get_results -- luacheck: globals GetResults
- GetLastResult = test_helpers.get_last_result -- luacheck: globals GetLastResult
+ GetBestResult = test_helpers.get_best_result -- luacheck: globals GetBestResult
GetSelection = test_helpers.get_selection -- luacheck: globals GetSelection
GetSelectionValue = test_helpers.get_selection_value -- luacheck: globals GetSelectionValue