-
Notifications
You must be signed in to change notification settings - Fork 284
Make 'mini.files' default explorer work with 'mini.pick' #2157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7667be1
eddcd47
6da03e5
7fe39e0
05e09fd
f1db59b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| local mock_title = function(x) | ||
| if type(x) ~= 'string' then return x end | ||
| -- Make sure that full path title is same on any machine | ||
| return x:gsub('^.*/tests/dir%-files', 'MOCK_ROOT/tests/dir-files') | ||
| end | ||
|
|
||
| _G.nvim_open_win_orig = vim.api.nvim_open_win | ||
|
|
||
| vim.api.nvim_open_win = function(buf_id, enter, config) | ||
| config.title = mock_title(config.title) | ||
| return nvim_open_win_orig(buf_id, enter, config) | ||
| end | ||
|
|
||
| _G.nvim_win_set_config_orig = vim.api.nvim_win_set_config | ||
|
|
||
| vim.api.nvim_win_set_config = function(win_id, config) | ||
| config.title = mock_title(config.title) | ||
| return nvim_win_set_config_orig(win_id, config) | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| --|---------|---------|---------|---------| | ||
| 01|local a = 1 | ||
| 02|local t = { | ||
| 03| x = math.max(a, 2), | ||
| 04| y = math.min(a, 2), | ||
| 05|┌> ▏─────────────────────┐ | ||
| 06|│ real-files │ | ||
| 07|│ │ | ||
| 08|│ │ | ||
| 09|│ │ | ||
| 10|│ │ | ||
| 11|│ │ | ||
| 12|│ │ | ||
| 13|│ │ | ||
| 14|└ Visit paths (cwd) ─────┘ | ||
| 15| | ||
|
|
||
| --|---------|---------|---------|---------| | ||
| 01|0000011111211111111111111111111111111111 | ||
| 02|0000011111311111111111111111111111111111 | ||
| 03|1141113333566651512551111111111111111111 | ||
| 04|1141113333566651512551111111111111111111 | ||
| 05|7889777777777777777777777711111111111111 | ||
| 06|7::;;;;;;;;;;;;;;;;;;;;;;7<<<<<<<<<<<<<< | ||
| 07|7========================7<<<<<<<<<<<<<< | ||
| 08|7========================7<<<<<<<<<<<<<< | ||
| 09|7========================7<<<<<<<<<<<<<< | ||
| 10|7========================7<<<<<<<<<<<<<< | ||
| 11|7========================7<<<<<<<<<<<<<< | ||
| 12|7========================7<<<<<<<<<<<<<< | ||
| 13|7========================7<<<<<<<<<<<<<< | ||
| 14|7>>>>>>>>>>>>>>>>>>>777777<<<<<<<<<<<<<< | ||
| 15|1111111111111111111111111111111111111111 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| --|---------|---------|---------|---------| | ||
| 01|┌…s/mini.nvim/tests/dir-extra/real-file┐ | ||
| 02|│ a.lua │ | ||
| 03|│ b.txt │ | ||
| 04|│ c.gif │ | ||
| 05|│ LICENSE │ | ||
| 06|│ Makefile │ | ||
| 07|└──────────────────────────────────────┘ | ||
| 08|~ | ||
| 09|~ | ||
| 10|~ | ||
| 11|~ | ||
| 12|~ | ||
| 13|~ | ||
| 14|~ | ||
| 15| | ||
|
|
||
| --|---------|---------|---------|---------| | ||
| 01|0111111111111111111111111111111111111110 | ||
| 02|0222222222222222222222222222222222222220 | ||
| 03|0333333333333333333333333333333333333330 | ||
| 04|0333333333333333333333333333333333333330 | ||
| 05|0333333333333333333333333333333333333330 | ||
| 06|0333333333333333333333333333333333333330 | ||
| 07|0000000000000000000000000000000000000000 | ||
| 08|4444444444444444444444444444444444444444 | ||
| 09|4444444444444444444444444444444444444444 | ||
| 10|4444444444444444444444444444444444444444 | ||
| 11|4444444444444444444444444444444444444444 | ||
| 12|4444444444444444444444444444444444444444 | ||
| 13|4444444444444444444444444444444444444444 | ||
| 14|4444444444444444444444444444444444444444 | ||
| 15|5555555555555555555555555555555555555555 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| --|---------|---------|---------|---------|---------|---------|---------|---------| | ||
| 01|┌MOCK_ROOT/tests/dir-files/common ─────────────────┐ | ||
| 02|│ .a-dir │ | ||
| 03|│ a-dir │ | ||
| 04|│ b-dir │ | ||
| 05|│ .a-file │ | ||
| 06|│ a-file │ | ||
| 07|│ A-file-2 │ | ||
| 08|│ b-file │ | ||
| 09|└──────────────────────────────────────────────────┘ | ||
| 10|~ | ||
| 11|~ | ||
| 12|~ | ||
| 13|~ | ||
| 14|~ | ||
| 15| 1,1 All | ||
|
|
||
| --|---------|---------|---------|---------|---------|---------|---------|---------| | ||
| 01|01111111111111111111111111111111110000000000000000002222222222222222222222222222 | ||
| 02|03333333344444444444444444444444444444444444444444405555555555555555555555555555 | ||
| 03|06666666777777777777777777777777777777777777777777705555555555555555555555555555 | ||
| 04|06666666777777777777777777777777777777777777777777705555555555555555555555555555 | ||
| 05|07777777777777777777777777777777777777777777777777705555555555555555555555555555 | ||
| 06|07777777777777777777777777777777777777777777777777705555555555555555555555555555 | ||
| 07|07777777777777777777777777777777777777777777777777705555555555555555555555555555 | ||
| 08|07777777777777777777777777777777777777777777777777705555555555555555555555555555 | ||
| 09|00000000000000000000000000000000000000000000000000005555555555555555555555555555 | ||
| 10|55555555555555555555555555555555555555555555555555555555555555555555555555555555 | ||
| 11|55555555555555555555555555555555555555555555555555555555555555555555555555555555 | ||
| 12|55555555555555555555555555555555555555555555555555555555555555555555555555555555 | ||
| 13|55555555555555555555555555555555555555555555555555555555555555555555555555555555 | ||
| 14|55555555555555555555555555555555555555555555555555555555555555555555555555555555 | ||
| 15|88888888888888888888888888888888888888888888888888888888888888888888888888888888 |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -5740,6 +5740,40 @@ T['Default explorer']['works in `:edit .`'] = function() | |||||||||||||||||||||||||||||||||||
| child.expect_screenshot() | ||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| T['Default explorer']['deletes directory buffer if already visited(no alternate)'] = function() | ||||||||||||||||||||||||||||||||||||
| -- Starting with empty buffer having id 1 | ||||||||||||||||||||||||||||||||||||
| child.cmd('edit ' .. test_dir_path) | ||||||||||||||||||||||||||||||||||||
| close() | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| local bufs = child.api.nvim_list_bufs() | ||||||||||||||||||||||||||||||||||||
| eq(#bufs, 1) | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| -- Assert that buffer with id 1 has been deleted, otherwise it would be named to directory test_dir_path | ||||||||||||||||||||||||||||||||||||
| local is_still_one = bufs[1] == 1 | ||||||||||||||||||||||||||||||||||||
| eq(is_still_one, false) | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+5744
to
+5753
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| T['Default explorer']['deletes directory buffer if already visited'] = function() | ||||||||||||||||||||||||||||||||||||
| -- Starting with listed buffer having id 1 | ||||||||||||||||||||||||||||||||||||
| child.cmd('edit ' .. test_file_path) | ||||||||||||||||||||||||||||||||||||
| child.cmd('edit ' .. test_dir_path) | ||||||||||||||||||||||||||||||||||||
| close() | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| local bufs = child.api.nvim_list_bufs() | ||||||||||||||||||||||||||||||||||||
| eq(#bufs, 1) | ||||||||||||||||||||||||||||||||||||
| eq(bufs[1], 1) | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+5757
to
+5764
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar notes about using explicit buffer ids. Although I think this test might be redundant as there is already the other "handles close without opening file".
Suggested change
|
||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| T['Default explorer']['does not crash on external `vim.api.nvim_set_current_win`'] = function() | ||||||||||||||||||||||||||||||||||||
| child.cmd('edit ' .. test_file_path) | ||||||||||||||||||||||||||||||||||||
| child.cmd('edit ' .. test_dir_path) | ||||||||||||||||||||||||||||||||||||
| child.lua([[ | ||||||||||||||||||||||||||||||||||||
| local win_id = vim.api.nvim_list_wins()[1] -- win id 1000 | ||||||||||||||||||||||||||||||||||||
| vim.api.nvim_set_current_win(win_id) | ||||||||||||||||||||||||||||||||||||
| ]]) | ||||||||||||||||||||||||||||||||||||
| child.expect_screenshot() | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+5768
to
+5774
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| T['Default explorer']['works in `:vsplit .`'] = function() | ||||||||||||||||||||||||||||||||||||
| child.cmd('vsplit ' .. test_dir_path) | ||||||||||||||||||||||||||||||||||||
| child.expect_screenshot() | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test fails since it clips the final
sin what seems to be your local directory where 'mini.nvim' is located. The GitHub runner (and possibly other local runs) will probably have different letter here.This is the drawback of using screenshot testing. The "mock window title" approach could have also been more robust here, but if there is a reasonably concise way to not do a screenshot testing, it should usually be taken.