diff options
| author | TJ DeVries <devries.timothyj@gmail.com> | 2020-12-23 13:31:05 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-23 13:31:05 -0500 |
| commit | 049602a2c5f436fd7758fe5dd2fd1fcea696b83b (patch) | |
| tree | df8297e7904e2f30bfe1a33587269a6794ddb962 /lua/tests | |
| parent | 4850c6df6d04aa6b98912b1dac9def713b1eda44 (diff) | |
ci: more tests (#359)
* more tests
* lint
Diffstat (limited to 'lua/tests')
| -rw-r--r-- | lua/tests/automated/pickers/find_files_spec.lua | 16 | ||||
| -rw-r--r-- | lua/tests/pickers/find_files__readme.lua | 2 | ||||
| -rw-r--r-- | lua/tests/pickers/find_files__with_ctrl_n.lua | 27 |
3 files changed, 22 insertions, 23 deletions
diff --git a/lua/tests/automated/pickers/find_files_spec.lua b/lua/tests/automated/pickers/find_files_spec.lua index 6035075..c5cf50e 100644 --- a/lua/tests/automated/pickers/find_files_spec.lua +++ b/lua/tests/automated/pickers/find_files_spec.lua @@ -1,12 +1,16 @@ require('plenary.reload').reload_module('telescope') -local tester = require('telescope.pickers._tests') +local tester = require('telescope.pickers._test') describe('builtin.find_files', function() it('should find the readme', function() tester.run_file('find_files__readme') end) + it('should be able to move selections', function() + tester.run_file('find_files__with_ctrl_n') + end) + it('should not display devicons when disabled', function() tester.run_string [[ tester.builtin_picker('find_files', 'README.md', { @@ -105,4 +109,14 @@ describe('builtin.find_files', function() }) ]] end) + + it('should be able to get the current selection', function() + tester.run_string [[ + tester.builtin_picker('find_files', 'fixtures/file_abc', { + post_typed = { + { 'lua/tests/fixtures/file_abc.txt', GetSelectionValue }, + } + }) + ]] + end) end) diff --git a/lua/tests/pickers/find_files__readme.lua b/lua/tests/pickers/find_files__readme.lua index 6753d5d..620c3be 100644 --- a/lua/tests/pickers/find_files__readme.lua +++ b/lua/tests/pickers/find_files__readme.lua @@ -1,4 +1,4 @@ -local tester = require('telescope.pickers._tests') +local tester = require('telescope.pickers._test') tester.builtin_picker('find_files', 'README.md', { post_close = { diff --git a/lua/tests/pickers/find_files__with_ctrl_n.lua b/lua/tests/pickers/find_files__with_ctrl_n.lua index e6eecdd..78a31fd 100644 --- a/lua/tests/pickers/find_files__with_ctrl_n.lua +++ b/lua/tests/pickers/find_files__with_ctrl_n.lua @@ -1,24 +1,9 @@ -pcall(function() RELOAD('telescope') end) +local tester = require('telescope.pickers._test') +local helper = require('telescope.pickers._test_helpers') -local builtin = require('telescope.builtin') -local tester = require('telescope.pickers._tests') - -local key = 'find_files' -local input = 'fixtures/file<c-p>' -local expected = 'lua/tests/fixtures/file_2.txt' -local get_actual = function() - return vim.fn.fnamemodify(vim.api.nvim_buf_get_name(0), ":.") -end - --- local on_complete_item = tester.picker_feed(input, expected, get_actual, true) --- --- builtin[key] { --- on_complete = { on_complete_item } --- } - -tester.builtin_picker('find_files', 'fixtures/file<c-p>', 'lua/tests/fixtures/file_2.txt', function() - return vim.fn.fnamemodify(vim.api.nvim_buf_get_name(0), ":.") -end, { - debug = false, +tester.builtin_picker('find_files', 'fixtures/file<c-p>', { + post_close = { + { 'lua/tests/fixtures/file_2.txt', helper.get_file } + }, }) |
