Update generated neovim config
This commit is contained in:
@ -2,7 +2,7 @@ _G.Months = {}
|
||||
|
||||
--stylua: ignore start
|
||||
Months.items = {
|
||||
{ name = 'January', kind = 1},
|
||||
{ name = 'January', kind = 1 },
|
||||
{ name = 'February', kind = 1 },
|
||||
{ name = 'March', kind = 2 },
|
||||
{ name = 'April', kind = 2 },
|
||||
|
||||
@ -32,13 +32,14 @@ end
|
||||
|
||||
vim.lsp.buf.document_symbol = function(opts)
|
||||
table.insert(_G.lsp_buf_calls, 'document_symbol')
|
||||
local symbol_kind = vim.lsp.protocol.SymbolKind
|
||||
local data = {
|
||||
context = make_context('textDocument/documentSymbol'),
|
||||
items = {
|
||||
{ col = 7, filename = filename, kind = 'Number', lnum = 1, text = '[Number] a' },
|
||||
{ col = 7, filename = filename, kind = 'Object', lnum = 2, text = '[Object] t' },
|
||||
{ col = 3, filename = filename, kind = 'Variable', lnum = 3, text = '[Variable] x' },
|
||||
{ col = 3, filename = filename, kind = 'Variable', lnum = 4, text = '[Variable] y' },
|
||||
{ col = 7, filename = filename, kind = symbol_kind[16], lnum = 1, text = '[' .. symbol_kind[16] .. '] a' },
|
||||
{ col = 7, filename = filename, kind = symbol_kind[19], lnum = 2, text = '[' .. symbol_kind[19] .. '] t' },
|
||||
{ col = 3, filename = filename, kind = symbol_kind[13], lnum = 3, text = '[' .. symbol_kind[13] .. '] x' },
|
||||
{ col = 3, filename = filename, kind = symbol_kind[13], lnum = 4, text = '[' .. symbol_kind[13] .. '] y' },
|
||||
},
|
||||
title = 'Symbols in a.lua',
|
||||
}
|
||||
@ -82,13 +83,14 @@ end
|
||||
vim.lsp.buf.workspace_symbol = function(query, opts)
|
||||
table.insert(_G.lsp_buf_calls, 'workspace_symbol')
|
||||
_G.workspace_symbol_query = query
|
||||
local symbol_kind = vim.lsp.protocol.SymbolKind
|
||||
local data = {
|
||||
context = make_context('textDocument/workspaceSymbol'),
|
||||
items = {
|
||||
{ col = 7, filename = filename, kind = 'Number', lnum = 1, text = '[Number] a' },
|
||||
{ col = 7, filename = filename, kind = 'Object', lnum = 2, text = '[Object] t' },
|
||||
{ col = 3, filename = filename, kind = 'Variable', lnum = 3, text = '[Variable] x' },
|
||||
{ col = 3, filename = filename, kind = 'Variable', lnum = 4, text = '[Variable] y' },
|
||||
{ col = 7, filename = filename, kind = symbol_kind[16], lnum = 1, text = '[' .. symbol_kind[16] .. '] a' },
|
||||
{ col = 7, filename = filename, kind = symbol_kind[19], lnum = 2, text = '[' .. symbol_kind[19] .. '] t' },
|
||||
{ col = 3, filename = filename, kind = symbol_kind[13], lnum = 3, text = '[' .. symbol_kind[13] .. '] x' },
|
||||
{ col = 3, filename = filename, kind = symbol_kind[13], lnum = 4, text = '[' .. symbol_kind[13] .. '] y' },
|
||||
},
|
||||
title = "Symbols matching ''",
|
||||
}
|
||||
|
||||
@ -1,10 +1,15 @@
|
||||
_G.process_log = {}
|
||||
|
||||
local n_pid, n_stream = 0, 0
|
||||
local n_pid = 0
|
||||
local new_process = function(pid)
|
||||
return {
|
||||
_is_active_indicator = true,
|
||||
pid = pid,
|
||||
close = function(_) table.insert(_G.process_log, 'Process ' .. pid .. ' was closed.') end,
|
||||
is_active = function(process) return process._is_active_indicator end,
|
||||
close = function(process)
|
||||
process._is_active_indicator = false
|
||||
table.insert(_G.process_log, 'Process ' .. pid .. ' was closed.')
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
@ -52,4 +57,7 @@ vim.loop.spawn = function(path, options, on_exit)
|
||||
return new_process(pid), pid
|
||||
end
|
||||
|
||||
vim.loop.process_kill = function(process) table.insert(_G.process_log, 'Process ' .. process.pid .. ' was killed.') end
|
||||
vim.loop.process_kill = function(process)
|
||||
process._is_active_indicator = false
|
||||
table.insert(_G.process_log, 'Process ' .. process.pid .. ' was killed.')
|
||||
end
|
||||
|
||||
@ -0,0 +1,38 @@
|
||||
This is a confirmation report before an update.
|
||||
|
||||
Other very useful info
|
||||
|
||||
!!! plugin_a !!!
|
||||
|
||||
Some error
|
||||
|
||||
+++ plugin_b +++
|
||||
Path: /home/user/.local/share/nvim/site/pack/deps/opt/plugin_b
|
||||
Source: https://github.com/cool-plugins/plugin_b
|
||||
State before: aa339f6ab611da07183a7fe44daa482605392502
|
||||
State after: 093b29f2b409278e2ed69a90462fee54714b5a84 (master)
|
||||
|
||||
Pending updates from `master`:
|
||||
> 093b29f2 | 2024-09-06 06:42:29 +0000 | Neo McVim
|
||||
feat: very important feature
|
||||
|
||||
> bfe74a48 | 2024-09-05 13:25:50 +0000 | Neo McVim
|
||||
fix: very important fix
|
||||
|
||||
< 3826d0c4 | 2024-09-04 09:08:06 +0200 | Neo McVim
|
||||
chore: not very important chore
|
||||
|
||||
+++ plugin_c +++
|
||||
Path: /home/user/.local/share/nvim/site/pack/deps/opt/plugin_c
|
||||
Source: https://github.com/cool-plugins/plugin_c
|
||||
State before: 3a3c6244553f13fdd92d312c82722b57ce6c4bec
|
||||
State after: fe3deb7f67ce0cc4ebfe2ea6c1c7ae1c7a939d73 (main)
|
||||
|
||||
Pending updates from `main`:
|
||||
> fe3deb7 | 2024-09-04 03:40:17 -0500 | Caleb White
|
||||
fix: even more important fix
|
||||
|
||||
--- plugin_d ---
|
||||
Path: /home/user/.local/share/nvim/site/pack/deps/opt/plugin_d
|
||||
Source: https://github.com/cool-plugins/plugin_d
|
||||
State: d231729b13da28fd1625c3d85f2315886ddeb05d (HEAD)
|
||||
@ -3,8 +3,13 @@ _G.process_log = {}
|
||||
local n_pid, n_stdout = 0, 0
|
||||
local new_process = function(pid)
|
||||
return {
|
||||
_is_active_indicator = true,
|
||||
pid = pid,
|
||||
close = function(_) table.insert(_G.process_log, 'Process ' .. pid .. ' was closed.') end,
|
||||
is_active = function(process) return process._is_active_indicator end,
|
||||
close = function(process)
|
||||
process._is_active_indicator = false
|
||||
table.insert(_G.process_log, 'Process ' .. pid .. ' was closed.')
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
@ -47,4 +52,7 @@ vim.loop.spawn = function(path, options, on_exit)
|
||||
return new_process(pid), pid
|
||||
end
|
||||
|
||||
vim.loop.process_kill = function(process) table.insert(_G.process_log, 'Process ' .. process.pid .. ' was killed.') end
|
||||
vim.loop.process_kill = function(process)
|
||||
process._is_active_indicator = false
|
||||
table.insert(_G.process_log, 'Process ' .. process.pid .. ' was killed.')
|
||||
end
|
||||
|
||||
@ -40,7 +40,6 @@ Helpers.new_child_neovim = function()
|
||||
local child = MiniTest.new_child_neovim()
|
||||
|
||||
local prevent_hanging = function(method)
|
||||
-- stylua: ignore
|
||||
if not child.is_blocked() then return end
|
||||
|
||||
local msg = string.format('Can not use `child.%s` because child process is blocked.', method)
|
||||
@ -157,6 +156,9 @@ Helpers.new_child_neovim = function()
|
||||
MiniTest.expect.reference_screenshot(child.get_screenshot(screenshot_opts), path, opts)
|
||||
end
|
||||
|
||||
-- Poke child's event loop to make it up to date
|
||||
child.poke_eventloop = function() child.api.nvim_eval('1') end
|
||||
|
||||
return child
|
||||
end
|
||||
|
||||
@ -170,7 +172,41 @@ end
|
||||
-- Detect CI
|
||||
Helpers.is_ci = function() return os.getenv('CI') ~= nil end
|
||||
Helpers.skip_in_ci = function(msg)
|
||||
if Helpers.is_ci() then MiniTest.skip(msg) end
|
||||
if Helpers.is_ci() then MiniTest.skip(msg or 'Does not test properly in CI') end
|
||||
end
|
||||
|
||||
-- Detect OS
|
||||
Helpers.is_windows = function() return vim.fn.has('win32') == 1 end
|
||||
Helpers.skip_on_windows = function(msg)
|
||||
if Helpers.is_windows() then MiniTest.skip(msg or 'Does not test properly on Windows') end
|
||||
end
|
||||
|
||||
Helpers.is_macos = function() return vim.fn.has('mac') == 1 end
|
||||
Helpers.skip_on_macos = function(msg)
|
||||
if Helpers.is_macos() then MiniTest.skip(msg or 'Does not test properly on MacOS') end
|
||||
end
|
||||
|
||||
-- Standardized way of dealing with time
|
||||
Helpers.is_slow = function() return Helpers.is_ci() and (Helpers.is_windows() or Helpers.is_macos()) end
|
||||
Helpers.skip_if_slow = function(msg)
|
||||
if Helpers.is_slow() then MiniTest.skip(msg or 'Does not test properly in slow context') end
|
||||
end
|
||||
|
||||
Helpers.get_time_const = function(delay)
|
||||
local coef = 1
|
||||
if Helpers.is_ci() then
|
||||
if Helpers.is_windows() then coef = 5 end
|
||||
if Helpers.is_macos() then coef = 15 end
|
||||
end
|
||||
return coef * delay
|
||||
end
|
||||
|
||||
Helpers.sleep = function(ms, child, skip_slow)
|
||||
if skip_slow then
|
||||
Helpers.skip_if_slow('Skip because state checks after sleep are hard to make robust in slow context')
|
||||
end
|
||||
vim.loop.sleep(math.max(ms, 1))
|
||||
if child ~= nil then child.poke_eventloop() end
|
||||
end
|
||||
|
||||
return Helpers
|
||||
|
||||
@ -0,0 +1,23 @@
|
||||
--|---------|---------|---------|---------|
|
||||
01|J
|
||||
02|January Text
|
||||
03|June Function
|
||||
04|July Function
|
||||
05|~
|
||||
06|~
|
||||
07|~
|
||||
08|~
|
||||
09|[No Name] [+] 1,2 All
|
||||
10|-- INSERT --
|
||||
|
||||
--|---------|---------|---------|---------|
|
||||
01|0000000000000000000000000000000000000000
|
||||
02|1111111122222222233333333333333333333333
|
||||
03|1111111144444444433333333333333333333333
|
||||
04|1111111111111111133333333333333333333333
|
||||
05|3333333333333333333333333333333333333333
|
||||
06|3333333333333333333333333333333333333333
|
||||
07|3333333333333333333333333333333333333333
|
||||
08|3333333333333333333333333333333333333333
|
||||
09|5555555555555555555555555555555555555555
|
||||
10|6666666666667777777777777777777777777777
|
||||
@ -1,33 +1,33 @@
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01| [No Name] m//confirm-clean X
|
||||
02|This is a confirmation report before a clean.
|
||||
03|
|
||||
04|Lines `- <plugin>` show plugins to be deleted from disk.
|
||||
05|Remove line to not delete that plugin.
|
||||
06|
|
||||
07|To finish clean, write this buffer (for example, with `:write` command).
|
||||
08|To cancel clean, close this window (for example, with `:close` command).
|
||||
09|
|
||||
10|- plugin_not_in_session_1
|
||||
11|- plugin_not_in_session_2
|
||||
01|This is a confirmation report before a clean.
|
||||
02|
|
||||
03|Lines `- <plugin>` show plugins to be deleted from disk.
|
||||
04|Remove line to not delete that plugin.
|
||||
05|
|
||||
06|To finish clean, write this buffer (for example, with `:write` command).
|
||||
07|To cancel clean, close this window (for example, with `:close` command).
|
||||
08|
|
||||
09|- plugin_not_in_session_1
|
||||
10|- plugin_not_in_session_2
|
||||
11|~
|
||||
12|~
|
||||
13|~
|
||||
14|~
|
||||
15|
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|00000000000111111111111111111000000000000000000000000000000000000000000000000000
|
||||
02|22222222222222222222222222222222222222222222233333333333333333333333333333333333
|
||||
03|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
04|22222222222222222222222222222222222222222222222222222222333333333333333333333333
|
||||
05|22222222222222222222222222222222222222333333333333333333333333333333333333333333
|
||||
06|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
07|22222222222222222222222222222222222222222222222222222222222222222222222233333333
|
||||
08|22222222222222222222222222222222222222222222222222222222222222222222222233333333
|
||||
09|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
10|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
11|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
12|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
13|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
14|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
15|55555555555555555555555555555555555555555555555555555555555555555555555555555555
|
||||
01|00000000000000000000000000000000000000000000011111111111111111111111111111111111
|
||||
02|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
03|00000000000000000000000000000000000000000000000000000000111111111111111111111111
|
||||
04|00000000000000000000000000000000000000111111111111111111111111111111111111111111
|
||||
05|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
06|00000000000000000000000000000000000000000000000000000000000000000000000011111111
|
||||
07|00000000000000000000000000000000000000000000000000000000000000000000000011111111
|
||||
08|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
09|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
10|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
11|22222222222222222222222222222222222222222222222222222222222222222222222222222222
|
||||
12|22222222222222222222222222222222222222222222222222222222222222222222222222222222
|
||||
13|22222222222222222222222222222222222222222222222222222222222222222222222222222222
|
||||
14|22222222222222222222222222222222222222222222222222222222222222222222222222222222
|
||||
15|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
|
||||
@ -1,33 +1,33 @@
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01| [No Name] m//confirm-clean X
|
||||
02|This is a confirmation report before a clean.
|
||||
03|
|
||||
04|Lines `- <plugin>` show plugins to be deleted from disk.
|
||||
05|Remove line to not delete that plugin.
|
||||
06|
|
||||
07|To finish clean, write this buffer (for example, with `:write` command).
|
||||
08|To cancel clean, close this window (for example, with `:close` command).
|
||||
09|
|
||||
10|- plugin_not_in_session_1 (MOCKDIR/pack/deps/opt/plugin_not_in_session_1)
|
||||
11|- plugin_not_in_session_2
|
||||
01|This is a confirmation report before a clean.
|
||||
02|
|
||||
03|Lines `- <plugin>` show plugins to be deleted from disk.
|
||||
04|Remove line to not delete that plugin.
|
||||
05|
|
||||
06|To finish clean, write this buffer (for example, with `:write` command).
|
||||
07|To cancel clean, close this window (for example, with `:close` command).
|
||||
08|
|
||||
09|- plugin_not_in_session_1 (MOCKDIR/pack/deps/opt/plugin_not_in_session_1)
|
||||
10|- plugin_not_in_session_2
|
||||
11|~
|
||||
12|~
|
||||
13|~
|
||||
14|~
|
||||
15|
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|00000000000111111111111111111000000000000000000000000000000000000000000000000000
|
||||
02|22222222222222222222222222222222222222222222233333333333333333333333333333333333
|
||||
03|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
04|22222222222222222222222222222222222222222222222222222222333333333333333333333333
|
||||
05|22222222222222222222222222222222222222333333333333333333333333333333333333333333
|
||||
06|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
07|22222222222222222222222222222222222222222222222222222222222222222222222233333333
|
||||
08|22222222222222222222222222222222222222222222222222222222222222222222222233333333
|
||||
09|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
10|33333333333333333333333334444444444444444444444444444444444444444444444443333333
|
||||
01|00000000000000000000000000000000000000000000011111111111111111111111111111111111
|
||||
02|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
03|00000000000000000000000000000000000000000000000000000000111111111111111111111111
|
||||
04|00000000000000000000000000000000000000111111111111111111111111111111111111111111
|
||||
05|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
06|00000000000000000000000000000000000000000000000000000000000000000000000011111111
|
||||
07|00000000000000000000000000000000000000000000000000000000000000000000000011111111
|
||||
08|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
09|11111111111111111111111112222222222222222222222222222222222222222222222221111111
|
||||
10|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
11|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
12|55555555555555555555555555555555555555555555555555555555555555555555555555555555
|
||||
13|55555555555555555555555555555555555555555555555555555555555555555555555555555555
|
||||
14|55555555555555555555555555555555555555555555555555555555555555555555555555555555
|
||||
15|66666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||
12|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
13|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
14|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
15|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
|
||||
@ -1,29 +1,29 @@
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01| [No Name] m//confirm-update X
|
||||
02|This is a confirmation report before an update.
|
||||
03|
|
||||
04|Line `+++ <plugin_name> +++` means plugin will be updated.
|
||||
05|See update details below it.
|
||||
06|Changes starting with ">"/"<" will be added/removed.
|
||||
07|Remove the line to not update that plugin.
|
||||
08|
|
||||
09|Line `--- <plugin_name> ---` means plugin has nothing to update.
|
||||
10|
|
||||
11|Line `!!! <plugin_name> !!!` means plugin had an error and won't be updated.
|
||||
12|See error details below it.
|
||||
13|
|
||||
14|Use regular fold keys (`zM`, `zR`, etc.) to manage shorter view.
|
||||
15|To finish update, write this buffer (for example, with `:write` command).
|
||||
16|To cancel update, close this window (for example, with `:close` command).
|
||||
17|
|
||||
18|!!! plugin_3 !!!
|
||||
19| >> ···········································································
|
||||
20|
|
||||
21|+++ plugin_2 +++
|
||||
22| >> Path: MOCKDIR/pack/deps/opt/plugin_2·······························
|
||||
23|
|
||||
24|--- plugin_1 ---
|
||||
25| >> Path: MOCKDIR/pack/deps/opt/plugin_1·····································
|
||||
01|This is a confirmation report before an update.
|
||||
02|
|
||||
03|Line `+++ <plugin_name> +++` means plugin will be updated.
|
||||
04|See update details below it.
|
||||
05|Changes starting with ">"/"<" will be added/removed.
|
||||
06|Remove the line to not update that plugin.
|
||||
07|
|
||||
08|Line `--- <plugin_name> ---` means plugin has nothing to update.
|
||||
09|
|
||||
10|Line `!!! <plugin_name> !!!` means plugin had an error and won't be updated.
|
||||
11|See error details below it.
|
||||
12|
|
||||
13|Use regular fold keys (`zM`, `zR`, etc.) to manage shorter view.
|
||||
14|To finish update, write this buffer (for example, with `:write` command).
|
||||
15|To cancel update, close this window (for example, with `:close` command).
|
||||
16|
|
||||
17|!!! plugin_3 !!!
|
||||
18| >> ···········································································
|
||||
19|
|
||||
20|+++ plugin_2 +++
|
||||
21| >> Path: MOCKDIR/pack/deps/opt/plugin_2·······························
|
||||
22|
|
||||
23|--- plugin_1 ---
|
||||
24| >> Path: MOCKDIR/pack/deps/opt/plugin_1·····································
|
||||
25|~
|
||||
26|~
|
||||
27|~
|
||||
28|~
|
||||
@ -31,33 +31,33 @@
|
||||
30|
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|00000000000111111111111111111100000000000000000000000000000000000000000000000000
|
||||
02|22222222222222222222222222222222222222222222222333333333333333333333333333333333
|
||||
03|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
04|22222222222222222222222222222222222222222222222222222222223333333333333333333333
|
||||
05|22222222222222222222222222223333333333333333333333333333333333333333333333333333
|
||||
06|22222222222222222222222222222222222222222222222222223333333333333333333333333333
|
||||
07|22222222222222222222222222222222222222222233333333333333333333333333333333333333
|
||||
08|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
09|22222222222222222222222222222222222222222222222222222222222222223333333333333333
|
||||
10|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
11|22222222222222222222222222222222222222222222222222222222222222222222222222223333
|
||||
12|22222222222222222222222222233333333333333333333333333333333333333333333333333333
|
||||
13|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
14|22222222222222222222222222222222222222222222222222222222222222223333333333333333
|
||||
15|22222222222222222222222222222222222222222222222222222222222222222222222223333333
|
||||
16|22222222222222222222222222222222222222222222222222222222222222222222222223333333
|
||||
17|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
18|44444444444444443333333333333333333333333333333333333333333333333333333333333333
|
||||
19|55555555555555555555555555555555555555555555555555555555555555555555555555555555
|
||||
20|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
21|66666666666666663333333333333333333333333333333333333333333333333333333333333333
|
||||
22|55555555555555555555555555555555555555555555555555555555555555555555555555555555
|
||||
23|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
24|77777777777777773333333333333333333333333333333333333333333333333333333333333333
|
||||
25|55555555555555555555555555555555555555555555555555555555555555555555555555555555
|
||||
26|88888888888888888888888888888888888888888888888888888888888888888888888888888888
|
||||
27|88888888888888888888888888888888888888888888888888888888888888888888888888888888
|
||||
28|88888888888888888888888888888888888888888888888888888888888888888888888888888888
|
||||
29|88888888888888888888888888888888888888888888888888888888888888888888888888888888
|
||||
30|99999999999999999999999999999999999999999999999999999999999999999999999999999999
|
||||
01|00000000000000000000000000000000000000000000000111111111111111111111111111111111
|
||||
02|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
03|00000000000000000000000000000000000000000000000000000000001111111111111111111111
|
||||
04|00000000000000000000000000001111111111111111111111111111111111111111111111111111
|
||||
05|00000000000000000000000000000000000000000000000000001111111111111111111111111111
|
||||
06|00000000000000000000000000000000000000000011111111111111111111111111111111111111
|
||||
07|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
08|00000000000000000000000000000000000000000000000000000000000000001111111111111111
|
||||
09|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
10|00000000000000000000000000000000000000000000000000000000000000000000000000001111
|
||||
11|00000000000000000000000000011111111111111111111111111111111111111111111111111111
|
||||
12|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
13|00000000000000000000000000000000000000000000000000000000000000001111111111111111
|
||||
14|00000000000000000000000000000000000000000000000000000000000000000000000001111111
|
||||
15|00000000000000000000000000000000000000000000000000000000000000000000000001111111
|
||||
16|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
17|22222222222222221111111111111111111111111111111111111111111111111111111111111111
|
||||
18|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
19|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
20|44444444444444441111111111111111111111111111111111111111111111111111111111111111
|
||||
21|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
22|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
23|55555555555555551111111111111111111111111111111111111111111111111111111111111111
|
||||
24|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
25|66666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||
26|66666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||
27|66666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||
28|66666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||
29|66666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||
30|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
|
||||
@ -1,69 +1,69 @@
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01| [No Name] m//confirm-update X
|
||||
02|This is a confirmation report before an update.
|
||||
03|
|
||||
04|Line `+++ <plugin_name> +++` means plugin will be updated.
|
||||
05|See update details below it.
|
||||
06|Changes starting with ">"/"<" will be added/removed.
|
||||
07|Remove the line to not update that plugin.
|
||||
08|
|
||||
09|Line `--- <plugin_name> ---` means plugin has nothing to update.
|
||||
10|
|
||||
11|Line `!!! <plugin_name> !!!` means plugin had an error and won't be updated.
|
||||
12|See error details below it.
|
||||
13|
|
||||
14|Use regular fold keys (`zM`, `zR`, etc.) to manage shorter view.
|
||||
15|To finish update, write this buffer (for example, with `:write` command).
|
||||
16|To cancel update, close this window (for example, with `:close` command).
|
||||
17|
|
||||
18|+++ plugin_1 +++
|
||||
19|Path: MOCKDIR/pack/deps/opt/plugin_1
|
||||
20|Source: https://github.com/user/plugin_1
|
||||
21|State before: sha1head
|
||||
22|State after: wow1head (main)
|
||||
23|
|
||||
24|Pending updates from `main`:
|
||||
25|< sha2head | 2024-01-02 01:01:01 +0200 | Neo McVim
|
||||
26| feat!: a breaking feature
|
||||
27|> new2head | 2024-01-02 02:02:02 +0200 | Neo McVim
|
||||
28| fix(deps)!: a breaking fix
|
||||
29|> wow2head | 2024-01-02 03:03:03 +0200 | Neo McVim
|
||||
30| fix: not a fix!: breaking change
|
||||
01|This is a confirmation report before an update.
|
||||
02|
|
||||
03|Line `+++ <plugin_name> +++` means plugin will be updated.
|
||||
04|See update details below it.
|
||||
05|Changes starting with ">"/"<" will be added/removed.
|
||||
06|Remove the line to not update that plugin.
|
||||
07|
|
||||
08|Line `--- <plugin_name> ---` means plugin has nothing to update.
|
||||
09|
|
||||
10|Line `!!! <plugin_name> !!!` means plugin had an error and won't be updated.
|
||||
11|See error details below it.
|
||||
12|
|
||||
13|Use regular fold keys (`zM`, `zR`, etc.) to manage shorter view.
|
||||
14|To finish update, write this buffer (for example, with `:write` command).
|
||||
15|To cancel update, close this window (for example, with `:close` command).
|
||||
16|
|
||||
17|+++ plugin_1 +++
|
||||
18|Path: MOCKDIR/pack/deps/opt/plugin_1
|
||||
19|Source: https://github.com/user/plugin_1
|
||||
20|State before: sha1head
|
||||
21|State after: wow1head (main)
|
||||
22|
|
||||
23|Pending updates from `main`:
|
||||
24|< sha2head | 2024-01-02 01:01:01 +0200 | Neo McVim
|
||||
25| feat!: a breaking feature
|
||||
26|> new2head | 2024-01-02 02:02:02 +0200 | Neo McVim
|
||||
27| fix(deps)!: a breaking fix
|
||||
28|> wow2head | 2024-01-02 03:03:03 +0200 | Neo McVim
|
||||
29| fix: not a fix!: breaking change
|
||||
30|~
|
||||
31|~
|
||||
32|~
|
||||
33|
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|00000000000111111111111111111100000000000000000000000000000000000000000000000000
|
||||
02|22222222222222222222222222222222222222222222222333333333333333333333333333333333
|
||||
03|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
04|22222222222222222222222222222222222222222222222222222222223333333333333333333333
|
||||
05|22222222222222222222222222223333333333333333333333333333333333333333333333333333
|
||||
06|22222222222222222222222222222222222222222222222222223333333333333333333333333333
|
||||
07|22222222222222222222222222222222222222222233333333333333333333333333333333333333
|
||||
08|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
09|22222222222222222222222222222222222222222222222222222222222222223333333333333333
|
||||
10|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
11|22222222222222222222222222222222222222222222222222222222222222222222222222223333
|
||||
12|22222222222222222222222222233333333333333333333333333333333333333333333333333333
|
||||
13|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
14|22222222222222222222222222222222222222222222222222222222222222223333333333333333
|
||||
15|22222222222222222222222222222222222222222222222222222222222222222222222223333333
|
||||
16|22222222222222222222222222222222222222222222222222222222222222222222222223333333
|
||||
17|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
18|44444444444444443333333333333333333333333333333333333333333333333333333333333333
|
||||
19|33333333333333555555555555555555555555555555333333333333333333333333333333333333
|
||||
20|33333333333333555555555555555555555555555555553333333333333333333333333333333333
|
||||
21|33333333333333555555553333333333333333333333333333333333333333333333333333333333
|
||||
22|33333333333333555555553222222333333333333333333333333333333333333333333333333333
|
||||
23|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
24|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
25|66666666666666666666666666666666666666666666666666333333333333333333333333333333
|
||||
26|77777777777777777777777777733333333333333333333333333333333333333333333333333333
|
||||
27|88888888888888888888888888888888888888888888888888333333333333333333333333333333
|
||||
28|77777777777777777777777777773333333333333333333333333333333333333333333333333333
|
||||
29|88888888888888888888888888888888888888888888888888333333333333333333333333333333
|
||||
30|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
31|99999999999999999999999999999999999999999999999999999999999999999999999999999999
|
||||
32|99999999999999999999999999999999999999999999999999999999999999999999999999999999
|
||||
33|::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
01|00000000000000000000000000000000000000000000000111111111111111111111111111111111
|
||||
02|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
03|00000000000000000000000000000000000000000000000000000000001111111111111111111111
|
||||
04|00000000000000000000000000001111111111111111111111111111111111111111111111111111
|
||||
05|00000000000000000000000000000000000000000000000000001111111111111111111111111111
|
||||
06|00000000000000000000000000000000000000000011111111111111111111111111111111111111
|
||||
07|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
08|00000000000000000000000000000000000000000000000000000000000000001111111111111111
|
||||
09|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
10|00000000000000000000000000000000000000000000000000000000000000000000000000001111
|
||||
11|00000000000000000000000000011111111111111111111111111111111111111111111111111111
|
||||
12|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
13|00000000000000000000000000000000000000000000000000000000000000001111111111111111
|
||||
14|00000000000000000000000000000000000000000000000000000000000000000000000001111111
|
||||
15|00000000000000000000000000000000000000000000000000000000000000000000000001111111
|
||||
16|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
17|22222222222222221111111111111111111111111111111111111111111111111111111111111111
|
||||
18|11111111111111333333333333333333333333333333111111111111111111111111111111111111
|
||||
19|11111111111111333333333333333333333333333333331111111111111111111111111111111111
|
||||
20|11111111111111333333331111111111111111111111111111111111111111111111111111111111
|
||||
21|11111111111111333333331000000111111111111111111111111111111111111111111111111111
|
||||
22|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
23|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
24|44444444444444444444444444444444444444444444444444111111111111111111111111111111
|
||||
25|55555555555555555555555555511111111111111111111111111111111111111111111111111111
|
||||
26|66666666666666666666666666666666666666666666666666111111111111111111111111111111
|
||||
27|55555555555555555555555555551111111111111111111111111111111111111111111111111111
|
||||
28|66666666666666666666666666666666666666666666666666111111111111111111111111111111
|
||||
29|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
30|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
31|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
32|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
33|88888888888888888888888888888888888888888888888888888888888888888888888888888888
|
||||
|
||||
@ -1,67 +1,67 @@
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01| [No Name] m//confirm-update X
|
||||
02|This is a confirmation report before an update.
|
||||
03|
|
||||
04|Line `+++ <plugin_name> +++` means plugin will be updated.
|
||||
05|See update details below it.
|
||||
06|Changes starting with ">"/"<" will be added/removed.
|
||||
07|Remove the line to not update that plugin.
|
||||
08|
|
||||
09|Line `--- <plugin_name> ---` means plugin has nothing to update.
|
||||
10|
|
||||
11|Line `!!! <plugin_name> !!!` means plugin had an error and won't be updated.
|
||||
12|See error details below it.
|
||||
13|
|
||||
14|Use regular fold keys (`zM`, `zR`, etc.) to manage shorter view.
|
||||
15|To finish update, write this buffer (for example, with `:write` command).
|
||||
16|To cancel update, close this window (for example, with `:close` command).
|
||||
17|
|
||||
18|+++ plugin_1 +++
|
||||
19|Path: MOCKDIR/pack/deps/opt/plugin_1
|
||||
20|Source: https://github.com/user/plugin_1
|
||||
21|State before: sha1head
|
||||
22|State after: new1head (hello)
|
||||
23|
|
||||
24|Pending updates from `hello`:
|
||||
25|> new1head | 2024-01-02 01:01:01 +0200 | Neo McVim
|
||||
26| Added commit in checkout.
|
||||
27|
|
||||
28|Monitor updates from `world`:
|
||||
29|> new2head | 2024-01-02 02:02:02 +0200 | Neo McVim
|
||||
30| Added commit in monitor.
|
||||
01|This is a confirmation report before an update.
|
||||
02|
|
||||
03|Line `+++ <plugin_name> +++` means plugin will be updated.
|
||||
04|See update details below it.
|
||||
05|Changes starting with ">"/"<" will be added/removed.
|
||||
06|Remove the line to not update that plugin.
|
||||
07|
|
||||
08|Line `--- <plugin_name> ---` means plugin has nothing to update.
|
||||
09|
|
||||
10|Line `!!! <plugin_name> !!!` means plugin had an error and won't be updated.
|
||||
11|See error details below it.
|
||||
12|
|
||||
13|Use regular fold keys (`zM`, `zR`, etc.) to manage shorter view.
|
||||
14|To finish update, write this buffer (for example, with `:write` command).
|
||||
15|To cancel update, close this window (for example, with `:close` command).
|
||||
16|
|
||||
17|+++ plugin_1 +++
|
||||
18|Path: MOCKDIR/pack/deps/opt/plugin_1
|
||||
19|Source: https://github.com/user/plugin_1
|
||||
20|State before: sha1head
|
||||
21|State after: new1head (hello)
|
||||
22|
|
||||
23|Pending updates from `hello`:
|
||||
24|> new1head | 2024-01-02 01:01:01 +0200 | Neo McVim
|
||||
25| Added commit in checkout.
|
||||
26|
|
||||
27|Monitor updates from `world`:
|
||||
28|> new2head | 2024-01-02 02:02:02 +0200 | Neo McVim
|
||||
29| Added commit in monitor.
|
||||
30|~
|
||||
31|~
|
||||
32|
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|00000000000111111111111111111100000000000000000000000000000000000000000000000000
|
||||
02|22222222222222222222222222222222222222222222222333333333333333333333333333333333
|
||||
03|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
04|22222222222222222222222222222222222222222222222222222222223333333333333333333333
|
||||
05|22222222222222222222222222223333333333333333333333333333333333333333333333333333
|
||||
06|22222222222222222222222222222222222222222222222222223333333333333333333333333333
|
||||
07|22222222222222222222222222222222222222222233333333333333333333333333333333333333
|
||||
08|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
09|22222222222222222222222222222222222222222222222222222222222222223333333333333333
|
||||
10|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
11|22222222222222222222222222222222222222222222222222222222222222222222222222223333
|
||||
12|22222222222222222222222222233333333333333333333333333333333333333333333333333333
|
||||
13|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
14|22222222222222222222222222222222222222222222222222222222222222223333333333333333
|
||||
15|22222222222222222222222222222222222222222222222222222222222222222222222223333333
|
||||
16|22222222222222222222222222222222222222222222222222222222222222222222222223333333
|
||||
17|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
18|44444444444444443333333333333333333333333333333333333333333333333333333333333333
|
||||
19|33333333333333555555555555555555555555555555333333333333333333333333333333333333
|
||||
20|33333333333333555555555555555555555555555555553333333333333333333333333333333333
|
||||
21|33333333333333555555553333333333333333333333333333333333333333333333333333333333
|
||||
22|33333333333333555555553222222233333333333333333333333333333333333333333333333333
|
||||
23|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
24|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
25|66666666666666666666666666666666666666666666666666333333333333333333333333333333
|
||||
26|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
27|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
28|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
29|66666666666666666666666666666666666666666666666666333333333333333333333333333333
|
||||
30|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
31|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
32|88888888888888888888888888888888888888888888888888888888888888888888888888888888
|
||||
01|00000000000000000000000000000000000000000000000111111111111111111111111111111111
|
||||
02|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
03|00000000000000000000000000000000000000000000000000000000001111111111111111111111
|
||||
04|00000000000000000000000000001111111111111111111111111111111111111111111111111111
|
||||
05|00000000000000000000000000000000000000000000000000001111111111111111111111111111
|
||||
06|00000000000000000000000000000000000000000011111111111111111111111111111111111111
|
||||
07|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
08|00000000000000000000000000000000000000000000000000000000000000001111111111111111
|
||||
09|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
10|00000000000000000000000000000000000000000000000000000000000000000000000000001111
|
||||
11|00000000000000000000000000011111111111111111111111111111111111111111111111111111
|
||||
12|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
13|00000000000000000000000000000000000000000000000000000000000000001111111111111111
|
||||
14|00000000000000000000000000000000000000000000000000000000000000000000000001111111
|
||||
15|00000000000000000000000000000000000000000000000000000000000000000000000001111111
|
||||
16|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
17|22222222222222221111111111111111111111111111111111111111111111111111111111111111
|
||||
18|11111111111111333333333333333333333333333333111111111111111111111111111111111111
|
||||
19|11111111111111333333333333333333333333333333331111111111111111111111111111111111
|
||||
20|11111111111111333333331111111111111111111111111111111111111111111111111111111111
|
||||
21|11111111111111333333331000000011111111111111111111111111111111111111111111111111
|
||||
22|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
23|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
24|44444444444444444444444444444444444444444444444444111111111111111111111111111111
|
||||
25|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
26|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
27|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
28|44444444444444444444444444444444444444444444444444111111111111111111111111111111
|
||||
29|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
30|55555555555555555555555555555555555555555555555555555555555555555555555555555555
|
||||
31|55555555555555555555555555555555555555555555555555555555555555555555555555555555
|
||||
32|66666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||
|
||||
@ -1,57 +1,57 @@
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01| [No Name] m//confirm-update X
|
||||
02|This is a confirmation report before an update.
|
||||
03|
|
||||
04|Line `+++ <plugin_name> +++` means plugin will be updated.
|
||||
05|See update details below it.
|
||||
06|Changes starting with ">"/"<" will be added/removed.
|
||||
07|Remove the line to not update that plugin.
|
||||
08|
|
||||
09|Line `--- <plugin_name> ---` means plugin has nothing to update.
|
||||
10|
|
||||
11|Line `!!! <plugin_name> !!!` means plugin had an error and won't be updated.
|
||||
12|See error details below it.
|
||||
13|
|
||||
14|Use regular fold keys (`zM`, `zR`, etc.) to manage shorter view.
|
||||
15|To finish update, write this buffer (for example, with `:write` command).
|
||||
16|To cancel update, close this window (for example, with `:close` command).
|
||||
17|
|
||||
18|--- plugin_1 ---
|
||||
19|Path: MOCKDIR/pack/deps/opt/plugin_1
|
||||
20|Source: https://github.com/user/plugin_1
|
||||
21|State: sha1head (hello)
|
||||
22|
|
||||
23|Monitor updates from `world`:
|
||||
24|<Nothing>
|
||||
01|This is a confirmation report before an update.
|
||||
02|
|
||||
03|Line `+++ <plugin_name> +++` means plugin will be updated.
|
||||
04|See update details below it.
|
||||
05|Changes starting with ">"/"<" will be added/removed.
|
||||
06|Remove the line to not update that plugin.
|
||||
07|
|
||||
08|Line `--- <plugin_name> ---` means plugin has nothing to update.
|
||||
09|
|
||||
10|Line `!!! <plugin_name> !!!` means plugin had an error and won't be updated.
|
||||
11|See error details below it.
|
||||
12|
|
||||
13|Use regular fold keys (`zM`, `zR`, etc.) to manage shorter view.
|
||||
14|To finish update, write this buffer (for example, with `:write` command).
|
||||
15|To cancel update, close this window (for example, with `:close` command).
|
||||
16|
|
||||
17|--- plugin_1 ---
|
||||
18|Path: MOCKDIR/pack/deps/opt/plugin_1
|
||||
19|Source: https://github.com/user/plugin_1
|
||||
20|State: sha1head (hello)
|
||||
21|
|
||||
22|Monitor updates from `world`:
|
||||
23|<Nothing>
|
||||
24|~
|
||||
25|~
|
||||
26|~
|
||||
27|
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|00000000000111111111111111111100000000000000000000000000000000000000000000000000
|
||||
02|22222222222222222222222222222222222222222222222333333333333333333333333333333333
|
||||
03|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
04|22222222222222222222222222222222222222222222222222222222223333333333333333333333
|
||||
05|22222222222222222222222222223333333333333333333333333333333333333333333333333333
|
||||
06|22222222222222222222222222222222222222222222222222223333333333333333333333333333
|
||||
07|22222222222222222222222222222222222222222233333333333333333333333333333333333333
|
||||
08|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
09|22222222222222222222222222222222222222222222222222222222222222223333333333333333
|
||||
10|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
11|22222222222222222222222222222222222222222222222222222222222222222222222222223333
|
||||
12|22222222222222222222222222233333333333333333333333333333333333333333333333333333
|
||||
13|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
14|22222222222222222222222222222222222222222222222222222222222222223333333333333333
|
||||
15|22222222222222222222222222222222222222222222222222222222222222222222222223333333
|
||||
16|22222222222222222222222222222222222222222222222222222222222222222222222223333333
|
||||
17|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
18|44444444444444443333333333333333333333333333333333333333333333333333333333333333
|
||||
19|33333333555555555555555555555555555555333333333333333333333333333333333333333333
|
||||
20|33333333555555555555555555555555555555553333333333333333333333333333333333333333
|
||||
21|33333333555555553222222233333333333333333333333333333333333333333333333333333333
|
||||
22|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
23|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
24|66666666633333333333333333333333333333333333333333333333333333333333333333333333
|
||||
25|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
26|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
27|88888888888888888888888888888888888888888888888888888888888888888888888888888888
|
||||
01|00000000000000000000000000000000000000000000000111111111111111111111111111111111
|
||||
02|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
03|00000000000000000000000000000000000000000000000000000000001111111111111111111111
|
||||
04|00000000000000000000000000001111111111111111111111111111111111111111111111111111
|
||||
05|00000000000000000000000000000000000000000000000000001111111111111111111111111111
|
||||
06|00000000000000000000000000000000000000000011111111111111111111111111111111111111
|
||||
07|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
08|00000000000000000000000000000000000000000000000000000000000000001111111111111111
|
||||
09|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
10|00000000000000000000000000000000000000000000000000000000000000000000000000001111
|
||||
11|00000000000000000000000000011111111111111111111111111111111111111111111111111111
|
||||
12|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
13|00000000000000000000000000000000000000000000000000000000000000001111111111111111
|
||||
14|00000000000000000000000000000000000000000000000000000000000000000000000001111111
|
||||
15|00000000000000000000000000000000000000000000000000000000000000000000000001111111
|
||||
16|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
17|22222222222222221111111111111111111111111111111111111111111111111111111111111111
|
||||
18|11111111333333333333333333333333333333111111111111111111111111111111111111111111
|
||||
19|11111111333333333333333333333333333333331111111111111111111111111111111111111111
|
||||
20|11111111333333331000000011111111111111111111111111111111111111111111111111111111
|
||||
21|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
22|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
23|44444444411111111111111111111111111111111111111111111111111111111111111111111111
|
||||
24|55555555555555555555555555555555555555555555555555555555555555555555555555555555
|
||||
25|55555555555555555555555555555555555555555555555555555555555555555555555555555555
|
||||
26|55555555555555555555555555555555555555555555555555555555555555555555555555555555
|
||||
27|66666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||
|
||||
@ -1,83 +1,83 @@
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01| [No Name] m//confirm-update X
|
||||
02|This is a confirmation report before an update.
|
||||
03|
|
||||
04|Line `+++ <plugin_name> +++` means plugin will be updated.
|
||||
05|See update details below it.
|
||||
06|Changes starting with ">"/"<" will be added/removed.
|
||||
07|Remove the line to not update that plugin.
|
||||
08|
|
||||
09|Line `--- <plugin_name> ---` means plugin has nothing to update.
|
||||
10|
|
||||
11|Line `!!! <plugin_name> !!!` means plugin had an error and won't be updated.
|
||||
12|See error details below it.
|
||||
13|
|
||||
14|Use regular fold keys (`zM`, `zR`, etc.) to manage shorter view.
|
||||
15|To finish update, write this buffer (for example, with `:write` command).
|
||||
16|To cancel update, close this window (for example, with `:close` command).
|
||||
17|
|
||||
18|!!! plugin_3 !!!
|
||||
19|
|
||||
20|ERROR CODE 1
|
||||
21|Error computing origin
|
||||
22|
|
||||
23|+++ plugin_2 +++
|
||||
24|Path: MOCKDIR/pack/deps/opt/plugin_2
|
||||
25|Source: https://new_source/plugin_2
|
||||
26|State before: sha2head
|
||||
27|State after: new2head (master)
|
||||
28|
|
||||
29|Pending updates from `master`:
|
||||
30|< sha2head | 2024-01-02 01:01:01 +0200 | Neo McVim
|
||||
31| Removed commit in plugin_2.
|
||||
32|> new2head | 2024-01-02 02:02:02 +0200 | Neo McVim
|
||||
33| Added commit in plugin_2.
|
||||
34|
|
||||
35|--- plugin_1 ---
|
||||
36|Path: MOCKDIR/pack/deps/opt/plugin_1
|
||||
37|Source: https://github.com/user/plugin_1
|
||||
38|State: sha1head (main)
|
||||
01|This is a confirmation report before an update.
|
||||
02|
|
||||
03|Line `+++ <plugin_name> +++` means plugin will be updated.
|
||||
04|See update details below it.
|
||||
05|Changes starting with ">"/"<" will be added/removed.
|
||||
06|Remove the line to not update that plugin.
|
||||
07|
|
||||
08|Line `--- <plugin_name> ---` means plugin has nothing to update.
|
||||
09|
|
||||
10|Line `!!! <plugin_name> !!!` means plugin had an error and won't be updated.
|
||||
11|See error details below it.
|
||||
12|
|
||||
13|Use regular fold keys (`zM`, `zR`, etc.) to manage shorter view.
|
||||
14|To finish update, write this buffer (for example, with `:write` command).
|
||||
15|To cancel update, close this window (for example, with `:close` command).
|
||||
16|
|
||||
17|!!! plugin_3 !!!
|
||||
18|
|
||||
19|ERROR CODE 1
|
||||
20|Error computing origin
|
||||
21|
|
||||
22|+++ plugin_2 +++
|
||||
23|Path: MOCKDIR/pack/deps/opt/plugin_2
|
||||
24|Source: https://new_source/plugin_2
|
||||
25|State before: sha2head
|
||||
26|State after: new2head (master)
|
||||
27|
|
||||
28|Pending updates from `master`:
|
||||
29|< sha2head | 2024-01-02 01:01:01 +0200 | Neo McVim
|
||||
30| Removed commit in plugin_2.
|
||||
31|> new2head | 2024-01-02 02:02:02 +0200 | Neo McVim
|
||||
32| Added commit in plugin_2.
|
||||
33|
|
||||
34|--- plugin_1 ---
|
||||
35|Path: MOCKDIR/pack/deps/opt/plugin_1
|
||||
36|Source: https://github.com/user/plugin_1
|
||||
37|State: sha1head (main)
|
||||
38|~
|
||||
39|~
|
||||
40|
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|00000000000111111111111111111100000000000000000000000000000000000000000000000000
|
||||
02|22222222222222222222222222222222222222222222222333333333333333333333333333333333
|
||||
03|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
04|22222222222222222222222222222222222222222222222222222222223333333333333333333333
|
||||
05|22222222222222222222222222223333333333333333333333333333333333333333333333333333
|
||||
06|22222222222222222222222222222222222222222222222222223333333333333333333333333333
|
||||
07|22222222222222222222222222222222222222222233333333333333333333333333333333333333
|
||||
08|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
09|22222222222222222222222222222222222222222222222222222222222222223333333333333333
|
||||
10|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
11|22222222222222222222222222222222222222222222222222222222222222222222222222223333
|
||||
12|22222222222222222222222222233333333333333333333333333333333333333333333333333333
|
||||
13|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
14|22222222222222222222222222222222222222222222222222222222222222223333333333333333
|
||||
15|22222222222222222222222222222222222222222222222222222222222222222222222223333333
|
||||
16|22222222222222222222222222222222222222222222222222222222222222222222222223333333
|
||||
17|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
18|44444444444444443333333333333333333333333333333333333333333333333333333333333333
|
||||
19|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
20|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
21|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
22|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
23|55555555555555553333333333333333333333333333333333333333333333333333333333333333
|
||||
24|33333333333333666666666666666666666666666666333333333333333333333333333333333333
|
||||
25|33333333333333666666666666666666666666666333333333333333333333333333333333333333
|
||||
26|33333333333333666666663333333333333333333333333333333333333333333333333333333333
|
||||
27|33333333333333666666663222222223333333333333333333333333333333333333333333333333
|
||||
28|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
29|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
30|77777777777777777777777777777777777777777777777777333333333333333333333333333333
|
||||
31|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
32|88888888888888888888888888888888888888888888888888333333333333333333333333333333
|
||||
33|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
34|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
35|99999999999999993333333333333333333333333333333333333333333333333333333333333333
|
||||
36|33333333666666666666666666666666666666333333333333333333333333333333333333333333
|
||||
37|33333333666666666666666666666666666666663333333333333333333333333333333333333333
|
||||
38|33333333666666663222222333333333333333333333333333333333333333333333333333333333
|
||||
39|::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
40|;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
01|00000000000000000000000000000000000000000000000111111111111111111111111111111111
|
||||
02|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
03|00000000000000000000000000000000000000000000000000000000001111111111111111111111
|
||||
04|00000000000000000000000000001111111111111111111111111111111111111111111111111111
|
||||
05|00000000000000000000000000000000000000000000000000001111111111111111111111111111
|
||||
06|00000000000000000000000000000000000000000011111111111111111111111111111111111111
|
||||
07|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
08|00000000000000000000000000000000000000000000000000000000000000001111111111111111
|
||||
09|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
10|00000000000000000000000000000000000000000000000000000000000000000000000000001111
|
||||
11|00000000000000000000000000011111111111111111111111111111111111111111111111111111
|
||||
12|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
13|00000000000000000000000000000000000000000000000000000000000000001111111111111111
|
||||
14|00000000000000000000000000000000000000000000000000000000000000000000000001111111
|
||||
15|00000000000000000000000000000000000000000000000000000000000000000000000001111111
|
||||
16|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
17|22222222222222221111111111111111111111111111111111111111111111111111111111111111
|
||||
18|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
19|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
20|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
21|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
22|33333333333333331111111111111111111111111111111111111111111111111111111111111111
|
||||
23|11111111111111444444444444444444444444444444111111111111111111111111111111111111
|
||||
24|11111111111111444444444444444444444444444111111111111111111111111111111111111111
|
||||
25|11111111111111444444441111111111111111111111111111111111111111111111111111111111
|
||||
26|11111111111111444444441000000001111111111111111111111111111111111111111111111111
|
||||
27|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
28|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
29|55555555555555555555555555555555555555555555555555111111111111111111111111111111
|
||||
30|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
31|66666666666666666666666666666666666666666666666666111111111111111111111111111111
|
||||
32|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
33|11111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
34|77777777777777771111111111111111111111111111111111111111111111111111111111111111
|
||||
35|11111111444444444444444444444444444444111111111111111111111111111111111111111111
|
||||
36|11111111444444444444444444444444444444441111111111111111111111111111111111111111
|
||||
37|11111111444444441000000111111111111111111111111111111111111111111111111111111111
|
||||
38|88888888888888888888888888888888888888888888888888888888888888888888888888888888
|
||||
39|88888888888888888888888888888888888888888888888888888888888888888888888888888888
|
||||
40|99999999999999999999999999999999999999999999999999999999999999999999999999999999
|
||||
|
||||
@ -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|│[ Number] a │
|
||||
07|│[ Object] t │
|
||||
08|│[ Variable] x │
|
||||
09|│[ Variable] y │
|
||||
10|│ │
|
||||
11|│ │
|
||||
12|│ │
|
||||
13|│ │
|
||||
14|└ LSP (document_symbol) ───────────────────────── 1|4|4 ┘
|
||||
15|
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|000001111121111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
02|000001111131111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
03|114111333356665151255111111111111111111111111111111111111111111111111111111111111111111111
|
||||
04|114111333356665151255111111111111111111111111111111111111111111111111111111111111111111111
|
||||
05|788877777777777777777777777777777777777777777777777777777111111111111111111111111111111111
|
||||
06|7999999999999:::::::::::::::::::::::::::::::::::::::::::7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
07|7<<<<<<<<<<<<===========================================7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
08|7>>>>>>>>>>>>>>=========================================7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
09|7>>>>>>>>>>>>>>=========================================7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
10|7???????????????????????????????????????????????????????7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
11|7???????????????????????????????????????????????????????7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
12|7???????????????????????????????????????????????????????7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
13|7???????????????????????????????????????????????????????7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
14|7@@@@@@@@@@@@@@@@@@@@@@@7777777777777777777777777@@@@@@@7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
15|111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
@ -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|│[Number ] a │
|
||||
07|│[Object ] t │
|
||||
08|│[Variable ] x │
|
||||
09|│[Variable ] y │
|
||||
10|│ │
|
||||
11|│ │
|
||||
12|│ │
|
||||
13|│ │
|
||||
14|└ LSP (document_symbol) ───────────────────────── 1|4|4 ┘
|
||||
15|
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|000001111121111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
02|000001111131111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
03|114111333356665151255111111111111111111111111111111111111111111111111111111111111111111111
|
||||
04|114111333356665151255111111111111111111111111111111111111111111111111111111111111111111111
|
||||
05|788877777777777777777777777777777777777777777777777777777111111111111111111111111111111111
|
||||
06|7999999999999:::::::::::::::::::::::::::::::::::::::::::7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
07|7<<<<<<<<<<<<===========================================7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
08|7>>>>>>>>>>>>>>=========================================7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
09|7>>>>>>>>>>>>>>=========================================7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
10|7???????????????????????????????????????????????????????7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
11|7???????????????????????????????????????????????????????7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
12|7???????????????????????????????????????????????????????7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
13|7???????????????????????????????????????????????????????7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
14|7@@@@@@@@@@@@@@@@@@@@@@@7777777777777777777777777@@@@@@@7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
15|111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
@ -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|│[] a │
|
||||
07|│[] t │
|
||||
08|│[] x │
|
||||
09|│[] y │
|
||||
10|│ │
|
||||
11|│ │
|
||||
12|│ │
|
||||
13|│ │
|
||||
14|└ LSP (document_symbol) ───────────────────────── 1|4|4 ┘
|
||||
15|
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|000001111121111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
02|000001111131111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
03|114111333356665151255111111111111111111111111111111111111111111111111111111111111111111111
|
||||
04|114111333356665151255111111111111111111111111111111111111111111111111111111111111111111111
|
||||
05|788877777777777777777777777777777777777777777777777777777111111111111111111111111111111111
|
||||
06|799999::::::::::::::::::::::::::::::::::::::::::::::::::7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
07|7<<<<<==================================================7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
08|7>>>>>==================================================7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
09|7>>>>>==================================================7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
10|7???????????????????????????????????????????????????????7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
11|7???????????????????????????????????????????????????????7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
12|7???????????????????????????????????????????????????????7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
13|7???????????????????????????????????????????????????????7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
14|7@@@@@@@@@@@@@@@@@@@@@@@7777777777777777777777777@@@@@@@7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
15|111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
@ -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|│tests/dir-extra/real-files/a.lua│1│7│ [ Number] a │
|
||||
07|│tests/dir-extra/real-files/a.lua│2│7│ [ Object] t │
|
||||
08|│tests/dir-extra/real-files/a.lua│3│3│ [ Variable] x │
|
||||
09|│tests/dir-extra/real-files/a.lua│4│3│ [ Variable] y │
|
||||
10|│ │
|
||||
11|│ │
|
||||
12|│ │
|
||||
13|│ │
|
||||
14|└ LSP (workspace_symbol) ──────────────────────── 1|4|4 ┘
|
||||
15|
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|000001111121111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
02|000001111131111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
03|114111333356665151255111111111111111111111111111111111111111111111111111111111111111111111
|
||||
04|114111333356665151255111111111111111111111111111111111111111111111111111111111111111111111
|
||||
05|788877777777777777777777777777777777777777777777777777777111111111111111111111111111111111
|
||||
06|799999999999999999999999999999999999999999999999999:::::7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
07|7<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<=====7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
08|7>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>===7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
09|7>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>===7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
10|7???????????????????????????????????????????????????????7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
11|7???????????????????????????????????????????????????????7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
12|7???????????????????????????????????????????????????????7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
13|7???????????????????????????????????????????????????????7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
14|7@@@@@@@@@@@@@@@@@@@@@@@@777777777777777777777777@@@@@@@7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
15|111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
@ -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|│tests/dir-extra/real-files/a.lua│1│7│ [Number ] a │
|
||||
07|│tests/dir-extra/real-files/a.lua│2│7│ [Object ] t │
|
||||
08|│tests/dir-extra/real-files/a.lua│3│3│ [Variable ] x │
|
||||
09|│tests/dir-extra/real-files/a.lua│4│3│ [Variable ] y │
|
||||
10|│ │
|
||||
11|│ │
|
||||
12|│ │
|
||||
13|│ │
|
||||
14|└ LSP (workspace_symbol) ──────────────────────── 1|4|4 ┘
|
||||
15|
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|000001111121111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
02|000001111131111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
03|114111333356665151255111111111111111111111111111111111111111111111111111111111111111111111
|
||||
04|114111333356665151255111111111111111111111111111111111111111111111111111111111111111111111
|
||||
05|788877777777777777777777777777777777777777777777777777777111111111111111111111111111111111
|
||||
06|799999999999999999999999999999999999999999999999999:::::7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
07|7<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<=====7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
08|7>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>===7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
09|7>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>===7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
10|7???????????????????????????????????????????????????????7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
11|7???????????????????????????????????????????????????????7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
12|7???????????????????????????????????????????????????????7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
13|7???????????????????????????????????????????????????????7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
14|7@@@@@@@@@@@@@@@@@@@@@@@@777777777777777777777777@@@@@@@7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
15|111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
@ -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|│tests/dir-extra/real-files/a.lua│1│7│ [] a │
|
||||
07|│tests/dir-extra/real-files/a.lua│2│7│ [] t │
|
||||
08|│tests/dir-extra/real-files/a.lua│3│3│ [] x │
|
||||
09|│tests/dir-extra/real-files/a.lua│4│3│ [] y │
|
||||
10|│ │
|
||||
11|│ │
|
||||
12|│ │
|
||||
13|│ │
|
||||
14|└ LSP (workspace_symbol) ──────────────────────── 1|4|4 ┘
|
||||
15|
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|000001111121111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
02|000001111131111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
03|114111333356665151255111111111111111111111111111111111111111111111111111111111111111111111
|
||||
04|114111333356665151255111111111111111111111111111111111111111111111111111111111111111111111
|
||||
05|788877777777777777777777777777777777777777777777777777777111111111111111111111111111111111
|
||||
06|79999999999999999999999999999999999999999999::::::::::::7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
07|7<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<============7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
08|7>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>============7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
09|7>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>============7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
10|7???????????????????????????????????????????????????????7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
11|7???????????????????????????????????????????????????????7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
12|7???????????????????????????????????????????????????????7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
13|7???????????????????????????????????????????????????????7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
14|7@@@@@@@@@@@@@@@@@@@@@@@@777777777777777777777777@@@@@@@7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
15|111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
|
||||
@ -0,0 +1,33 @@
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|┌ …es/commo┐┌ .a-dir ────────────────────────────────┐┌ aa-file ───────────┐
|
||||
02|│ .a-dir ││ aa-file ││ │
|
||||
03|│ a-dir ││ ab-file ││ │
|
||||
04|│ b-dir ││ ││ │
|
||||
05|│ .a-file ││ ││ │
|
||||
06|│ a-file ││ ││ │
|
||||
07|└──────────┘└────────────────────────────────────────┘└────────────────────┘
|
||||
08|~
|
||||
09|~
|
||||
10|~
|
||||
11|~
|
||||
12|~
|
||||
13|~
|
||||
14|~
|
||||
15| 1,9-7 All
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|01222222222001333333100000000000000000000000000000000001222222210000000000004444
|
||||
02|05555555566006666666666666666666666666666666666666666006666666666666666666607777
|
||||
03|08888888111001111111111111111111111111111111111111111009999999999999999999907777
|
||||
04|08888888111009999999999999999999999999999999999999999009999999999999999999907777
|
||||
05|01111111111009999999999999999999999999999999999999999009999999999999999999907777
|
||||
06|01111111111009999999999999999999999999999999999999999009999999999999999999907777
|
||||
07|00000000000000000000000000000000000000000000000000000000000000000000000000007777
|
||||
08|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
09|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
10|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
11|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
12|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
13|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
14|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
15|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
@ -0,0 +1,33 @@
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|┌ …es/commo┐┌ .a-dir ────────────────────────────────┐
|
||||
02|│ .a-dir ││ aa-file │
|
||||
03|│ a-dir ││abc │
|
||||
04|│ b-dir ││ ab-file │
|
||||
05|│ .a-file ││ │
|
||||
06|│ a-file ││ │
|
||||
07|└──────────┘└────────────────────────────────────────┘
|
||||
08|~
|
||||
09|~
|
||||
10|~
|
||||
11|~
|
||||
12|~
|
||||
13|~
|
||||
14|~
|
||||
15|-- INSERT -- 2,4 All
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|01222222222031444444133333333333333333333333333333333355555555555555555555555555
|
||||
02|06666666677031111111111111111111111111111111111111111388888888888888888888888888
|
||||
03|09999999111037777777777777777777777777777777777777777388888888888888888888888888
|
||||
04|09999999111031111111111111111111111111111111111111111388888888888888888888888888
|
||||
05|0111111111103::::::::::::::::::::::::::::::::::::::::388888888888888888888888888
|
||||
06|0111111111103::::::::::::::::::::::::::::::::::::::::388888888888888888888888888
|
||||
07|00000000000033333333333333333333333333333333333333333388888888888888888888888888
|
||||
08|88888888888888888888888888888888888888888888888888888888888888888888888888888888
|
||||
09|88888888888888888888888888888888888888888888888888888888888888888888888888888888
|
||||
10|88888888888888888888888888888888888888888888888888888888888888888888888888888888
|
||||
11|88888888888888888888888888888888888888888888888888888888888888888888888888888888
|
||||
12|88888888888888888888888888888888888888888888888888888888888888888888888888888888
|
||||
13|88888888888888888888888888888888888888888888888888888888888888888888888888888888
|
||||
14|88888888888888888888888888888888888888888888888888888888888888888888888888888888
|
||||
15|;;;;;;;;;;;;55555555555555555555555555555555555555555555555555555555555555555555
|
||||
@ -0,0 +1,33 @@
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|┌ MOCK_ROOT/tests/dir-files/common ──────┐
|
||||
02|│ .a-dir │
|
||||
03|│def │
|
||||
04|│ a-dir │
|
||||
05|│ b-dir │
|
||||
06|│ .a-file │
|
||||
07|└────────────────────────────────────────┘
|
||||
08|~
|
||||
09|~
|
||||
10|~
|
||||
11|~
|
||||
12|~
|
||||
13|~
|
||||
14|~
|
||||
15|-- INSERT -- 2,4 Top
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|01222222222222222222222222222222221000000033333333333333333333333333333333333333
|
||||
02|04444444411111111111111111111111111111111055555555555555555555555555555555555555
|
||||
03|06666666666666666666666666666666666666666055555555555555555555555555555555555555
|
||||
04|04444444111111111111111111111111111111111055555555555555555555555555555555555555
|
||||
05|04444444111111111111111111111111111111111055555555555555555555555555555555555555
|
||||
06|01111111111111111111111111111111111111111055555555555555555555555555555555555555
|
||||
07|00000000000000000000000000000000000000000055555555555555555555555555555555555555
|
||||
08|55555555555555555555555555555555555555555555555555555555555555555555555555555555
|
||||
09|55555555555555555555555555555555555555555555555555555555555555555555555555555555
|
||||
10|55555555555555555555555555555555555555555555555555555555555555555555555555555555
|
||||
11|55555555555555555555555555555555555555555555555555555555555555555555555555555555
|
||||
12|55555555555555555555555555555555555555555555555555555555555555555555555555555555
|
||||
13|55555555555555555555555555555555555555555555555555555555555555555555555555555555
|
||||
14|55555555555555555555555555555555555555555555555555555555555555555555555555555555
|
||||
15|77777777777733333333333333333333333333333333333333333333333333333333333333333333
|
||||
@ -1,11 +1,11 @@
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|┌MOCK_ROOT/tests/dir-files/temp────────────────────┐
|
||||
02|│ file-1 │
|
||||
03|│ file-2 │
|
||||
04|└──────────────────────────────────────────────────┘
|
||||
05|~
|
||||
06|~
|
||||
07|~
|
||||
01|┌ MOCK_ROOT/tests/dir-files/common ──────┐
|
||||
02|│def │
|
||||
03|│ a-dir │
|
||||
04|│ b-dir │
|
||||
05|│ .a-file │
|
||||
06|│a │
|
||||
07|└────────────────────────────────────────┘
|
||||
08|~
|
||||
09|~
|
||||
10|~
|
||||
@ -13,16 +13,16 @@
|
||||
12|~
|
||||
13|~
|
||||
14|~
|
||||
15| 2,14-12 All
|
||||
15|-- INSERT -- 6,2 25%
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|01111111111111111111111111111110000000000000000000002222222222222222222222222222
|
||||
02|03333333333333333333333333333333333333333333333333304444444444444444444444444444
|
||||
03|05555555555555555555555555555555555555555555555555504444444444444444444444444444
|
||||
04|00000000000000000000000000000000000000000000000000004444444444444444444444444444
|
||||
05|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
06|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
07|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
01|01222222222222222222222222222222221000000033333333333333333333333333333333333333
|
||||
02|01111111111111111111111111111111111111111044444444444444444444444444444444444444
|
||||
03|05555555111111111111111111111111111111111044444444444444444444444444444444444444
|
||||
04|05555555111111111111111111111111111111111044444444444444444444444444444444444444
|
||||
05|01111111111111111111111111111111111111111044444444444444444444444444444444444444
|
||||
06|06666666666666666666666666666666666666666044444444444444444444444444444444444444
|
||||
07|00000000000000000000000000000000000000000044444444444444444444444444444444444444
|
||||
08|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
09|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
10|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
@ -30,4 +30,4 @@
|
||||
12|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
13|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
14|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
15|22222222222222222222222222222222222222222222222222222222222222222222222222222222
|
||||
15|77777777777733333333333333333333333333333333333333333333333333333333333333333333
|
||||
@ -0,0 +1,33 @@
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|┌ MOCK_ROOT/tests/dir-files/common ──────┐
|
||||
02|│def │
|
||||
03|│ a-dir │
|
||||
04|│ b-dir │
|
||||
05|│ .a-file │
|
||||
06|│a-file │
|
||||
07| a-file ─────────────────────────┘
|
||||
08| a-dir
|
||||
09|~
|
||||
10|~
|
||||
11|~
|
||||
12|~
|
||||
13|~
|
||||
14|~
|
||||
15|-- Keyword completion (^N^P) match 1 of 2
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|01222222222222222222222222222222221000000033333333333333333333333333333333333333
|
||||
02|01111111111111111111111111111111111111111044444444444444444444444444444444444444
|
||||
03|05555555111111111111111111111111111111111044444444444444444444444444444444444444
|
||||
04|05555555111111111111111111111111111111111044444444444444444444444444444444444444
|
||||
05|01111111111111111111111111111111111111111044444444444444444444444444444444444444
|
||||
06|06666666666666666666666666666666666666666044444444444444444444444444444444444444
|
||||
07|77777777777777770000000000000000000000000044444444444444444444444444444444444444
|
||||
08|66666666666666664444444444444444444444444444444444444444444444444444444444444444
|
||||
09|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
10|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
11|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
12|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
13|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
14|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
15|88888888888888888888888888888999999999999333333333333333333333333333333333333333
|
||||
@ -1,33 +0,0 @@
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|┌…dir-files/temp┐┌dir───────────────────────────────────────────────┐
|
||||
02|│ dir ││ file-1 │
|
||||
03|└───────────────┘│ file │
|
||||
04|~ └──────────────────────────────────────────────────┘
|
||||
05|~
|
||||
06|~
|
||||
07|~
|
||||
08|~
|
||||
09|~
|
||||
10|~
|
||||
11|~
|
||||
12|~
|
||||
13|~
|
||||
14|~
|
||||
15| 1,14-12 All
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|01111111111111110022200000000000000000000000000000000000000000000000033333333333
|
||||
02|04444455555555550055555555555555555555555555555555555555555555555555066666666666
|
||||
03|00000000000000000077777777777777777777777777777777777777777777777777066666666666
|
||||
04|66666666666666666000000000000000000000000000000000000000000000000000066666666666
|
||||
05|66666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||
06|66666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||
07|66666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||
08|66666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||
09|66666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||
10|66666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||
11|66666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||
12|66666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||
13|66666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||
14|66666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||
15|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
@ -1,33 +0,0 @@
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|┌…dir-files/temp┐┌dir───────────────────────────────────────────────┐
|
||||
02|│ dir ││ file │
|
||||
03|└───────────────┘│ file-1 │
|
||||
04|~ └──────────────────────────────────────────────────┘
|
||||
05|~
|
||||
06|~
|
||||
07|~
|
||||
08|~
|
||||
09|~
|
||||
10|~
|
||||
11|~
|
||||
12|~
|
||||
13|~
|
||||
14|~
|
||||
15| 2,9-7 All
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|01111111111111110022200000000000000000000000000000000000000000000000033333333333
|
||||
02|04444455555555550066666666666666666666666666666666666666666666666666077777777777
|
||||
03|00000000000000000055555555555555555555555555555555555555555555555555077777777777
|
||||
04|77777777777777777000000000000000000000000000000000000000000000000000077777777777
|
||||
05|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
06|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
07|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
08|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
09|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
10|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
11|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
12|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
13|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
14|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
15|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
@ -1,33 +0,0 @@
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|┌MOCK_ROOT/tests/dir-files/temp────────────────────┐
|
||||
02|│ file-1 │
|
||||
03|│ file-2 │
|
||||
04|└──────────────────────────────────────────────────┘
|
||||
05|~
|
||||
06|~
|
||||
07|~
|
||||
08|~
|
||||
09|~
|
||||
10|~
|
||||
11|~
|
||||
12|~
|
||||
13|~
|
||||
14|~
|
||||
15| 2,9-7 All
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|01111111111111111111111111111110000000000000000000002222222222222222222222222222
|
||||
02|03333333333333333333333333333333333333333333333333304444444444444444444444444444
|
||||
03|05555555555555555555555555555555555555555555555555504444444444444444444444444444
|
||||
04|00000000000000000000000000000000000000000000000000004444444444444444444444444444
|
||||
05|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
06|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
07|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
08|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
09|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
10|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
11|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
12|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
13|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
14|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
15|22222222222222222222222222222222222222222222222222222222222222222222222222222222
|
||||
@ -13,7 +13,7 @@
|
||||
12|~
|
||||
13|~
|
||||
14|~
|
||||
15|1 more line; before #1 0 seconds ago 2,9-7 All
|
||||
15| 2,9-7 All
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|01111111111111111111111111111110000000000000000000002222222222222222222222222222
|
||||
|
||||
@ -8,17 +8,19 @@
|
||||
07|││Go in entry plus │ L │ │
|
||||
08|││Go out of directory │ h │ │
|
||||
09|└│Go out of directory plus │ H │─────────────────┘
|
||||
10|~│Reset │ <BS>│
|
||||
11|~│Reveal cwd │ @ │
|
||||
12|~│Show Help │ g? │
|
||||
13|~│Synchronize │ = │
|
||||
14|~│Trim branch left │ < │
|
||||
15|~│Trim branch right │ > │
|
||||
16|~│ │
|
||||
17|~│(Press `q` to close) │
|
||||
18|~└───────────────────────────────┘
|
||||
19|~
|
||||
20| 1,1 All
|
||||
10|~│Go to bookmark │ ' │
|
||||
11|~│Reset │ <BS>│
|
||||
12|~│Reveal cwd │ @ │
|
||||
13|~│Set bookmark │ m │
|
||||
14|~│Show Help │ g? │
|
||||
15|~│Synchronize │ = │
|
||||
16|~│Trim branch left │ < │
|
||||
17|~│Trim branch right │ > │
|
||||
18|~│ │
|
||||
19|~│(Press `q` to close) │
|
||||
20|~└───────────────────────────────┘
|
||||
21|~
|
||||
22| 1,1 All
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|
|
||||
01|011111111111111111111111111111111000000000000000000022222222
|
||||
@ -38,6 +40,8 @@
|
||||
15|506666666666666666666666666666666055555555555555555555555555
|
||||
16|506666666666666666666666666666666055555555555555555555555555
|
||||
17|506666666666666666666666666666666055555555555555555555555555
|
||||
18|500000000000000000000000000000000055555555555555555555555555
|
||||
19|555555555555555555555555555555555555555555555555555555555555
|
||||
20|222222222222222222222222222222222222222222222222222222222222
|
||||
18|506666666666666666666666666666666055555555555555555555555555
|
||||
19|506666666666666666666666666666666055555555555555555555555555
|
||||
20|500000000000000000000000000000000055555555555555555555555555
|
||||
21|555555555555555555555555555555555555555555555555555555555555
|
||||
22|222222222222222222222222222222222222222222222222222222222222
|
||||
|
||||
@ -8,17 +8,19 @@
|
||||
07|││Go in entry plus │ L │ │
|
||||
08|││Go out of directory │ h │ │
|
||||
09|└│Go out of directory plus │ H │─────────────────┘
|
||||
10|~│Reset │ <BS>│
|
||||
11|~│Reveal cwd │ @ │
|
||||
12|~│Show Help │ Q │
|
||||
13|~│Synchronize │ = │
|
||||
14|~│Trim branch left │ < │
|
||||
15|~│Trim branch right │ > │
|
||||
16|~│ │
|
||||
17|~│(Press `q` to close) │
|
||||
18|~└───────────────────────────────┘
|
||||
19|~
|
||||
20| 1,1 All
|
||||
10|~│Go to bookmark │ ' │
|
||||
11|~│Reset │ <BS>│
|
||||
12|~│Reveal cwd │ @ │
|
||||
13|~│Set bookmark │ m │
|
||||
14|~│Show Help │ Q │
|
||||
15|~│Synchronize │ = │
|
||||
16|~│Trim branch left │ < │
|
||||
17|~│Trim branch right │ > │
|
||||
18|~│ │
|
||||
19|~│(Press `q` to close) │
|
||||
20|~└───────────────────────────────┘
|
||||
21|~
|
||||
22| 1,1 All
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|
|
||||
01|011111111111111111111111111111111000000000000000000022222222
|
||||
@ -38,6 +40,8 @@
|
||||
15|506666666666666666666666666666666055555555555555555555555555
|
||||
16|506666666666666666666666666666666055555555555555555555555555
|
||||
17|506666666666666666666666666666666055555555555555555555555555
|
||||
18|500000000000000000000000000000000055555555555555555555555555
|
||||
19|555555555555555555555555555555555555555555555555555555555555
|
||||
20|222222222222222222222222222222222222222222222222222222222222
|
||||
18|506666666666666666666666666666666055555555555555555555555555
|
||||
19|506666666666666666666666666666666055555555555555555555555555
|
||||
20|500000000000000000000000000000000055555555555555555555555555
|
||||
21|555555555555555555555555555555555555555555555555555555555555
|
||||
22|222222222222222222222222222222222222222222222222222222222222
|
||||
|
||||
@ -18,7 +18,9 @@
|
||||
17|~
|
||||
18|~
|
||||
19|~
|
||||
20| g? 1,9-7 All
|
||||
20|~
|
||||
21|~
|
||||
22| g? 1,9-7 All
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|
|
||||
01|011111111111111111111111111111111000000000000000000022222222
|
||||
@ -40,4 +42,6 @@
|
||||
17|555555555555555555555555555555555555555555555555555555555555
|
||||
18|555555555555555555555555555555555555555555555555555555555555
|
||||
19|555555555555555555555555555555555555555555555555555555555555
|
||||
20|222222222222222222222222222222222222222222222222222222222222
|
||||
20|555555555555555555555555555555555555555555555555555555555555
|
||||
21|555555555555555555555555555555555555555555555555555555555555
|
||||
22|222222222222222222222222222222222222222222222222222222222222
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
04|│ c.gif ││ x = math.max(1, 2), │
|
||||
05|│ LICENSE ││ y = math.min(1, 2), │
|
||||
06|│ Makefile ││} │
|
||||
07|└─────────────────────────┘└─────────────────────────┘
|
||||
08|~
|
||||
07|│ top-secret │└─────────────────────────┘
|
||||
08|└─────────────────────────┘
|
||||
09|~
|
||||
10|~
|
||||
11|~
|
||||
@ -22,8 +22,8 @@
|
||||
04|088888888888888888888888880088:8889999;<<<;=;8=;;8888077777777777777777777777777
|
||||
05|088888888888888888888888880088:8889999;<<<;=;8=;;8888077777777777777777777777777
|
||||
06|08888888888888888888888888009888888888888888888888888077777777777777777777777777
|
||||
07|00000000000000000000000000000000000000000000000000000077777777777777777777777777
|
||||
08|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
07|08888888888888888888888888000000000000000000000000000077777777777777777777777777
|
||||
08|00000000000000000000000000077777777777777777777777777777777777777777777777777777
|
||||
09|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
10|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
11|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
04|│ c.gif ││Line 3 │
|
||||
05|│ LICENSE ││Line 4 │
|
||||
06|│ Makefile ││Line 5 │
|
||||
07|└─────────────────────────┘│Line 6 │
|
||||
08|~ │Line 7 │
|
||||
07|│ top-secret ││Line 6 │
|
||||
08|└─────────────────────────┘│Line 7 │
|
||||
09|~ │Line 8 │
|
||||
10|~ │Line 9 │
|
||||
11|~ │Line 10 │
|
||||
@ -22,8 +22,8 @@
|
||||
04|04444444444444444444444444004444444444444444444444444066666666666666666666666666
|
||||
05|04444444444444444444444444004444444444444444444444444066666666666666666666666666
|
||||
06|04444444444444444444444444004444444444444444444444444066666666666666666666666666
|
||||
07|00000000000000000000000000004444444444444444444444444066666666666666666666666666
|
||||
08|66666666666666666666666666604444444444444444444444444066666666666666666666666666
|
||||
07|04444444444444444444444444004444444444444444444444444066666666666666666666666666
|
||||
08|00000000000000000000000000004444444444444444444444444066666666666666666666666666
|
||||
09|66666666666666666666666666604444444444444444444444444066666666666666666666666666
|
||||
10|66666666666666666666666666604444444444444444444444444066666666666666666666666666
|
||||
11|66666666666666666666666666604444444444444444444444444066666666666666666666666666
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
04|│ c.gif │
|
||||
05|│ LICENSE │
|
||||
06|│ Makefile │
|
||||
07|└─────────────────────────┘
|
||||
08|~
|
||||
07|│ top-secret │
|
||||
08|└─────────────────────────┘
|
||||
09|~
|
||||
10|~
|
||||
11|~
|
||||
@ -22,8 +22,8 @@
|
||||
04|05555555555555555555555555066666666666666666666666666666666666666666666666666666
|
||||
05|04444444444444444444444444066666666666666666666666666666666666666666666666666666
|
||||
06|04444444444444444444444444066666666666666666666666666666666666666666666666666666
|
||||
07|00000000000000000000000000066666666666666666666666666666666666666666666666666666
|
||||
08|66666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||
07|04444444444444444444444444066666666666666666666666666666666666666666666666666666
|
||||
08|00000000000000000000000000066666666666666666666666666666666666666666666666666666
|
||||
09|66666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||
10|66666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||
11|66666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
04|│ c.gif │
|
||||
05|│ LICENSE │
|
||||
06|│ Makefile │
|
||||
07|└─────────────────────────┘
|
||||
08|~
|
||||
07|│ top-secret │
|
||||
08|└─────────────────────────┘
|
||||
09|~
|
||||
10|~
|
||||
11|~
|
||||
@ -22,8 +22,8 @@
|
||||
04|04444444444444444444444444066666666666666666666666666666666666666666666666666666
|
||||
05|05555555555555555555555555066666666666666666666666666666666666666666666666666666
|
||||
06|04444444444444444444444444066666666666666666666666666666666666666666666666666666
|
||||
07|00000000000000000000000000066666666666666666666666666666666666666666666666666666
|
||||
08|66666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||
07|04444444444444444444444444066666666666666666666666666666666666666666666666666666
|
||||
08|00000000000000000000000000066666666666666666666666666666666666666666666666666666
|
||||
09|66666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||
10|66666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||
11|66666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
04|│ c.gif ││all: test │
|
||||
05|│ LICENSE │└─────────────────────────┘
|
||||
06|│ Makefile │
|
||||
07|└─────────────────────────┘
|
||||
08|~
|
||||
07|│ top-secret │
|
||||
08|└─────────────────────────┘
|
||||
09|~
|
||||
10|~
|
||||
11|~
|
||||
@ -22,8 +22,8 @@
|
||||
04|04444444444444444444444444008888444444444444444444444077777777777777777777777777
|
||||
05|04444444444444444444444444000000000000000000000000000077777777777777777777777777
|
||||
06|06666666666666666666666666077777777777777777777777777777777777777777777777777777
|
||||
07|00000000000000000000000000077777777777777777777777777777777777777777777777777777
|
||||
08|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
07|04444444444444444444444444077777777777777777777777777777777777777777777777777777
|
||||
08|00000000000000000000000000077777777777777777777777777777777777777777777777777777
|
||||
09|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
10|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
11|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
|
||||
@ -0,0 +1,33 @@
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|┌MOCK_ROOT/tests/dir-files┐┌top-secret───────────────┐
|
||||
02|│ a.lua ││-No-access---------------│
|
||||
03|│ b.txt │└─────────────────────────┘
|
||||
04|│ c.gif │
|
||||
05|│ LICENSE │
|
||||
06|│ Makefile │
|
||||
07|│ top-secret │
|
||||
08|└─────────────────────────┘
|
||||
09|~
|
||||
10|~
|
||||
11|~
|
||||
12|~
|
||||
13|~
|
||||
14|~
|
||||
15| 6,9-7 All
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|01111111111111111111111111002222222222000000000000000033333333333333333333333333
|
||||
02|04444444444444444444444444005555555555555555555555555066666666666666666666666666
|
||||
03|04444444444444444444444444000000000000000000000000000066666666666666666666666666
|
||||
04|04444444444444444444444444066666666666666666666666666666666666666666666666666666
|
||||
05|04444444444444444444444444066666666666666666666666666666666666666666666666666666
|
||||
06|04444444444444444444444444066666666666666666666666666666666666666666666666666666
|
||||
07|05555555555555555555555555066666666666666666666666666666666666666666666666666666
|
||||
08|00000000000000000000000000066666666666666666666666666666666666666666666666666666
|
||||
09|66666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||
10|66666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||
11|66666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||
12|66666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||
13|66666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||
14|66666666666666666666666666666666666666666666666666666666666666666666666666666666
|
||||
15|33333333333333333333333333333333333333333333333333333333333333333333333333333333
|
||||
@ -0,0 +1,33 @@
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|┌MOCK_ROOT/tests/dir-files/common──────────────────┐
|
||||
02|│new-file │
|
||||
03|│ .a-dir │
|
||||
04|│ a-dir │
|
||||
05|│ b-dir │
|
||||
06|│ .a-file │
|
||||
07|│ a-file │
|
||||
08|│ A-file-2 │
|
||||
09|│ b-file │
|
||||
10|└──────────────────────────────────────────────────┘
|
||||
11|~
|
||||
12|~
|
||||
13|~
|
||||
14|~
|
||||
15| 2,10-8 All
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|01111111111111111111111111111111100000000000000000002222222222222222222222222222
|
||||
02|03333333333333333333333333333333333333333333333333304444444444444444444444444444
|
||||
03|05555555566666666666666666666666666666666666666666604444444444444444444444444444
|
||||
04|07777777333333333333333333333333333333333333333333304444444444444444444444444444
|
||||
05|07777777333333333333333333333333333333333333333333304444444444444444444444444444
|
||||
06|03333333333333333333333333333333333333333333333333304444444444444444444444444444
|
||||
07|03333333333333333333333333333333333333333333333333304444444444444444444444444444
|
||||
08|03333333333333333333333333333333333333333333333333304444444444444444444444444444
|
||||
09|03333333333333333333333333333333333333333333333333304444444444444444444444444444
|
||||
10|00000000000000000000000000000000000000000000000000004444444444444444444444444444
|
||||
11|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
12|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
13|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
14|44444444444444444444444444444444444444444444444444444444444444444444444444444444
|
||||
15|22222222222222222222222222222222222222222222222222222222222222222222222222222222
|
||||
@ -5,8 +5,8 @@
|
||||
04|│ nested ││ c.gif │
|
||||
05|│ real ││ LICENSE │
|
||||
06|│ init-default-explorer.lua ││ Makefile │
|
||||
07|│ mock-win-functions.lua │└───────────────┘
|
||||
08|└──────────────────────────────────────────────────┘
|
||||
07|│ mock-win-functions.lua ││ top-secret │
|
||||
08|└──────────────────────────────────────────────────┘└───────────────┘
|
||||
09|~
|
||||
10|~
|
||||
11|~
|
||||
@ -22,8 +22,8 @@
|
||||
04|04444444455555555555555555555555555555555555555555500445555555555555088888888888
|
||||
05|06666667777777777777777777777777777777777777777777700::5555555555555088888888888
|
||||
06|04455555555555555555555555555555555555555555555555500;;5555555555555088888888888
|
||||
07|04455555555555555555555555555555555555555555555555500000000000000000088888888888
|
||||
08|00000000000000000000000000000000000000000000000000008888888888888888888888888888
|
||||
07|04455555555555555555555555555555555555555555555555500;;5555555555555088888888888
|
||||
08|00000000000000000000000000000000000000000000000000000000000000000000088888888888
|
||||
09|88888888888888888888888888888888888888888888888888888888888888888888888888888888
|
||||
10|88888888888888888888888888888888888888888888888888888888888888888888888888888888
|
||||
11|88888888888888888888888888888888888888888888888888888888888888888888888888888888
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
04|│ nested ││ c.gif │
|
||||
05|│ real ││ LICENSE │
|
||||
06|│ init-default-explorer.lua ││ Makefile │
|
||||
07|│ mock-win-functions.lua │└───────────────┘
|
||||
08|└──────────────────────────────────────────────────┘
|
||||
07|│ mock-win-functions.lua ││ top-secret │
|
||||
08|└──────────────────────────────────────────────────┘└───────────────┘
|
||||
09|~
|
||||
10|~
|
||||
11|~
|
||||
@ -22,8 +22,8 @@
|
||||
04|04444444455555555555555555555555555555555555555555500445555555555555088888888888
|
||||
05|06666667777777777777777777777777777777777777777777700::5555555555555088888888888
|
||||
06|04455555555555555555555555555555555555555555555555500;;5555555555555088888888888
|
||||
07|04455555555555555555555555555555555555555555555555500000000000000000088888888888
|
||||
08|00000000000000000000000000000000000000000000000000008888888888888888888888888888
|
||||
07|04455555555555555555555555555555555555555555555555500;;5555555555555088888888888
|
||||
08|00000000000000000000000000000000000000000000000000000000000000000000088888888888
|
||||
09|88888888888888888888888888888888888888888888888888888888888888888888888888888888
|
||||
10|88888888888888888888888888888888888888888888888888888888888888888888888888888888
|
||||
11|88888888888888888888888888888888888888888888888888888888888888888888888888888888
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
04|│ nested ││ c.gif │
|
||||
05|│ real ││ LICENSE │
|
||||
06|│ init-default-explorer.lua ││ Makefile │
|
||||
07|│ mock-win-functions.lua │└───────────────┘
|
||||
08|└──────────────────────────────────────────────────┘
|
||||
07|│ mock-win-functions.lua ││ top-secret │
|
||||
08|└──────────────────────────────────────────────────┘└───────────────┘
|
||||
09|~
|
||||
10|~
|
||||
11|~
|
||||
@ -22,8 +22,8 @@
|
||||
04|04444444455555555555555555555555555555555555555555500555555555555555077777777777
|
||||
05|08888886666666666666666666666666666666666666666666600555555555555555077777777777
|
||||
06|05555555555555555555555555555555555555555555555555500555555555555555077777777777
|
||||
07|05555555555555555555555555555555555555555555555555500000000000000000077777777777
|
||||
08|00000000000000000000000000000000000000000000000000007777777777777777777777777777
|
||||
07|05555555555555555555555555555555555555555555555555500555555555555555077777777777
|
||||
08|00000000000000000000000000000000000000000000000000000000000000000000077777777777
|
||||
09|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
10|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
11|77777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
--|---------|---------|---------|
|
||||
01|┌…ts/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| 1,10-8 All
|
||||
|
||||
--|---------|---------|---------|
|
||||
01|011111111111111111111022222222
|
||||
02|033333333444444444444055555555
|
||||
03|066666667777777777777055555555
|
||||
04|066666667777777777777055555555
|
||||
05|077777777777777777777055555555
|
||||
06|077777777777777777777055555555
|
||||
07|077777777777777777777055555555
|
||||
08|077777777777777777777055555555
|
||||
09|000000000000000000000055555555
|
||||
10|555555555555555555555555555555
|
||||
11|555555555555555555555555555555
|
||||
12|222222222222222222222222222222
|
||||
@ -0,0 +1,27 @@
|
||||
--|---------|---------|---------|
|
||||
01|┌…-files/common/a-dir┐
|
||||
02|│ aa-dir │
|
||||
03|│ aa-file │
|
||||
04|│ ab-file │
|
||||
05|└────────────────────┘
|
||||
06|~
|
||||
07|~
|
||||
08|~
|
||||
09|~
|
||||
10|~
|
||||
11|~
|
||||
12| 1,10-8 All
|
||||
|
||||
--|---------|---------|---------|
|
||||
01|011111111111111111111022222222
|
||||
02|033333333444444444444055555555
|
||||
03|066666666666666666666055555555
|
||||
04|066666666666666666666055555555
|
||||
05|000000000000000000000055555555
|
||||
06|555555555555555555555555555555
|
||||
07|555555555555555555555555555555
|
||||
08|555555555555555555555555555555
|
||||
09|555555555555555555555555555555
|
||||
10|555555555555555555555555555555
|
||||
11|555555555555555555555555555555
|
||||
12|222222222222222222222222222222
|
||||
@ -0,0 +1,27 @@
|
||||
--|---------|---------|---------|---------|
|
||||
01|┌…es/common┐┌a-dir───────────────┐
|
||||
02|│ .a-dir ││ aa-dir │
|
||||
03|│ a-dir ││ aa-file │
|
||||
04|│ b-dir ││ ab-file │
|
||||
05|│ .a-file │└────────────────────┘
|
||||
06|│ a-file │
|
||||
07|│ A-file-2│
|
||||
08|│ b-file │
|
||||
09|└──────────┘
|
||||
10|~
|
||||
11|~
|
||||
12| 1,10-8 All
|
||||
|
||||
--|---------|---------|---------|---------|
|
||||
01|0111111111100222220000000000000000333333
|
||||
02|0444444445500666666667777777777770888888
|
||||
03|0666666677700555555555555555555550888888
|
||||
04|0444444455500555555555555555555550888888
|
||||
05|0555555555500000000000000000000000888888
|
||||
06|0555555555508888888888888888888888888888
|
||||
07|0555555555508888888888888888888888888888
|
||||
08|0555555555508888888888888888888888888888
|
||||
09|0000000000008888888888888888888888888888
|
||||
10|8888888888888888888888888888888888888888
|
||||
11|8888888888888888888888888888888888888888
|
||||
12|3333333333333333333333333333333333333333
|
||||
@ -0,0 +1,27 @@
|
||||
--|---------|---------|---------|---------|
|
||||
01|┌…ests/dir-files/real┐┌LICENSE───┐
|
||||
02|│ a.lua ││ │
|
||||
03|│ b.txt │└──────────┘
|
||||
04|│ c.gif │
|
||||
05|│ LICENSE │
|
||||
06|│ Makefile │
|
||||
07|│ top-secret │
|
||||
08|└────────────────────┘
|
||||
09|~
|
||||
10|~
|
||||
11|~
|
||||
12| 4,10-8 All
|
||||
|
||||
--|---------|---------|---------|---------|
|
||||
01|0111111111111111111110022222220000333333
|
||||
02|0444444444444444444440055555555550666666
|
||||
03|0444444444444444444440000000000000666666
|
||||
04|0444444444444444444440666666666666666666
|
||||
05|0555555555555555555550666666666666666666
|
||||
06|0444444444444444444440666666666666666666
|
||||
07|0444444444444444444440666666666666666666
|
||||
08|0000000000000000000000666666666666666666
|
||||
09|6666666666666666666666666666666666666666
|
||||
10|6666666666666666666666666666666666666666
|
||||
11|6666666666666666666666666666666666666666
|
||||
12|3333333333333333333333333333333333333333
|
||||
@ -0,0 +1,27 @@
|
||||
--|---------|---------|---------|---------|
|
||||
01|┌…ests/dir-files/real┐┌LICENSE────────┐
|
||||
02|│ a.lua ││ │
|
||||
03|│ b.txt │└───────────────┘
|
||||
04|│ c.gif │
|
||||
05|│ LICENSE │
|
||||
06|│ Makefile │
|
||||
07|│ top-secret │
|
||||
08|└────────────────────┘
|
||||
09|~
|
||||
10|~
|
||||
11|~
|
||||
12| 4,10-8 All
|
||||
|
||||
--|---------|---------|---------|---------|
|
||||
01|0111111111111111111110022222220000000003
|
||||
02|0444444444444444444440055555555555555506
|
||||
03|0444444444444444444440000000000000000006
|
||||
04|0444444444444444444440666666666666666666
|
||||
05|0555555555555555555550666666666666666666
|
||||
06|0444444444444444444440666666666666666666
|
||||
07|0444444444444444444440666666666666666666
|
||||
08|0000000000000000000000666666666666666666
|
||||
09|6666666666666666666666666666666666666666
|
||||
10|6666666666666666666666666666666666666666
|
||||
11|6666666666666666666666666666666666666666
|
||||
12|3333333333333333333333333333333333333333
|
||||
@ -0,0 +1,27 @@
|
||||
--|---------|---------|---------|---------|
|
||||
01|┌…ts/dir-files/common┐┌.a-dir─────────┐
|
||||
02|│ .a-dir ││ aa-file │
|
||||
03|│ a-dir ││ ab-file │
|
||||
04|│ b-dir │└───────────────┘
|
||||
05|│ .a-file │
|
||||
06|│ a-file │
|
||||
07|│ A-file-2 │
|
||||
08|│ b-file │
|
||||
09|└────────────────────┘
|
||||
10|~
|
||||
11|~
|
||||
12| 1,10-8 All
|
||||
|
||||
--|---------|---------|---------|---------|
|
||||
01|0111111111111111111110022222200000000003
|
||||
02|0444444445555555555550055555555555555506
|
||||
03|0777777788888888888880088888888888888806
|
||||
04|0777777788888888888880000000000000000006
|
||||
05|0888888888888888888880666666666666666666
|
||||
06|0888888888888888888880666666666666666666
|
||||
07|0888888888888888888880666666666666666666
|
||||
08|0888888888888888888880666666666666666666
|
||||
09|0000000000000000000000666666666666666666
|
||||
10|6666666666666666666666666666666666666666
|
||||
11|6666666666666666666666666666666666666666
|
||||
12|3333333333333333333333333333333333333333
|
||||
@ -8,17 +8,19 @@
|
||||
07|││Go in entry plus │ L │ │
|
||||
08|││Go out of directory │ h │ │
|
||||
09|└│Go out of directory plus │ H │────────────────┘
|
||||
10|~│Reset │ <BS> │
|
||||
11|~│Reveal cwd │ @ │
|
||||
12|~│Show Help │ g? │
|
||||
13|~│Synchronize │ = │
|
||||
14|~│Trim branch left │ < │
|
||||
15|~│Trim branch right │ > │
|
||||
16|~│ │
|
||||
17|~│(Press `q` to close) │
|
||||
18|~└────────────────────────────────┘
|
||||
19|~
|
||||
20| 1,1 All
|
||||
10|~│Go to bookmark │ ' │
|
||||
11|~│Reset │ <BS> │
|
||||
12|~│Reveal cwd │ @ │
|
||||
13|~│Set bookmark │ m │
|
||||
14|~│Show Help │ g? │
|
||||
15|~│Synchronize │ = │
|
||||
16|~│Trim branch left │ < │
|
||||
17|~│Trim branch right │ > │
|
||||
18|~│ │
|
||||
19|~│(Press `q` to close) │
|
||||
20|~└────────────────────────────────┘
|
||||
21|~
|
||||
22| 1,1 All
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|
|
||||
01|011111111111111111111111111111111000000000000000000022222222
|
||||
@ -38,6 +40,8 @@
|
||||
15|506666666666666666666666666666666605555555555555555555555555
|
||||
16|506666666666666666666666666666666605555555555555555555555555
|
||||
17|506666666666666666666666666666666605555555555555555555555555
|
||||
18|500000000000000000000000000000000005555555555555555555555555
|
||||
19|555555555555555555555555555555555555555555555555555555555555
|
||||
20|222222222222222222222222222222222222222222222222222222222222
|
||||
18|506666666666666666666666666666666605555555555555555555555555
|
||||
19|506666666666666666666666666666666605555555555555555555555555
|
||||
20|500000000000000000000000000000000005555555555555555555555555
|
||||
21|555555555555555555555555555555555555555555555555555555555555
|
||||
22|222222222222222222222222222222222222222222222222222222222222
|
||||
|
||||
@ -0,0 +1,63 @@
|
||||
--|---------|---------|---------|---------|---------|---------|
|
||||
01|┌MOCK_ROOT/tests/dir-files/common──────────────────┐
|
||||
02|│┌'mini.files' help───────────────────┐ │
|
||||
03|││Buffer mappings: │ │
|
||||
04|││ │ │
|
||||
05|││Close │ q │ │
|
||||
06|││Go in entry │ l │ │
|
||||
07|││Go in entry plus │ L │ │
|
||||
08|││Go out of directory │ h │ │
|
||||
09|└│Go out of directory plus │ H │────────────┘
|
||||
10|~│Go to bookmark │ ' │
|
||||
11|~│Reset │ <BS> │
|
||||
12|~│Reveal cwd │ @ │
|
||||
13|~│Set bookmark │ m │
|
||||
14|~│Show Help │ g? │
|
||||
15|~│Synchronize │ = │
|
||||
16|~│Trim branch left │ < │
|
||||
17|~│Trim branch right │ > │
|
||||
18|~│ │
|
||||
19|~│Bookmarks: │
|
||||
20|~│ │
|
||||
21|~│a │ tests/dir-files │
|
||||
22|~│b │ Desc │
|
||||
23|~│c │ ~/ │
|
||||
24|~│d │ Cwd │
|
||||
25|~│e │ Should use these to adjust width│
|
||||
26|~│~ │ ~ │
|
||||
27|~│ │
|
||||
28|~│(Press `q` to close) │
|
||||
29|~└────────────────────────────────────┘
|
||||
30| 1,1 All
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|
|
||||
01|011111111111111111111111111111111000000000000000000022222222
|
||||
02|003333333333333333300000000000000000000444444444444055555555
|
||||
03|004444444444444444444444444444444444440666666666666055555555
|
||||
04|006666666666666666666666666666666666660666666666666055555555
|
||||
05|006666666666666666666666666666666666660666666666666055555555
|
||||
06|006666666666666666666666666666666666660666666666666055555555
|
||||
07|006666666666666666666666666666666666660666666666666055555555
|
||||
08|006666666666666666666666666666666666660666666666666055555555
|
||||
09|006666666666666666666666666666666666660000000000000055555555
|
||||
10|506666666666666666666666666666666666660555555555555555555555
|
||||
11|506666666666666666666666666666666666660555555555555555555555
|
||||
12|506666666666666666666666666666666666660555555555555555555555
|
||||
13|506666666666666666666666666666666666660555555555555555555555
|
||||
14|506666666666666666666666666666666666660555555555555555555555
|
||||
15|506666666666666666666666666666666666660555555555555555555555
|
||||
16|506666666666666666666666666666666666660555555555555555555555
|
||||
17|506666666666666666666666666666666666660555555555555555555555
|
||||
18|506666666666666666666666666666666666660555555555555555555555
|
||||
19|506666666666666666666666666666666666660555555555555555555555
|
||||
20|506666666666666666666666666666666666660555555555555555555555
|
||||
21|506666666666666666666666666666666666660555555555555555555555
|
||||
22|506666666666666666666666666666666666660555555555555555555555
|
||||
23|506666666666666666666666666666666666660555555555555555555555
|
||||
24|506666666666666666666666666666666666660555555555555555555555
|
||||
25|506666666666666666666666666666666666660555555555555555555555
|
||||
26|506666666666666666666666666666666666660555555555555555555555
|
||||
27|506666666666666666666666666666666666660555555555555555555555
|
||||
28|506666666666666666666666666666666666660555555555555555555555
|
||||
29|500000000000000000000000000000000000000555555555555555555555
|
||||
30|222222222222222222222222222222222222222222222222222222222222
|
||||
@ -8,17 +8,19 @@
|
||||
07|││Go in entry plus │ L │ │
|
||||
08|││Go out of directory │ h │ │
|
||||
09|└│Go out of directory plus │ H │─────────────────┘
|
||||
10|~│Reset │ <BS>│
|
||||
11|~│Reveal cwd │ @ │
|
||||
12|~│Show Help │ g? │
|
||||
13|~│Synchronize │ = │
|
||||
14|~│Trim branch left │ < │
|
||||
15|~│Trim branch right │ > │
|
||||
16|~│ │
|
||||
17|~│(Press `q` to close) │
|
||||
18|~└───────────────────────────────┘
|
||||
19|~
|
||||
20| 1,1 All
|
||||
10|~│Go to bookmark │ ' │
|
||||
11|~│Reset │ <BS>│
|
||||
12|~│Reveal cwd │ @ │
|
||||
13|~│Set bookmark │ m │
|
||||
14|~│Show Help │ g? │
|
||||
15|~│Synchronize │ = │
|
||||
16|~│Trim branch left │ < │
|
||||
17|~│Trim branch right │ > │
|
||||
18|~│ │
|
||||
19|~│(Press `q` to close) │
|
||||
20|~└───────────────────────────────┘
|
||||
21|~
|
||||
22| 1,1 All
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|
|
||||
01|011111111111111111111111111111111000000000000000000022222222
|
||||
@ -38,6 +40,8 @@
|
||||
15|506666666666666666666666666666666055555555555555555555555555
|
||||
16|506666666666666666666666666666666055555555555555555555555555
|
||||
17|506666666666666666666666666666666055555555555555555555555555
|
||||
18|500000000000000000000000000000000055555555555555555555555555
|
||||
19|555555555555555555555555555555555555555555555555555555555555
|
||||
20|222222222222222222222222222222222222222222222222222222222222
|
||||
18|506666666666666666666666666666666055555555555555555555555555
|
||||
19|506666666666666666666666666666666055555555555555555555555555
|
||||
20|500000000000000000000000000000000055555555555555555555555555
|
||||
21|555555555555555555555555555555555555555555555555555555555555
|
||||
22|222222222222222222222222222222222222222222222222222222222222
|
||||
|
||||
@ -7,18 +7,20 @@
|
||||
06|││Go in entry plus │ l │ │
|
||||
07|││Go out of directory │ h │ │
|
||||
08|││Go out of directory plus │ H │ │
|
||||
09|└│Reset │ <BS>│─────────────────┘
|
||||
10|~│Reveal cwd │ @ │
|
||||
11|~│Show Help │ g? │
|
||||
12|~│Synchronize │ = │
|
||||
13|~│Trim branch left │ < │
|
||||
14|~│Trim branch right │ > │
|
||||
15|~│ │
|
||||
16|~│(Press `q` to close) │
|
||||
17|~└───────────────────────────────┘
|
||||
18|~
|
||||
19|~
|
||||
20| 1,1 All
|
||||
09|└│Go to bookmark │ ' │─────────────────┘
|
||||
10|~│Reset │ <BS>│
|
||||
11|~│Reveal cwd │ @ │
|
||||
12|~│Set bookmark │ m │
|
||||
13|~│Show Help │ g? │
|
||||
14|~│Synchronize │ = │
|
||||
15|~│Trim branch left │ < │
|
||||
16|~│Trim branch right │ > │
|
||||
17|~│ │
|
||||
18|~│(Press `q` to close) │
|
||||
19|~└───────────────────────────────┘
|
||||
20|~
|
||||
21|~
|
||||
22| 1,1 All
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|
|
||||
01|011111111111111111111111111111111000000000000000000022222222
|
||||
@ -37,7 +39,9 @@
|
||||
14|506666666666666666666666666666666055555555555555555555555555
|
||||
15|506666666666666666666666666666666055555555555555555555555555
|
||||
16|506666666666666666666666666666666055555555555555555555555555
|
||||
17|500000000000000000000000000000000055555555555555555555555555
|
||||
18|555555555555555555555555555555555555555555555555555555555555
|
||||
19|555555555555555555555555555555555555555555555555555555555555
|
||||
20|222222222222222222222222222222222222222222222222222222222222
|
||||
17|506666666666666666666666666666666055555555555555555555555555
|
||||
18|506666666666666666666666666666666055555555555555555555555555
|
||||
19|500000000000000000000000000000000055555555555555555555555555
|
||||
20|555555555555555555555555555555555555555555555555555555555555
|
||||
21|555555555555555555555555555555555555555555555555555555555555
|
||||
22|222222222222222222222222222222222222222222222222222222222222
|
||||
|
||||
@ -8,17 +8,19 @@
|
||||
07|│ A-file-2 │ │Go in entry plus │ L │
|
||||
08|│ b-file │ │Go out of directory │ h │
|
||||
09|└───────────────┘ │Go out of directory plus │ H │
|
||||
10|~ │Reset │ <BS>│
|
||||
11|~ │Reveal cwd │ @ │
|
||||
12|~ │Show Help │ g? │
|
||||
13|~ │Synchronize │ = │
|
||||
14|~ │Trim branch left │ < │
|
||||
15|~ │Trim branch right │ > │
|
||||
16|~ │ │
|
||||
17|~ │(Press `q` to close) │
|
||||
18|~ └───────────────────────────────┘
|
||||
19|~
|
||||
20| 1,1 All
|
||||
10|~ │Go to bookmark │ ' │
|
||||
11|~ │Reset │ <BS>│
|
||||
12|~ │Reveal cwd │ @ │
|
||||
13|~ │Set bookmark │ m │
|
||||
14|~ │Show Help │ g? │
|
||||
15|~ │Synchronize │ = │
|
||||
16|~ │Trim branch left │ < │
|
||||
17|~ │Trim branch right │ > │
|
||||
18|~ │ │
|
||||
19|~ │(Press `q` to close) │
|
||||
20|~ └───────────────────────────────┘
|
||||
21|~
|
||||
22| 1,1 All
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|
|
||||
01|011111111111111100222222000000000000000000000000033333333333
|
||||
@ -38,6 +40,8 @@
|
||||
15|666666666666666666088888888888888888888888888888880666666666
|
||||
16|666666666666666666088888888888888888888888888888880666666666
|
||||
17|666666666666666666088888888888888888888888888888880666666666
|
||||
18|666666666666666666000000000000000000000000000000000666666666
|
||||
19|666666666666666666666666666666666666666666666666666666666666
|
||||
20|333333333333333333333333333333333333333333333333333333333333
|
||||
18|666666666666666666088888888888888888888888888888880666666666
|
||||
19|666666666666666666088888888888888888888888888888880666666666
|
||||
20|666666666666666666000000000000000000000000000000000666666666
|
||||
21|666666666666666666666666666666666666666666666666666666666666
|
||||
22|333333333333333333333333333333333333333333333333333333333333
|
||||
|
||||
@ -8,17 +8,19 @@
|
||||
07|││Go in entry plus │ L │ │
|
||||
08|││Go out of directory │ h │ │
|
||||
09|└│Go out of directory plus │ H │─────────────────┘
|
||||
10|~│Reset │ <BS>│
|
||||
11|~│Reveal cwd │ @ │
|
||||
12|~│Show Help │ g? │
|
||||
13|~│Synchronize │ = │
|
||||
14|~│Trim branch left │ < │
|
||||
15|~│Trim branch right │ > │
|
||||
16|~│ │
|
||||
17|~│(Press `q` to close) │
|
||||
18|~└───────────────────────────────┘
|
||||
19|~
|
||||
20| 1,1 All
|
||||
10|~│Go to bookmark │ ' │
|
||||
11|~│Reset │ <BS>│
|
||||
12|~│Reveal cwd │ @ │
|
||||
13|~│Set bookmark │ m │
|
||||
14|~│Show Help │ g? │
|
||||
15|~│Synchronize │ = │
|
||||
16|~│Trim branch left │ < │
|
||||
17|~│Trim branch right │ > │
|
||||
18|~│ │
|
||||
19|~│(Press `q` to close) │
|
||||
20|~└───────────────────────────────┘
|
||||
21|~
|
||||
22| 1,1 All
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|
|
||||
01|011111111111111111111111111111111000000000000000000022222222
|
||||
@ -38,6 +40,8 @@
|
||||
15|504444444444444444444444444444444055555555555555555555555555
|
||||
16|504444444444444444444444444444444055555555555555555555555555
|
||||
17|504444444444444444444444444444444055555555555555555555555555
|
||||
18|500000000000000000000000000000000055555555555555555555555555
|
||||
19|555555555555555555555555555555555555555555555555555555555555
|
||||
20|222222222222222222222222222222222222222222222222222222222222
|
||||
18|504444444444444444444444444444444055555555555555555555555555
|
||||
19|504444444444444444444444444444444055555555555555555555555555
|
||||
20|500000000000000000000000000000000055555555555555555555555555
|
||||
21|555555555555555555555555555555555555555555555555555555555555
|
||||
22|222222222222222222222222222222222222222222222222222222222222
|
||||
|
||||
@ -18,7 +18,9 @@
|
||||
17|~
|
||||
18|~
|
||||
19|~
|
||||
20| 3,9-7 All
|
||||
20|~
|
||||
21|~
|
||||
22| 3,9-7 All
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|
|
||||
01|011111111111111111111111111111111000000000000000000022222222
|
||||
@ -40,4 +42,6 @@
|
||||
17|555555555555555555555555555555555555555555555555555555555555
|
||||
18|555555555555555555555555555555555555555555555555555555555555
|
||||
19|555555555555555555555555555555555555555555555555555555555555
|
||||
20|222222222222222222222222222222222222222222222222222222222222
|
||||
20|555555555555555555555555555555555555555555555555555555555555
|
||||
21|555555555555555555555555555555555555555555555555555555555555
|
||||
22|222222222222222222222222222222222222222222222222222222222222
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
01|
|
||||
02|~
|
||||
03|~
|
||||
04|~
|
||||
05|~ git-repo/
|
||||
06|~ mocks/
|
||||
04|~ git-repo/
|
||||
05|~ mocks/
|
||||
06|~ deps-confirm
|
||||
07|~ diff-output
|
||||
08|~ file
|
||||
09|~ file1
|
||||
@ -19,8 +19,8 @@
|
||||
01|0000000000000000000000000000000000000000
|
||||
02|1111111111111111111111111111111111111111
|
||||
03|1111111111111111111111111111111111111111
|
||||
04|1111111111111111111111111111111111111111
|
||||
05|1111111111122222222222222221111111111111
|
||||
04|1111111111122222222222222221111111111111
|
||||
05|1111111111133333333333333331111111111111
|
||||
06|1111111111133333333333333331111111111111
|
||||
07|1111111111133333333333333331111111111111
|
||||
08|1111111111133333333333333331111111111111
|
||||
|
||||
@ -4,16 +4,16 @@
|
||||
03|~
|
||||
04|~
|
||||
05|~
|
||||
06|~
|
||||
07|~ git-repo/
|
||||
08|~ mocks/
|
||||
09|~ diff-output
|
||||
10|~ file
|
||||
11|~ file1
|
||||
12|~ File2
|
||||
13|~ file3
|
||||
14|~ help-output
|
||||
15|~ log-output
|
||||
06|~ git-repo/
|
||||
07|~ mocks/
|
||||
08|~ deps-confirm
|
||||
09|~ diff-output
|
||||
10|~ file
|
||||
11|~ file1
|
||||
12|~ File2
|
||||
13|~ file3
|
||||
14|~ help-output
|
||||
15|~ log-output
|
||||
16|:Git doesnotexist -- git-repo/
|
||||
17|
|
||||
|
||||
@ -23,15 +23,15 @@
|
||||
03|11111111111111111111111111111111
|
||||
04|11111111111111111111111111111111
|
||||
05|11111111111111111111111111111111
|
||||
06|11111111111111111111111111111111
|
||||
07|11111111111111111111222222222222
|
||||
08|11111111111111111111333333333333
|
||||
09|11111111111111111111333333333333
|
||||
10|11111111111111111111333333333333
|
||||
11|11111111111111111111333333333333
|
||||
12|11111111111111111111333333333333
|
||||
13|11111111111111111111333333333333
|
||||
14|11111111111111111111333333333333
|
||||
15|11111111111111111111333333333333
|
||||
06|11111111111111111112222222222222
|
||||
07|11111111111111111113333333333333
|
||||
08|11111111111111111113333333333333
|
||||
09|11111111111111111113333333333333
|
||||
10|11111111111111111113333333333333
|
||||
11|11111111111111111113333333333333
|
||||
12|11111111111111111113333333333333
|
||||
13|11111111111111111113333333333333
|
||||
14|11111111111111111113333333333333
|
||||
15|11111111111111111113333333333333
|
||||
16|44444444444444444444444444444444
|
||||
17|44444444444444444444444444444444
|
||||
|
||||
@ -2,16 +2,16 @@
|
||||
01|
|
||||
02|~
|
||||
03|~
|
||||
04|~
|
||||
05|~ git-repo/
|
||||
06|~ mocks/
|
||||
07|~ diff-output
|
||||
08|~ file
|
||||
09|~ file1
|
||||
10|~ File2
|
||||
11|~ file3
|
||||
12|~ help-output
|
||||
13|~ log-output
|
||||
04|~ git-repo/
|
||||
05|~ mocks/
|
||||
06|~ deps-confirm
|
||||
07|~ diff-output
|
||||
08|~ file
|
||||
09|~ file1
|
||||
10|~ File2
|
||||
11|~ file3
|
||||
12|~ help-output
|
||||
13|~ log-output
|
||||
14|:Git add git-repo/
|
||||
15|
|
||||
|
||||
@ -19,15 +19,15 @@
|
||||
01|00000000000000000000
|
||||
02|11111111111111111111
|
||||
03|11111111111111111111
|
||||
04|11111111111111111111
|
||||
05|11111111222222222222
|
||||
06|11111111333333333333
|
||||
07|11111111333333333333
|
||||
08|11111111333333333333
|
||||
09|11111111333333333333
|
||||
10|11111111333333333333
|
||||
11|11111111333333333333
|
||||
12|11111111333333333333
|
||||
13|11111111333333333333
|
||||
04|11111112222222222222
|
||||
05|11111113333333333333
|
||||
06|11111113333333333333
|
||||
07|11111113333333333333
|
||||
08|11111113333333333333
|
||||
09|11111113333333333333
|
||||
10|11111113333333333333
|
||||
11|11111113333333333333
|
||||
12|11111113333333333333
|
||||
13|11111113333333333333
|
||||
14|44444444444444444444
|
||||
15|44444444444444444444
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
01|
|
||||
02|~
|
||||
03|~
|
||||
04|~
|
||||
05|~ git-repo/
|
||||
06|~ mocks/
|
||||
04|~ git-repo/
|
||||
05|~ mocks/
|
||||
06|~ deps-confirm
|
||||
07|~ diff-output
|
||||
08|~ file
|
||||
09|~ file1
|
||||
@ -19,8 +19,8 @@
|
||||
01|00000000000000000000
|
||||
02|11111111111111111111
|
||||
03|11111111111111111111
|
||||
04|11111111111111111111
|
||||
05|11111112222222222222
|
||||
04|11111112222222222222
|
||||
05|11111113333333333333
|
||||
06|11111113333333333333
|
||||
07|11111113333333333333
|
||||
08|11111113333333333333
|
||||
|
||||
@ -2,16 +2,16 @@
|
||||
01|
|
||||
02|~
|
||||
03|~
|
||||
04|~
|
||||
05|~ git-repo/
|
||||
06|~ mocks/
|
||||
07|~ diff-output
|
||||
08|~ file
|
||||
09|~ file1
|
||||
10|~ File2
|
||||
11|~ file3
|
||||
12|~ help-output
|
||||
13|~ log-output
|
||||
04|~ git-repo/
|
||||
05|~ mocks/
|
||||
06|~ deps-confirm
|
||||
07|~ diff-output
|
||||
08|~ file
|
||||
09|~ file1
|
||||
10|~ File2
|
||||
11|~ file3
|
||||
12|~ help-output
|
||||
13|~ log-output
|
||||
14|:Git restore git-rep
|
||||
15|o/
|
||||
|
||||
@ -19,15 +19,15 @@
|
||||
01|00000000000000000000
|
||||
02|11111111111111111111
|
||||
03|11111111111111111111
|
||||
04|11111111111111111111
|
||||
05|11111111222222222222
|
||||
06|11111111333333333333
|
||||
07|11111111333333333333
|
||||
08|11111111333333333333
|
||||
09|11111111333333333333
|
||||
10|11111111333333333333
|
||||
11|11111111333333333333
|
||||
12|11111111333333333333
|
||||
13|11111111333333333333
|
||||
04|11111112222222222222
|
||||
05|11111113333333333333
|
||||
06|11111113333333333333
|
||||
07|11111113333333333333
|
||||
08|11111113333333333333
|
||||
09|11111113333333333333
|
||||
10|11111113333333333333
|
||||
11|11111113333333333333
|
||||
12|11111113333333333333
|
||||
13|11111113333333333333
|
||||
14|44444444444444444444
|
||||
15|44444444444444444444
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
01|
|
||||
02|~
|
||||
03|~
|
||||
04|~
|
||||
05|~ git-repo/
|
||||
06|~ mocks/
|
||||
04|~ git-repo/
|
||||
05|~ mocks/
|
||||
06|~ deps-confirm
|
||||
07|~ diff-output
|
||||
08|~ file
|
||||
09|~ file1
|
||||
@ -19,8 +19,8 @@
|
||||
01|00000000000000000000
|
||||
02|11111111111111111111
|
||||
03|11111111111111111111
|
||||
04|11111111111111111111
|
||||
05|11111112222222222222
|
||||
04|11111112222222222222
|
||||
05|11111113333333333333
|
||||
06|11111113333333333333
|
||||
07|11111113333333333333
|
||||
08|11111113333333333333
|
||||
|
||||
@ -2,16 +2,16 @@
|
||||
01|
|
||||
02|~
|
||||
03|~
|
||||
04|~
|
||||
05|~ git-repo/
|
||||
06|~ mocks/
|
||||
07|~ diff-output
|
||||
08|~ file
|
||||
09|~ file1
|
||||
10|~ File2
|
||||
11|~ file3
|
||||
12|~ help-output
|
||||
13|~ log-output
|
||||
04|~ git-repo/
|
||||
05|~ mocks/
|
||||
06|~ deps-confirm
|
||||
07|~ diff-output
|
||||
08|~ file
|
||||
09|~ file1
|
||||
10|~ File2
|
||||
11|~ file3
|
||||
12|~ help-output
|
||||
13|~ log-output
|
||||
14|:Git diff git-repo/
|
||||
15|
|
||||
|
||||
@ -19,15 +19,15 @@
|
||||
01|00000000000000000000
|
||||
02|11111111111111111111
|
||||
03|11111111111111111111
|
||||
04|11111111111111111111
|
||||
05|11111111222222222222
|
||||
06|11111111333333333333
|
||||
07|11111111333333333333
|
||||
08|11111111333333333333
|
||||
09|11111111333333333333
|
||||
10|11111111333333333333
|
||||
11|11111111333333333333
|
||||
12|11111111333333333333
|
||||
13|11111111333333333333
|
||||
04|11111112222222222222
|
||||
05|11111113333333333333
|
||||
06|11111113333333333333
|
||||
07|11111113333333333333
|
||||
08|11111113333333333333
|
||||
09|11111113333333333333
|
||||
10|11111113333333333333
|
||||
11|11111113333333333333
|
||||
12|11111113333333333333
|
||||
13|11111113333333333333
|
||||
14|44444444444444444444
|
||||
15|44444444444444444444
|
||||
|
||||
@ -2,16 +2,16 @@
|
||||
01|
|
||||
02|~
|
||||
03|~
|
||||
04|~
|
||||
05|~ git-repo/
|
||||
06|~ mocks/
|
||||
07|~ diff-output
|
||||
08|~ file
|
||||
09|~ file1
|
||||
10|~ File2
|
||||
11|~ file3
|
||||
12|~ help-output
|
||||
13|~ log-output
|
||||
04|~ git-repo/
|
||||
05|~ mocks/
|
||||
06|~ deps-confirm
|
||||
07|~ diff-output
|
||||
08|~ file
|
||||
09|~ file1
|
||||
10|~ File2
|
||||
11|~ file3
|
||||
12|~ help-output
|
||||
13|~ log-output
|
||||
14|:Git grep git-repo/
|
||||
15|
|
||||
|
||||
@ -19,15 +19,15 @@
|
||||
01|00000000000000000000
|
||||
02|11111111111111111111
|
||||
03|11111111111111111111
|
||||
04|11111111111111111111
|
||||
05|11111111222222222222
|
||||
06|11111111333333333333
|
||||
07|11111111333333333333
|
||||
08|11111111333333333333
|
||||
09|11111111333333333333
|
||||
10|11111111333333333333
|
||||
11|11111111333333333333
|
||||
12|11111111333333333333
|
||||
13|11111111333333333333
|
||||
04|11111112222222222222
|
||||
05|11111113333333333333
|
||||
06|11111113333333333333
|
||||
07|11111113333333333333
|
||||
08|11111113333333333333
|
||||
09|11111113333333333333
|
||||
10|11111113333333333333
|
||||
11|11111113333333333333
|
||||
12|11111113333333333333
|
||||
13|11111113333333333333
|
||||
14|44444444444444444444
|
||||
15|44444444444444444444
|
||||
|
||||
@ -2,16 +2,16 @@
|
||||
01|
|
||||
02|~
|
||||
03|~
|
||||
04|~
|
||||
05|~ git-repo/
|
||||
06|~ mocks/
|
||||
07|~ diff-output
|
||||
08|~ file
|
||||
09|~ file1
|
||||
10|~ File2
|
||||
11|~ file3
|
||||
12|~ help-output
|
||||
13|~ log-output
|
||||
04|~ git-repo/
|
||||
05|~ mocks/
|
||||
06|~ deps-confirm
|
||||
07|~ diff-output
|
||||
08|~ file
|
||||
09|~ file1
|
||||
10|~ File2
|
||||
11|~ file3
|
||||
12|~ help-output
|
||||
13|~ log-output
|
||||
14|:Git commit git-repo
|
||||
15|/
|
||||
|
||||
@ -19,15 +19,15 @@
|
||||
01|00000000000000000000
|
||||
02|11111111111111111111
|
||||
03|11111111111111111111
|
||||
04|11111111111111111111
|
||||
05|11111111222222222222
|
||||
06|11111111333333333333
|
||||
07|11111111333333333333
|
||||
08|11111111333333333333
|
||||
09|11111111333333333333
|
||||
10|11111111333333333333
|
||||
11|11111111333333333333
|
||||
12|11111111333333333333
|
||||
13|11111111333333333333
|
||||
04|11111112222222222222
|
||||
05|11111113333333333333
|
||||
06|11111113333333333333
|
||||
07|11111113333333333333
|
||||
08|11111113333333333333
|
||||
09|11111113333333333333
|
||||
10|11111113333333333333
|
||||
11|11111113333333333333
|
||||
12|11111113333333333333
|
||||
13|11111113333333333333
|
||||
14|44444444444444444444
|
||||
15|44444444444444444444
|
||||
|
||||
@ -0,0 +1,23 @@
|
||||
--|---------|-----
|
||||
01|aa
|
||||
02|╎ aa
|
||||
03|╎ a a a a a a a
|
||||
04|x a a a a a a a
|
||||
05|x a
|
||||
06|╎ aa
|
||||
07|aa
|
||||
08|~
|
||||
09|<e] [+] 2,2 All
|
||||
10|
|
||||
|
||||
--|---------|-----
|
||||
01|000000000000000
|
||||
02|100000000000000
|
||||
03|100000000000000
|
||||
04|200000000000000
|
||||
05|200000000000000
|
||||
06|100000000000000
|
||||
07|000000000000000
|
||||
08|222222222222222
|
||||
09|333333333333333
|
||||
10|444444444444444
|
||||
@ -8,7 +8,7 @@
|
||||
07|│ │
|
||||
08|│ │
|
||||
09|└ Grep (rg) ───────────────────────── 1|2|2 ┘
|
||||
10|
|
||||
10|Grep pattern: b
|
||||
|
||||
--|---------|---------|---------|---------|---------|---------|---------|
|
||||
01|0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
02|~
|
||||
03|~
|
||||
04|~
|
||||
05|┌> abc▏──────────────────┐
|
||||
06|│ │
|
||||
05|┌pick/real-files/Makefile┐
|
||||
06|│-No-access- │
|
||||
07|│ │
|
||||
08|│ │
|
||||
09|│ │
|
||||
@ -12,7 +12,7 @@
|
||||
11|│ │
|
||||
12|│ │
|
||||
13|│ │
|
||||
14|└ <No name> ─────────────┘
|
||||
14|└ <No name> ────── 1|1|1 ┘
|
||||
15|
|
||||
|
||||
--|---------|---------|---------|---------|
|
||||
@ -20,7 +20,7 @@
|
||||
02|1111111111111111111111111111111111111111
|
||||
03|1111111111111111111111111111111111111111
|
||||
04|1111111111111111111111111111111111111111
|
||||
05|2333333222222222222222222211111111111111
|
||||
05|2333333333333333333333333211111111111111
|
||||
06|2444444444444444444444444211111111111111
|
||||
07|2555555555555555555555555211111111111111
|
||||
08|2555555555555555555555555211111111111111
|
||||
@ -29,5 +29,5 @@
|
||||
11|2555555555555555555555555211111111111111
|
||||
12|2555555555555555555555555211111111111111
|
||||
13|2555555555555555555555555211111111111111
|
||||
14|2666666666662222222222222211111111111111
|
||||
14|2333333333332222223333333211111111111111
|
||||
15|0000000000000000000000000000000000000000
|
||||
@ -13,7 +13,7 @@
|
||||
12|Line 12
|
||||
13|Line 13
|
||||
14|Line 14
|
||||
15| 0,0-1 All
|
||||
15|
|
||||
|
||||
--|---------|---------|---------|---------|
|
||||
01|0000000000000000000000000000000000000000
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
12|~
|
||||
13|~
|
||||
14|~
|
||||
15| 0,0-1 All
|
||||
15|
|
||||
|
||||
--|---------|---------|---------|---------|
|
||||
01|0000000000000000000000000000000000000000
|
||||
|
||||
@ -14,8 +14,7 @@ local get_cursor = function(...) return child.get_cursor(...) end
|
||||
local set_lines = function(...) return child.set_lines(...) end
|
||||
local get_lines = function(...) return child.get_lines(...) end
|
||||
local type_keys = function(...) return child.type_keys(...) end
|
||||
local poke_eventloop = function() child.api.nvim_eval('1') end
|
||||
local sleep = function(ms) vim.loop.sleep(ms); poke_eventloop() end
|
||||
local sleep = function(ms) helpers.sleep(ms, child) end
|
||||
--stylua: ignore end
|
||||
|
||||
local get_latest_message = function() return child.cmd_capture('1messages') end
|
||||
@ -52,6 +51,10 @@ local mock_treesitter_builtin = function() child.cmd('source tests/dir-ai/mock-l
|
||||
|
||||
local mock_treesitter_plugin = function() child.cmd('set rtp+=tests/dir-ai') end
|
||||
|
||||
-- Time constants
|
||||
local helper_message_delay = 1000
|
||||
local small_time = helpers.get_time_const(10)
|
||||
|
||||
-- Output test set
|
||||
local T = new_set({
|
||||
hooks = {
|
||||
@ -148,6 +151,7 @@ local validate_find = function(lines, cursor, args, expected)
|
||||
new_expected = {
|
||||
from = { line = expected[1][1], col = expected[1][2] },
|
||||
to = { line = expected[2][1], col = expected[2][2] },
|
||||
vis_mode = expected.vis_mode,
|
||||
}
|
||||
end
|
||||
|
||||
@ -386,6 +390,20 @@ T['find_textobject()']['handles function as textobject spec']['returns array of
|
||||
child.lua([[MiniAi.config.n_lines = 10]])
|
||||
child.lua([[MiniAi.config.search_method = 'cover']])
|
||||
validate_find(lines, { 1, 4 }, { 'a', 'r' }, nil)
|
||||
|
||||
-- Should account for region `vis_mode`
|
||||
child.lua([[_G.line_regions = function(_, _, _)
|
||||
return {
|
||||
{ from = { line = 1, col = 1 }, to = { line = 2, col = 1 }, vis_mode = 'V' },
|
||||
{ from = { line = 3, col = 1 }, to = { line = 4, col = 1 }, vis_mode = 'V' },
|
||||
}
|
||||
end]])
|
||||
child.lua([[MiniAi.config.custom_textobjects = { m = _G.line_regions }]])
|
||||
|
||||
local ref_region_1 = { { 1, 1 }, { 2, 1 }, vis_mode = 'V' }
|
||||
validate_find({ 'aaa', 'bbb', 'ccc', 'ddd' }, { 1, 0 }, { 'a', 'm' }, ref_region_1)
|
||||
local ref_region_2 = { { 3, 1 }, { 4, 1 }, vis_mode = 'V' }
|
||||
validate_find({ 'aaa', 'bbb', 'ccc', 'ddd' }, { 3, 0 }, { 'a', 'm' }, ref_region_2)
|
||||
end
|
||||
|
||||
T['find_textobject()']['handles function as specification item'] = function()
|
||||
@ -1689,9 +1707,9 @@ T['Textobject']['prompts helper message after one idle second'] = new_set({ para
|
||||
|
||||
-- Both mappings are applied only after `timeoutlen` milliseconds, because
|
||||
-- there are `an`/`in`/`al`/`il` mappings.
|
||||
-- Wait 1000 seconds after that.
|
||||
child.o.timeoutlen = 50
|
||||
local total_wait_time = 1000 + child.o.timeoutlen
|
||||
-- Wait fixed time after that.
|
||||
child.o.timeoutlen = 2 * small_time
|
||||
local total_wait_time = helper_message_delay + child.o.timeoutlen + small_time
|
||||
|
||||
set_lines({ '(aaa)' })
|
||||
set_cursor(1, 1)
|
||||
@ -1766,8 +1784,8 @@ T['Textobject']['respects `config.silent`'] = function()
|
||||
child.o.showcmd = false
|
||||
child.lua('MiniAi.config.silent = true')
|
||||
|
||||
child.o.timeoutlen = 50
|
||||
local total_wait_time = 1000 + child.o.timeoutlen
|
||||
child.o.timeoutlen = 2 * small_time
|
||||
local total_wait_time = helper_message_delay + child.o.timeoutlen + small_time
|
||||
|
||||
set_lines({ '(aaa)' })
|
||||
set_cursor(1, 1)
|
||||
@ -3007,8 +3025,24 @@ T['Custom textobject']['handles function as textobject spec'] = function()
|
||||
child.lua([[MiniAi.config.search_method = 'next']])
|
||||
validate_tobj(lines, { 2, 0 }, 'aL', { { 4, 1 }, { 4, 81 } })
|
||||
|
||||
child.lua([[MiniAi.config.n_lines = 0]])
|
||||
child.lua('MiniAi.config.n_lines = 0')
|
||||
validate_no_tobj(lines, { 2, 0 }, 'aL')
|
||||
|
||||
-- Function which returns region array with `vis_mode` set
|
||||
child.lua([[MiniAi.config.search_method = 'cover']])
|
||||
child.lua('MiniAi.config.n_lines = 50')
|
||||
child.lua([[_G.line_regions = function(_, _, _)
|
||||
return {
|
||||
{ from = { line = 1, col = 1 }, to = { line = 2, col = 1 }, vis_mode = 'V' },
|
||||
{ from = { line = 3, col = 1 }, to = { line = 4, col = 1 }, vis_mode = 'V' },
|
||||
}
|
||||
end]])
|
||||
child.lua('MiniAi.config.custom_textobjects = { m = _G.line_regions }')
|
||||
|
||||
set_lines({ 'aaa', 'bbb', 'ccc', 'ddd' })
|
||||
set_cursor(3, 0)
|
||||
type_keys('d', 'a', 'm')
|
||||
eq(get_lines(), { 'aaa', 'bbb' })
|
||||
end
|
||||
|
||||
T['Custom textobject']['handles function as specification item'] = function()
|
||||
|
||||
@ -13,8 +13,7 @@ local get_cursor = function(...) return child.get_cursor(...) end
|
||||
local set_lines = function(...) return child.set_lines(...) end
|
||||
local get_lines = function(...) return child.get_lines(...) end
|
||||
local type_keys = function(...) return child.type_keys(...) end
|
||||
local poke_eventloop = function() child.api.nvim_eval('1') end
|
||||
local sleep = function(ms) vim.loop.sleep(ms); poke_eventloop() end
|
||||
local sleep = function(ms) helpers.sleep(ms, child) end
|
||||
--stylua: ignore end
|
||||
|
||||
local set_config_steps = function(tbl)
|
||||
@ -51,6 +50,10 @@ local eq_tostring = function(var_name1, var_name2)
|
||||
eq(child.lua_get(cmd), true)
|
||||
end
|
||||
|
||||
-- Time constants
|
||||
local helper_message_delay, error_message_force_delay = 1000, 500
|
||||
local small_time = helpers.get_time_const(10)
|
||||
|
||||
-- Output test set
|
||||
local T = new_set({
|
||||
hooks = {
|
||||
@ -1318,7 +1321,7 @@ T['Align']['does not stop on error during modifier execution'] = function()
|
||||
local before_time = vim.loop.hrtime()
|
||||
type_keys('Vj', 'ga', 'e')
|
||||
local duration = 0.000001 * (vim.loop.hrtime() - before_time)
|
||||
eq(500 <= duration and duration <= 510, true)
|
||||
eq(error_message_force_delay <= duration and duration <= error_message_force_delay + 2 * small_time, true)
|
||||
expect.match(get_latest_message(), '^%(mini.align%) Modifier "e" should be properly callable%. Reason:')
|
||||
end
|
||||
|
||||
@ -1337,6 +1340,7 @@ T['Align']['prompts helper message after one idle second'] = new_set({
|
||||
-- Check this only on Neovim>=0.10, as there is a slight change in
|
||||
-- highlighting command line area
|
||||
if child.fn.has('nvim-0.10') == 0 then return end
|
||||
helpers.skip_if_slow()
|
||||
|
||||
local expect_screenshot = function() child.expect_screenshot({ redraw = false }) end
|
||||
child.set_size(12, 20)
|
||||
@ -1348,7 +1352,7 @@ T['Align']['prompts helper message after one idle second'] = new_set({
|
||||
local keys = test_mode == 'Normal' and { 'ga', 'Vip' } or { 'Vip', 'ga' }
|
||||
type_keys(unpack(keys))
|
||||
|
||||
sleep(1000 - 15)
|
||||
sleep(helper_message_delay - small_time)
|
||||
-- Should show no message
|
||||
expect_screenshot()
|
||||
type_keys('j')
|
||||
@ -1357,10 +1361,10 @@ T['Align']['prompts helper message after one idle second'] = new_set({
|
||||
type_keys('r')
|
||||
-- Should show effect of hitting `r` and redraw if `showmode` is set (which
|
||||
-- it is by default)
|
||||
sleep(1000 - 15)
|
||||
sleep(helper_message_delay - small_time)
|
||||
-- Should still not show helper message
|
||||
expect_screenshot()
|
||||
sleep(15 + 15)
|
||||
sleep(small_time + small_time)
|
||||
-- Should now show helper message
|
||||
expect_screenshot()
|
||||
|
||||
@ -1381,7 +1385,7 @@ T['Align']['helper message does not cause hit-enter-prompt'] = function()
|
||||
set_cursor(1, 0)
|
||||
|
||||
type_keys('ga', 'Vj')
|
||||
sleep(1000)
|
||||
sleep(helper_message_delay + small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
@ -1456,7 +1460,7 @@ T['Align']['respects `config.silent`'] = function()
|
||||
set_cursor(1, 0)
|
||||
type_keys('Vip', 'ga')
|
||||
|
||||
sleep(1000 + 15)
|
||||
sleep(helper_message_delay + small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
|
||||
@ -12,8 +12,7 @@ local set_cursor = function(...) return child.set_cursor(...) end
|
||||
local get_cursor = function(...) return child.get_cursor(...) end
|
||||
local set_lines = function(...) return child.set_lines(...) end
|
||||
local type_keys = function(...) return child.type_keys(...) end
|
||||
local poke_eventloop = function() child.api.nvim_eval('1') end
|
||||
local sleep = function(ms) vim.loop.sleep(ms); poke_eventloop() end
|
||||
local sleep = function(ms) helpers.sleep(ms, child, true) end
|
||||
--stylua: ignore end
|
||||
|
||||
local get_virt_cursor = function()
|
||||
@ -82,11 +81,6 @@ local create_openclose_test_winconfig = function()
|
||||
end
|
||||
|
||||
-- Data =======================================================================
|
||||
local test_times = { total_timing = 250 }
|
||||
|
||||
local step_time = 40
|
||||
local small_time = 5
|
||||
|
||||
--stylua: ignore
|
||||
local example_scroll_lines = {
|
||||
'aaaa', 'bbbb', 'cccc', 'dddd', 'eeee',
|
||||
@ -101,12 +95,19 @@ local example_scroll_lines_2 = {
|
||||
'KKKK', 'LLLL', 'MMMM', 'NNNN', 'OOOO',
|
||||
}
|
||||
|
||||
-- Time constants
|
||||
local default_total_time = 250
|
||||
local step_time = helpers.get_time_const(40)
|
||||
local small_time = helpers.get_time_const(10)
|
||||
|
||||
-- Output test set ============================================================
|
||||
local T = new_set({
|
||||
hooks = {
|
||||
pre_case = function()
|
||||
child.setup()
|
||||
load_module()
|
||||
|
||||
child.lua('_G.step_time, _G.small_time = ' .. step_time .. ', ' .. small_time)
|
||||
end,
|
||||
post_once = child.stop,
|
||||
},
|
||||
@ -203,8 +204,8 @@ T['setup()']['validates `config` argument'] = function()
|
||||
expect_config_error({ close = { winblend = 'a' } }, 'close.winblend', 'callable')
|
||||
end
|
||||
|
||||
T['setup()']['defines non-linked default highlighting on `ColorScheme`'] = function()
|
||||
child.cmd('colorscheme blue')
|
||||
T['setup()']['ensures colors'] = function()
|
||||
child.cmd('colorscheme default')
|
||||
expect.match(child.cmd_capture('hi MiniAnimateCursor'), 'gui=reverse,nocombine')
|
||||
end
|
||||
|
||||
@ -219,9 +220,9 @@ T['is_active()']['works for `cursor`'] = function()
|
||||
set_cursor(1, 0)
|
||||
type_keys('2j')
|
||||
eq(is_active('cursor'), true)
|
||||
sleep(test_times.total_timing - 20)
|
||||
sleep(default_total_time - small_time)
|
||||
eq(is_active('cursor'), true)
|
||||
sleep(20 + 10)
|
||||
sleep(small_time + 3 * small_time)
|
||||
eq(is_active('cursor'), false)
|
||||
end
|
||||
|
||||
@ -232,9 +233,9 @@ T['is_active()']['works for `scroll`'] = function()
|
||||
set_cursor(1, 0)
|
||||
type_keys('<C-f>')
|
||||
eq(is_active('scroll'), true)
|
||||
sleep(test_times.total_timing - 20)
|
||||
sleep(default_total_time - small_time)
|
||||
eq(is_active('scroll'), true)
|
||||
sleep(20 + 10)
|
||||
sleep(small_time + 3 * small_time)
|
||||
eq(is_active('scroll'), false)
|
||||
end
|
||||
|
||||
@ -243,9 +244,9 @@ T['is_active()']['works for `resize`'] = function()
|
||||
|
||||
type_keys('<C-w>v', '<C-w>|')
|
||||
eq(is_active('resize'), true)
|
||||
sleep(test_times.total_timing - 20)
|
||||
sleep(default_total_time - small_time)
|
||||
eq(is_active('resize'), true)
|
||||
sleep(20 + 20)
|
||||
sleep(small_time + 3 * small_time)
|
||||
eq(is_active('resize'), false)
|
||||
end
|
||||
|
||||
@ -256,20 +257,20 @@ T['is_active()']['works for `open`/`close`'] = function()
|
||||
type_keys('<C-w>v')
|
||||
eq(is_active('open'), true)
|
||||
eq(is_active('close'), false)
|
||||
sleep(test_times.total_timing - 20)
|
||||
sleep(default_total_time - small_time)
|
||||
eq(is_active('open'), true)
|
||||
eq(is_active('close'), false)
|
||||
sleep(20 + 10)
|
||||
sleep(small_time + 3 * small_time)
|
||||
eq(is_active('open'), false)
|
||||
eq(is_active('close'), false)
|
||||
|
||||
child.cmd('quit')
|
||||
eq(is_active('open'), false)
|
||||
eq(is_active('close'), true)
|
||||
sleep(test_times.total_timing - 20)
|
||||
sleep(default_total_time - small_time)
|
||||
eq(is_active('open'), false)
|
||||
eq(is_active('close'), true)
|
||||
sleep(20 + 10)
|
||||
sleep(small_time + 3 * small_time)
|
||||
eq(is_active('open'), false)
|
||||
eq(is_active('close'), false)
|
||||
end
|
||||
@ -296,9 +297,9 @@ T['execute_after()']['works after animation is done'] = function()
|
||||
|
||||
type_keys('n')
|
||||
eq(child.g.been_here, vim.NIL)
|
||||
sleep(test_times.total_timing - 20)
|
||||
sleep(default_total_time - small_time)
|
||||
eq(child.g.been_here, vim.NIL)
|
||||
sleep(20 + 10)
|
||||
sleep(small_time + small_time)
|
||||
eq(child.g.been_here, true)
|
||||
end
|
||||
|
||||
@ -317,28 +318,28 @@ T['animate()'] = new_set()
|
||||
T['animate()']['works'] = function()
|
||||
child.lua('_G.action_history = {}')
|
||||
child.lua('_G.step_action = function(step) table.insert(_G.action_history, step); return step < 3 end')
|
||||
child.lua('_G.step_timing = function(step) return 25 * step end')
|
||||
child.lua('_G.step_timing = function(step) return _G.step_time * step end')
|
||||
|
||||
child.lua([[MiniAnimate.animate(_G.step_action, _G.step_timing)]])
|
||||
-- It should execute the following order:
|
||||
-- Action (step 0) - wait (step 1) - action (step 1) - ...
|
||||
-- So here it should be:
|
||||
-- So here it should be (with `step_time = 25`):
|
||||
-- 0 ms - `action(0)`
|
||||
-- 25(=`timing(1)`) ms - `action(1)`
|
||||
-- 75 ms - `action(2)`
|
||||
-- 150 ms - `action(3)` and stop
|
||||
eq(child.lua_get('_G.action_history'), { 0 })
|
||||
sleep(25 - small_time)
|
||||
sleep(step_time - small_time)
|
||||
eq(child.lua_get('_G.action_history'), { 0 })
|
||||
sleep(small_time)
|
||||
eq(child.lua_get('_G.action_history'), { 0, 1 })
|
||||
|
||||
sleep(50 - small_time)
|
||||
sleep(2 * step_time - small_time)
|
||||
eq(child.lua_get('_G.action_history'), { 0, 1 })
|
||||
sleep(small_time)
|
||||
eq(child.lua_get('_G.action_history'), { 0, 1, 2 })
|
||||
|
||||
sleep(75 - small_time)
|
||||
sleep(3 * step_time - small_time)
|
||||
eq(child.lua_get('_G.action_history'), { 0, 1, 2 })
|
||||
sleep(small_time)
|
||||
eq(child.lua_get('_G.action_history'), { 0, 1, 2, 3 })
|
||||
@ -346,8 +347,8 @@ end
|
||||
|
||||
T['animate()']['respects `opts.max_steps`'] = function()
|
||||
child.lua('_G.step_action = function(step) _G.latest_step = step; return step < 1000 end')
|
||||
child.lua('MiniAnimate.animate(_G.step_action, function() return 10 end, { max_steps = 2 })')
|
||||
sleep(10 * 2 + 5)
|
||||
child.lua('MiniAnimate.animate(_G.step_action, function() return _G.step_time end, { max_steps = 2 })')
|
||||
sleep(step_time * 2 + small_time)
|
||||
eq(child.lua_get('_G.latest_step'), 2)
|
||||
end
|
||||
|
||||
@ -356,18 +357,20 @@ T['animate()']['handles step times less than 1 ms'] = function()
|
||||
child.lua('MiniAnimate.animate(_G.step_action, function() return 0.1 end)')
|
||||
|
||||
-- All steps should be executed almost immediately (respectnig `libuv` loops)
|
||||
poke_eventloop()
|
||||
poke_eventloop()
|
||||
poke_eventloop()
|
||||
child.poke_eventloop()
|
||||
child.poke_eventloop()
|
||||
child.poke_eventloop()
|
||||
eq(child.lua_get('_G.latest_step'), 3)
|
||||
end
|
||||
|
||||
T['animate()']['handles non-integer step times'] = function()
|
||||
local new_step_time = 0.91 * step_time
|
||||
child.lua('_G.new_step_time = ' .. new_step_time)
|
||||
-- It should accumulate fractional parts, not discard them
|
||||
child.lua('_G.step_action = function(step) _G.latest_step = step; return step < 10 end')
|
||||
child.lua('MiniAnimate.animate(_G.step_action, function() return 1.9 end)')
|
||||
child.lua('MiniAnimate.animate(_G.step_action, function() return _G.new_step_time end)')
|
||||
|
||||
sleep(19 - small_time)
|
||||
sleep(10 * new_step_time - small_time)
|
||||
eq(child.lua_get('_G.latest_step') < 10, true)
|
||||
|
||||
sleep(small_time + small_time)
|
||||
@ -1263,7 +1266,7 @@ T['Cursor']['stops on buffer change'] = function()
|
||||
|
||||
set_cursor(5, 0)
|
||||
child.expect_screenshot()
|
||||
sleep(step_time + small_time)
|
||||
sleep(step_time)
|
||||
child.expect_screenshot()
|
||||
sleep(step_time)
|
||||
child.expect_screenshot()
|
||||
@ -1313,10 +1316,10 @@ T['Cursor']['correctly calls `timing`'] = function()
|
||||
child.lua('_G.args_history = {}')
|
||||
child.lua([[MiniAnimate.config.cursor.timing = function(s, n)
|
||||
table.insert(_G.args_history, { s = s, n = n })
|
||||
return 10
|
||||
return _G.step_time
|
||||
end]])
|
||||
set_cursor(5, 0)
|
||||
sleep(10 * 5)
|
||||
sleep(step_time * 5 + small_time)
|
||||
eq(child.lua_get('_G.args_history'), { { s = 1, n = 4 }, { s = 2, n = 4 }, { s = 3, n = 4 }, { s = 4, n = 4 } })
|
||||
end
|
||||
|
||||
@ -1811,14 +1814,14 @@ T['Scroll']["does not automatically animate result of 'incsearch'"] = function()
|
||||
-- Should work for search with `/`
|
||||
type_keys('/', 'oo', '<CR>')
|
||||
child.expect_screenshot()
|
||||
sleep(step_time + 10)
|
||||
sleep(step_time + small_time)
|
||||
-- Should be the same
|
||||
child.expect_screenshot()
|
||||
|
||||
-- Should work for search with `?`
|
||||
type_keys('?', 'aa', '<CR>')
|
||||
child.expect_screenshot()
|
||||
sleep(step_time + 10)
|
||||
sleep(step_time + small_time)
|
||||
-- Should be the same
|
||||
child.expect_screenshot()
|
||||
end
|
||||
@ -1867,7 +1870,7 @@ end
|
||||
|
||||
T['Scroll']['works with different keys']['zb'] = function()
|
||||
type_keys('2<C-e>')
|
||||
sleep(step_time * 2 + 10)
|
||||
sleep(step_time * 2 + small_time)
|
||||
set_cursor(6, 0)
|
||||
validate_topline(3)
|
||||
|
||||
@ -1927,7 +1930,8 @@ T['Scroll']['works with different keys']['G'] = function()
|
||||
sleep(step_time)
|
||||
validate_topline(3)
|
||||
|
||||
sleep(step_time * 6 + 2)
|
||||
sleep(small_time)
|
||||
sleep(step_time * 6)
|
||||
validate_topline(9)
|
||||
sleep(step_time)
|
||||
validate_topline(10)
|
||||
@ -1948,11 +1952,11 @@ T['Scroll']['correctly calls `timing`'] = function()
|
||||
child.lua('_G.args_history = {}')
|
||||
child.lua([[MiniAnimate.config.scroll.timing = function(s, n)
|
||||
table.insert(_G.args_history, { s = s, n = n })
|
||||
return 10
|
||||
return _G.step_time
|
||||
end]])
|
||||
|
||||
type_keys('4<C-e>')
|
||||
sleep(10 * 4 + 5)
|
||||
sleep(step_time * 4 + small_time)
|
||||
eq(child.lua_get('_G.args_history'), { { s = 1, n = 4 }, { s = 2, n = 4 }, { s = 3, n = 4 }, { s = 4, n = 4 } })
|
||||
end
|
||||
|
||||
@ -2195,11 +2199,11 @@ T['Resize']['correctly calls `timing`'] = function()
|
||||
child.lua('_G.args_history = {}')
|
||||
child.lua([[MiniAnimate.config.resize.timing = function(s, n)
|
||||
table.insert(_G.args_history, { s = s, n = n })
|
||||
return 10
|
||||
return _G.step_time
|
||||
end]])
|
||||
|
||||
type_keys('<C-w>|')
|
||||
sleep(10 * 5 + 5)
|
||||
sleep(step_time * 5 + small_time)
|
||||
eq(
|
||||
child.lua_get('_G.args_history'),
|
||||
{ { s = 1, n = 5 }, { s = 2, n = 5 }, { s = 3, n = 5 }, { s = 4, n = 5 }, { s = 5, n = 5 } }
|
||||
@ -2333,7 +2337,7 @@ T['Open']['works for a new tabpage'] = function()
|
||||
validate_floats({
|
||||
[win_id] = { relative = 'editor', row = 1, col = 0, width = 12, height = 5, winblend = 80 },
|
||||
})
|
||||
sleep(2 * 20)
|
||||
sleep(2 * small_time)
|
||||
child.cmd('tabclose')
|
||||
|
||||
-- Should also work second time (testing correct usage of tabpage number)
|
||||
@ -2391,11 +2395,11 @@ T['Open']['correctly calls `timing`'] = function()
|
||||
child.lua('_G.args_history = {}')
|
||||
child.lua([[MiniAnimate.config.open.timing = function(s, n)
|
||||
table.insert(_G.args_history, { s = s, n = n })
|
||||
return 10
|
||||
return _G.step_time
|
||||
end]])
|
||||
|
||||
child.cmd('wincmd v')
|
||||
sleep(10 * 2 + 5)
|
||||
sleep(step_time * 2 + small_time)
|
||||
eq(child.lua_get('_G.args_history'), { { s = 1, n = 2 }, { s = 2, n = 2 } })
|
||||
end
|
||||
|
||||
@ -2527,12 +2531,12 @@ T['Close']['correctly calls `timing`'] = function()
|
||||
child.lua('_G.args_history = {}')
|
||||
child.lua([[MiniAnimate.config.close.timing = function(s, n)
|
||||
table.insert(_G.args_history, { s = s, n = n })
|
||||
return 10
|
||||
return _G.step_time
|
||||
end]])
|
||||
|
||||
child.cmd('wincmd v')
|
||||
child.cmd('close')
|
||||
sleep(10 * 2 + 5)
|
||||
sleep(step_time * 2 + small_time)
|
||||
eq(child.lua_get('_G.args_history'), { { s = 1, n = 2 }, { s = 2, n = 2 } })
|
||||
end
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ local new_set = MiniTest.new_set
|
||||
|
||||
local path_sep = package.config:sub(1, 1)
|
||||
local project_root = vim.fn.fnamemodify(vim.fn.getcwd(), ':p')
|
||||
local dir_bracketed_path = project_root .. 'tests/dir-bracketed/'
|
||||
local dir_bracketed_path = project_root .. 'tests' .. path_sep .. 'dir-bracketed'
|
||||
|
||||
-- Helpers with child processes
|
||||
--stylua: ignore start
|
||||
@ -1219,7 +1219,7 @@ local validate_file = function(id_start, direction, id_ref, opts)
|
||||
end
|
||||
|
||||
T['file()']['works'] = function()
|
||||
eq(child.fn.getcwd() .. '/', project_root)
|
||||
eq(child.fn.getcwd() .. path_sep, project_root)
|
||||
|
||||
-- Should traverse files alphabetically in directory of currently opened file
|
||||
validate_works(validate_file, #test_files)
|
||||
@ -2306,6 +2306,33 @@ T['treesitter()']['works'] = function()
|
||||
end
|
||||
end
|
||||
|
||||
T['treesitter()']['sets cursor safely'] = function()
|
||||
child.lua([[
|
||||
if vim.fn.has('nvim-0.9') == 1 then
|
||||
vim.treesitter.get_node = function() return _G.node end
|
||||
else
|
||||
vim.treesitter.get_node_at_pos = function() return _G.node end
|
||||
end
|
||||
]])
|
||||
set_lines({ 'aaa' })
|
||||
|
||||
-- Before start
|
||||
child.lua([[_G.node = {
|
||||
start = function() return -1, 0 end,
|
||||
end_ = function() return 1, 0 end,
|
||||
range = function() return -1, 0, 1, 0 end,
|
||||
parent = function() return _G.node end,
|
||||
}]])
|
||||
|
||||
set_cursor(1, 1)
|
||||
backward('treesitter')
|
||||
eq(get_cursor(), { 1, 0 })
|
||||
|
||||
set_cursor(1, 1)
|
||||
forward('treesitter')
|
||||
eq(get_cursor(), { 1, 2 })
|
||||
end
|
||||
|
||||
T['treesitter()']['moves to other edge of current node'] = function()
|
||||
local nodes, validate, _ = setup_treesitter()
|
||||
local n = #nodes
|
||||
|
||||
@ -12,8 +12,7 @@ local get_cursor = function(...) return child.get_cursor(...) end
|
||||
local set_lines = function(...) return child.set_lines(...) end
|
||||
local get_lines = function(...) return child.get_lines(...) end
|
||||
local type_keys = function(...) return child.type_keys(...) end
|
||||
local poke_eventloop = function() child.api.nvim_eval('1') end
|
||||
local sleep = function(ms) vim.loop.sleep(ms); poke_eventloop() end
|
||||
local sleep = function(ms) helpers.sleep(ms, child) end
|
||||
--stylua: ignore end
|
||||
|
||||
local get_window = function() return child.api.nvim_get_current_win() end
|
||||
@ -159,7 +158,9 @@ local mock_comment_operators = function()
|
||||
]])
|
||||
end
|
||||
|
||||
-- Data =======================================================================
|
||||
-- Time constants
|
||||
local default_delay, postkeys_check_delay, redraw_interval = 1000, 50, 50
|
||||
local small_time = helpers.get_time_const(10)
|
||||
|
||||
-- Output test set ============================================================
|
||||
local T = new_set({
|
||||
@ -234,6 +235,12 @@ T['setup()']['validates `config` argument'] = function()
|
||||
expect_config_error({ window = { scroll_up = 1 } }, 'window.scroll_up', 'string')
|
||||
end
|
||||
|
||||
T['setup()']['ensures colors'] = function()
|
||||
load_module()
|
||||
child.cmd('colorscheme default')
|
||||
expect.match(child.cmd_capture('hi MiniClueBorder'), 'links to FloatBorder')
|
||||
end
|
||||
|
||||
T['setup()']['creates mappings for `@` and `Q`'] = function()
|
||||
load_module()
|
||||
expect.match(child.lua_get("vim.fn.maparg('@', 'n', false, true).desc"), 'macro.*mini%.clue')
|
||||
@ -1182,38 +1189,42 @@ end
|
||||
T['Showing keys'] = new_set({ hooks = { pre_case = function() child.set_size(10, 40) end } })
|
||||
|
||||
T['Showing keys']['works'] = function()
|
||||
helpers.skip_if_slow()
|
||||
|
||||
make_test_map('n', '<Space>aa')
|
||||
make_test_map('n', '<Space>ab')
|
||||
load_module({ triggers = { { mode = 'n', keys = '<Space>' } } })
|
||||
|
||||
-- Window should be shown after debounced delay
|
||||
type_keys(' ')
|
||||
sleep(980)
|
||||
sleep(default_delay - small_time)
|
||||
child.expect_screenshot()
|
||||
|
||||
type_keys('a')
|
||||
sleep(980)
|
||||
sleep(default_delay - small_time)
|
||||
child.expect_screenshot()
|
||||
sleep(20 + 5)
|
||||
sleep(small_time + small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
T['Showing keys']['respects `config.window.delay`'] = function()
|
||||
helpers.skip_if_slow()
|
||||
|
||||
make_test_map('n', '<Space>aa')
|
||||
make_test_map('n', '<Space>ab')
|
||||
load_module({
|
||||
triggers = { { mode = 'n', keys = '<Space>' } },
|
||||
window = { delay = 30 },
|
||||
window = { delay = 0.5 * default_delay },
|
||||
})
|
||||
|
||||
type_keys(' ')
|
||||
sleep(20)
|
||||
sleep(0.5 * default_delay - small_time)
|
||||
child.expect_screenshot()
|
||||
|
||||
type_keys('a')
|
||||
sleep(20)
|
||||
sleep(0.5 * default_delay - small_time)
|
||||
child.expect_screenshot()
|
||||
sleep(10 + 5)
|
||||
sleep(small_time + small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
@ -1549,6 +1560,7 @@ T['Showing keys']['works with multibyte characters'] = function()
|
||||
|
||||
type_keys(' ')
|
||||
child.expect_screenshot()
|
||||
helpers.skip_on_windows('Windows has different collation order')
|
||||
type_keys('э')
|
||||
child.expect_screenshot()
|
||||
end
|
||||
@ -1556,14 +1568,14 @@ end
|
||||
T['Showing keys']['works in Command-line window'] = function()
|
||||
make_test_map('n', '<Space>f')
|
||||
load_module({ triggers = { { mode = 'n', keys = '<Space>' } }, window = { delay = 0 } })
|
||||
child.o.timeoutlen = 5
|
||||
child.o.timeoutlen = small_time
|
||||
|
||||
type_keys('q:')
|
||||
type_keys(' ')
|
||||
|
||||
child.expect_screenshot()
|
||||
|
||||
sleep(5 + 5)
|
||||
sleep(small_time + small_time)
|
||||
type_keys('f')
|
||||
|
||||
-- Closing floating window is allowed only on Neovim>=0.10.
|
||||
@ -1922,8 +1934,7 @@ T['Postkeys']['closes window if postkeys do not end up key querying'] = function
|
||||
})
|
||||
|
||||
type_keys(' ', 'a')
|
||||
-- 50 ms is a hardcoded check delay
|
||||
sleep(50 + 5)
|
||||
sleep(postkeys_check_delay + small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
@ -1981,11 +1992,11 @@ T['Querying keys']['does not entirely block redraws'] = function()
|
||||
|
||||
type_keys('<Space>', 'f')
|
||||
-- - Redraws don't happen immediately but inside a repeating timer
|
||||
sleep(50 + 5)
|
||||
sleep(redraw_interval + small_time)
|
||||
child.expect_screenshot()
|
||||
|
||||
type_keys('f')
|
||||
sleep(50 + 5)
|
||||
sleep(redraw_interval + small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
@ -2007,9 +2018,9 @@ T['Querying keys']["does not time out after 'timeoutlen'"] = function()
|
||||
load_module({ triggers = { { mode = 'n', keys = '<Space>' } } })
|
||||
|
||||
-- Should wait for next key as there are still multiple clues available
|
||||
child.o.timeoutlen = 10
|
||||
child.o.timeoutlen = small_time
|
||||
type_keys(' ', 'f')
|
||||
sleep(20)
|
||||
sleep(2 * small_time)
|
||||
eq(get_test_map_count('n', ' f'), 0)
|
||||
end
|
||||
|
||||
@ -2037,9 +2048,9 @@ T['Querying keys']['respects `<CR>`'] = function()
|
||||
validate_trigger_keymap('n', '<Space>')
|
||||
|
||||
-- `<CR>` should execute current query
|
||||
child.o.timeoutlen = 10
|
||||
child.o.timeoutlen = small_time
|
||||
type_keys(' ', 'f', '<CR>')
|
||||
sleep(15)
|
||||
sleep(small_time + small_time)
|
||||
eq(get_test_map_count('n', ' f'), 1)
|
||||
end
|
||||
|
||||
@ -2109,9 +2120,9 @@ T['Querying keys']['allows reaching longest keymap'] = function()
|
||||
load_module({ triggers = { { mode = 'n', keys = '<Space>' } } })
|
||||
validate_trigger_keymap('n', '<Space>')
|
||||
|
||||
child.o.timeoutlen = 5
|
||||
child.o.timeoutlen = small_time
|
||||
type_keys(' ', 'f', 'f')
|
||||
sleep(10)
|
||||
sleep(small_time + small_time)
|
||||
type_keys('f')
|
||||
eq(get_test_map_count('n', ' f'), 0)
|
||||
eq(get_test_map_count('n', ' fff'), 1)
|
||||
@ -2841,7 +2852,7 @@ T['Reproducing keys']['works for builtin keymaps in Terminal mode'] = function()
|
||||
child.cmd('wincmd v')
|
||||
child.cmd('terminal')
|
||||
-- Wait for terminal to load
|
||||
vim.loop.sleep(100)
|
||||
vim.loop.sleep(6 * small_time)
|
||||
child.cmd('startinsert')
|
||||
eq(child.fn.mode(), 't')
|
||||
|
||||
@ -2860,7 +2871,7 @@ T['Reproducing keys']['works for user keymaps in Terminal mode'] = function()
|
||||
child.cmd('wincmd v')
|
||||
child.cmd('terminal')
|
||||
-- Wait for terminal to load
|
||||
vim.loop.sleep(100)
|
||||
vim.loop.sleep(6 * small_time)
|
||||
child.cmd('startinsert')
|
||||
eq(child.fn.mode(), 't')
|
||||
|
||||
|
||||
@ -12,16 +12,15 @@ local colors_path = dir_path .. '/colors/'
|
||||
local load_module = function(config) child.mini_load('colors', config) end
|
||||
local unload_module = function(config) child.mini_unload('colors', config) end
|
||||
local type_keys = function(...) return child.type_keys(...) end
|
||||
local poke_eventloop = function() child.api.nvim_eval('1') end
|
||||
local sleep = function(ms) vim.loop.sleep(ms); poke_eventloop() end
|
||||
local sleep = function(ms) helpers.sleep(ms, child) end
|
||||
--stylua: ignore end
|
||||
|
||||
-- Mock test color scheme
|
||||
local mock_cs = function() child.cmd('set rtp+=' .. dir_path .. 'mock_cs/') end
|
||||
|
||||
-- Data =======================================================================
|
||||
-- Small time used to reduce test flackiness
|
||||
local small_time = 15
|
||||
-- Time constants
|
||||
local default_transition_duration, default_show_duration = 1000, 1000
|
||||
local small_time = helpers.get_time_const(10)
|
||||
|
||||
-- Output test set ============================================================
|
||||
local T = new_set({
|
||||
@ -1313,7 +1312,7 @@ end
|
||||
T['as_colorscheme() methods']['write()'] = new_set({
|
||||
hooks = {
|
||||
pre_case = function()
|
||||
local lua_cmd = string.format([[vim.fn.stdpath = function() return '%s' end]], dir_path)
|
||||
local lua_cmd = string.format([[vim.fn.stdpath = function() return %s end]], vim.inspect(dir_path))
|
||||
child.lua(lua_cmd)
|
||||
|
||||
-- Add to `rtp` to be able to discrove color schemes
|
||||
@ -1381,7 +1380,9 @@ T['as_colorscheme() methods']['write()']['makes unique color scheme name'] = fun
|
||||
|
||||
local files = child.fn.readdir(colors_path)
|
||||
eq(#files, 1)
|
||||
-- File name should add timestamp suffix in case of duplicated name
|
||||
-- File name should add timestamp suffix in case of duplicated name, but
|
||||
-- doesn't work on Windows
|
||||
helpers.skip_on_windows('`vim.fn.strftime()` does not work on Windows')
|
||||
expect.match(files[1], 'mock_cs_%d%d%d%d%d%d%d%d_%d%d%d%d%d%d%.lua')
|
||||
end
|
||||
|
||||
@ -1432,7 +1433,7 @@ T['as_colorscheme() methods']['write()']['respects `opts.directory`'] = function
|
||||
groups = { Normal = { fg = '#ffffff' } }
|
||||
})]])
|
||||
|
||||
local write_cmd = string.format([[_G.cs:write({ directory = '%s' })]], inner_dir)
|
||||
local write_cmd = '_G.cs:write({ directory = ' .. vim.inspect(inner_dir) .. ' })'
|
||||
child.lua(write_cmd)
|
||||
|
||||
eq(child.fn.filereadable(inner_dir .. 'my_cs.lua'), 1)
|
||||
@ -1609,6 +1610,10 @@ T['animate()'] = new_set({
|
||||
}
|
||||
}
|
||||
end]])
|
||||
|
||||
-- Create reference duration values
|
||||
child.lua('_G.default_transition_duration = ' .. default_transition_duration)
|
||||
child.lua('_G.default_show_duration = ' .. default_show_duration)
|
||||
end,
|
||||
},
|
||||
})
|
||||
@ -1629,6 +1634,8 @@ end
|
||||
|
||||
--stylua: ignore
|
||||
T['animate()']['works'] = function()
|
||||
helpers.skip_if_slow()
|
||||
|
||||
local validate_init = function()
|
||||
local cur_cs = child.lua_get('_G.get_relevant_cs_data()')
|
||||
eq(cur_cs.name, 'cs_1')
|
||||
@ -1676,7 +1683,7 @@ T['animate()']['works'] = function()
|
||||
)
|
||||
end
|
||||
|
||||
sleep(500 - small_time)
|
||||
sleep(0.5 * default_transition_duration - small_time)
|
||||
validate_before_half()
|
||||
|
||||
-- Check slightly after half-way
|
||||
@ -1708,7 +1715,7 @@ T['animate()']['works'] = function()
|
||||
)
|
||||
end
|
||||
|
||||
sleep(2 * small_time)
|
||||
sleep(3 * small_time)
|
||||
validate_after_half()
|
||||
|
||||
-- After first transition end it should show intermediate step for 1 second
|
||||
@ -1723,56 +1730,60 @@ T['animate()']['works'] = function()
|
||||
eq(child.g.terminal_color_15, '#000000')
|
||||
end
|
||||
|
||||
sleep(500)
|
||||
sleep(0.5 * default_transition_duration)
|
||||
validate_intermediate()
|
||||
|
||||
sleep(1000 - 2 * small_time)
|
||||
sleep(default_show_duration - 3 * small_time)
|
||||
validate_intermediate()
|
||||
|
||||
-- After showing period it should start transition back to first one (as it
|
||||
-- was specially designed command)
|
||||
sleep(500)
|
||||
sleep(0.5 * default_transition_duration)
|
||||
validate_after_half()
|
||||
|
||||
sleep(2 * small_time)
|
||||
sleep(3 * small_time)
|
||||
validate_before_half()
|
||||
|
||||
sleep(500 - small_time)
|
||||
sleep(0.5 * default_transition_duration)
|
||||
validate_init()
|
||||
end
|
||||
|
||||
T['animate()']['respects `opts.transition_steps`'] = function()
|
||||
helpers.skip_if_slow()
|
||||
|
||||
child.lua('_G.cs_1:apply()')
|
||||
child.lua([[MiniColors.animate({ _G.cs_2 }, { transition_steps = 2 })]])
|
||||
|
||||
sleep(500 - small_time - 10)
|
||||
sleep(0.5 * default_transition_duration - 2 * small_time)
|
||||
eq(is_cs_1(), true)
|
||||
|
||||
sleep(2 * small_time + 10)
|
||||
sleep(2 * small_time + small_time)
|
||||
eq(child.lua_get('_G.get_relevant_cs_data().groups.Normal.fg'), '#050000')
|
||||
|
||||
sleep(500 - small_time)
|
||||
sleep(0.5 * default_transition_duration - small_time)
|
||||
eq(is_cs_2(), true)
|
||||
end
|
||||
|
||||
T['animate()']['respects `opts.transition_duration`'] = function()
|
||||
child.lua([[MiniColors.animate({ _G.cs_2 }, { transition_duration = 500 })]])
|
||||
helpers.skip_if_slow()
|
||||
|
||||
sleep(500 + small_time)
|
||||
child.lua([[MiniColors.animate({ _G.cs_2 }, { transition_duration = 0.5 * default_transition_duration })]])
|
||||
sleep(0.5 * default_transition_duration + 2 * small_time)
|
||||
eq(is_cs_2(), true)
|
||||
end
|
||||
|
||||
T['animate()']['respects `opts.show_duration`'] = function()
|
||||
child.lua([[MiniColors.animate({ _G.cs_1, _G.cs_2 }, { show_duration = 100 })]])
|
||||
helpers.skip_if_slow()
|
||||
|
||||
sleep(1000 + small_time)
|
||||
child.lua([[MiniColors.animate({ _G.cs_1, _G.cs_2 }, { show_duration = 0.5 * default_show_duration })]])
|
||||
sleep(default_transition_duration + small_time)
|
||||
eq(is_cs_1(), true)
|
||||
|
||||
sleep(100 - 2 * small_time)
|
||||
sleep(0.5 * default_show_duration - 3 * small_time)
|
||||
eq(is_cs_1(), true)
|
||||
|
||||
-- Account that first step takes 40 ms
|
||||
sleep(small_time + 40 + 10)
|
||||
-- Account that first step takes some time
|
||||
sleep(3 * small_time + 2 * small_time)
|
||||
eq(is_cs_1(), false)
|
||||
end
|
||||
|
||||
@ -2205,22 +2216,24 @@ T[':Colorscheme']['works'] = function()
|
||||
|
||||
child.cmd('hi Normal guifg=#ffffff')
|
||||
type_keys(':Colorscheme mock_cs<CR>')
|
||||
sleep(1000 + small_time)
|
||||
sleep(default_transition_duration + 3 * small_time)
|
||||
expect.match(child.cmd_capture('hi Normal'), 'guifg=#5f87af')
|
||||
end
|
||||
|
||||
T[':Colorscheme']['accepts several arguments'] = function()
|
||||
helpers.skip_if_slow()
|
||||
|
||||
child.cmd('colorscheme blue')
|
||||
mock_cs()
|
||||
type_keys(':Colorscheme mock_cs blue<CR>')
|
||||
|
||||
sleep(1000 + small_time)
|
||||
sleep(default_transition_duration + small_time)
|
||||
expect.match(child.cmd_capture('hi Normal'), 'guifg=#5f87af')
|
||||
|
||||
sleep(1000 - 2 * small_time)
|
||||
sleep(default_show_duration - 2 * small_time)
|
||||
expect.match(child.cmd_capture('hi Normal'), 'guifg=#5f87af')
|
||||
|
||||
sleep(1000 + 2 * small_time)
|
||||
sleep(default_transition_duration + 2 * small_time)
|
||||
local blue_normal_fg = '#ffd700'
|
||||
expect.match(child.cmd_capture('hi Normal'), 'guifg=' .. blue_normal_fg)
|
||||
end
|
||||
@ -2236,7 +2249,7 @@ T['interactive()'] = new_set()
|
||||
|
||||
T['interactive()']['works'] = function()
|
||||
-- - Mock '~/.config/nvim'
|
||||
local lua_cmd = string.format([[vim.fn.stdpath = function() return '%s' end]], dir_path)
|
||||
local lua_cmd = 'vim.fn.stdpath = function() return ' .. vim.inspect(dir_path) .. ' end'
|
||||
child.lua(lua_cmd)
|
||||
child.cmd('set rtp+=' .. dir_path)
|
||||
MiniTest.finally(function() vim.fn.delete(colors_path, 'rf') end)
|
||||
|
||||
@ -16,12 +16,20 @@ local get_cursor = function(...) return child.get_cursor(...) end
|
||||
local set_lines = function(...) return child.set_lines(...) end
|
||||
local get_lines = function(...) return child.get_lines(...) end
|
||||
local type_keys = function(...) return child.type_keys(...) end
|
||||
local poke_eventloop = function() child.api.nvim_eval('1') end
|
||||
local sleep = function(ms) vim.loop.sleep(ms); poke_eventloop() end
|
||||
local sleep = function(ms) helpers.sleep(ms, child, true) end
|
||||
local mock_lsp = function() child.cmd('luafile tests/dir-completion/mock-months-lsp.lua') end
|
||||
local new_buffer = function() child.api.nvim_set_current_buf(child.api.nvim_create_buf(true, false)) end
|
||||
--stylua: ignore end
|
||||
|
||||
local mock_miniicons = function()
|
||||
child.lua([[
|
||||
require('mini.icons').setup()
|
||||
local _, hl_text = MiniIcons.get('lsp', 'Text')
|
||||
local _, hl_function = MiniIcons.get('lsp', 'Function')
|
||||
_G.ref_hlgroup = { text = hl_text, func = hl_function}
|
||||
]])
|
||||
end
|
||||
|
||||
-- NOTE: this can't show "what filtered text is actually shown in window".
|
||||
-- Seems to be because information for `complete_info()`
|
||||
--- is updated in the very last minute (probably, by UI). This means that the
|
||||
@ -64,8 +72,9 @@ local validate_single_floating_win = function(opts)
|
||||
end
|
||||
end
|
||||
|
||||
-- Data =======================================================================
|
||||
local test_times = { completion = 100, info = 100, signature = 50 }
|
||||
-- Time constants
|
||||
local default_completion_delay, default_info_delay, default_signature_delay = 100, 100, 50
|
||||
local small_time = helpers.get_time_const(10)
|
||||
|
||||
-- Output test set ============================================================
|
||||
local T = new_set({
|
||||
@ -160,6 +169,11 @@ T['setup()']['validates `config` argument'] = function()
|
||||
expect_config_error({ set_vim_settings = 1 }, 'set_vim_settings', 'boolean')
|
||||
end
|
||||
|
||||
T['setup()']['ensures colors'] = function()
|
||||
child.cmd('colorscheme default')
|
||||
expect.match(child.cmd_capture('hi MiniCompletionActiveParameter'), 'gui=underline')
|
||||
end
|
||||
|
||||
T['setup()']['properly handles `config.mappings`'] = function()
|
||||
local has_map = function(lhs, pattern) return child.cmd_capture('imap ' .. lhs):find(pattern) ~= nil end
|
||||
eq(has_map('<C-Space>', 'Complete'), true)
|
||||
@ -187,8 +201,8 @@ T['setup()']['uses `config.lsp_completion`'] = function()
|
||||
completefunc = source_func == 'completefunc' and val or ''
|
||||
end
|
||||
|
||||
eq(child.api.nvim_buf_get_option(0, 'omnifunc'), omnifunc)
|
||||
eq(child.api.nvim_buf_get_option(0, 'completefunc'), completefunc)
|
||||
eq(child.bo.omnifunc, omnifunc)
|
||||
eq(child.bo.completefunc, completefunc)
|
||||
end
|
||||
|
||||
validate(false)
|
||||
@ -203,9 +217,61 @@ T['setup()']['respects `config.set_vim_settings`'] = function()
|
||||
eq(child.api.nvim_get_option('completeopt'), 'menuone,noinsert,noselect')
|
||||
end
|
||||
|
||||
T['setup()']['defines non-linked default highlighting on `ColorScheme`'] = function()
|
||||
child.cmd('colorscheme blue')
|
||||
expect.match(child.cmd_capture('hi MiniCompletionActiveParameter'), 'gui=underline')
|
||||
T['default_process_items()'] = new_set({
|
||||
hooks = {
|
||||
pre_case = function()
|
||||
-- Mock LSP items
|
||||
child.lua([[
|
||||
_G.items = {
|
||||
{ kind = 1, label = "January", sortText = "001" },
|
||||
{ kind = 2, label = "May", sortText = "005" },
|
||||
{ kind = 2, label = "March", sortText = "003" },
|
||||
{ kind = 2, label = "April", sortText = "004" },
|
||||
{ kind = 1, label = "February", sortText = "002" },
|
||||
-- Unknown kind
|
||||
{ kind = 100, label = "July", sortText = "007" },
|
||||
{ kind = 3, label = "June", sortText = "006" },
|
||||
}
|
||||
]])
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
T['default_process_items()']['works'] = function()
|
||||
local ref_processed_items = {
|
||||
{ kind = 2, label = 'March', sortText = '003' },
|
||||
{ kind = 2, label = 'May', sortText = '005' },
|
||||
}
|
||||
eq(child.lua_get('MiniCompletion.default_process_items(_G.items, "M")'), ref_processed_items)
|
||||
end
|
||||
|
||||
T['default_process_items()']["highlights LSP kind if 'mini.icons' is enabled"] = function()
|
||||
mock_miniicons()
|
||||
local ref_hlgroup = child.lua_get('_G.ref_hlgroup')
|
||||
local ref_processed_items = {
|
||||
{ kind = 1, kind_hlgroup = ref_hlgroup.text, label = 'January', sortText = '001' },
|
||||
{ kind = 3, kind_hlgroup = ref_hlgroup.func, label = 'June', sortText = '006' },
|
||||
-- Unknown kind should not get highlighted
|
||||
{ kind = 100, kind_hlgroup = nil, label = 'July', sortText = '007' },
|
||||
}
|
||||
eq(child.lua_get('MiniCompletion.default_process_items(_G.items, "J")'), ref_processed_items)
|
||||
|
||||
-- Should not modify original items
|
||||
eq(child.lua_get('_G.items[1].kind_hlgroup'), vim.NIL)
|
||||
end
|
||||
|
||||
T['default_process_items()']['works after `MiniIcons.tweak_lsp_kind()`'] = function()
|
||||
mock_miniicons()
|
||||
child.lua('MiniIcons.tweak_lsp_kind()')
|
||||
|
||||
local ref_hlgroup = child.lua_get('_G.ref_hlgroup')
|
||||
local ref_processed_items = {
|
||||
{ kind = 1, kind_hlgroup = ref_hlgroup.text, label = 'January', sortText = '001' },
|
||||
{ kind = 3, kind_hlgroup = ref_hlgroup.func, label = 'June', sortText = '006' },
|
||||
-- Unknown kind should not get highlighted
|
||||
{ kind = 100, kind_hlgroup = nil, label = 'July', sortText = '007' },
|
||||
}
|
||||
eq(child.lua_get('MiniCompletion.default_process_items(_G.items, "J")'), ref_processed_items)
|
||||
end
|
||||
|
||||
-- Integration tests ==========================================================
|
||||
@ -225,9 +291,9 @@ T['Autocompletion']['works with LSP client'] = function()
|
||||
eq(get_completion(), {})
|
||||
|
||||
-- Shows completion only after delay
|
||||
sleep(test_times.completion - 10)
|
||||
sleep(default_completion_delay - small_time)
|
||||
eq(get_completion(), {})
|
||||
sleep(10)
|
||||
sleep(small_time + small_time)
|
||||
-- Both completion word and kind are shown
|
||||
eq(get_completion(), { 'January', 'June', 'July' })
|
||||
eq(get_completion('kind'), { 'Text', 'Function', 'Function' })
|
||||
@ -245,9 +311,9 @@ T['Autocompletion']['works without LSP clients'] = function()
|
||||
|
||||
type_keys('i', 'aab aac aba a')
|
||||
eq(get_completion(), {})
|
||||
sleep(test_times.completion - 10)
|
||||
sleep(default_completion_delay - small_time)
|
||||
eq(get_completion(), {})
|
||||
sleep(10)
|
||||
sleep(small_time + small_time)
|
||||
eq(get_completion(), { 'aab', 'aac', 'aba' })
|
||||
|
||||
-- Completion menu is filtered after entering characters
|
||||
@ -259,12 +325,12 @@ end
|
||||
T['Autocompletion']['implements debounce-style delay'] = function()
|
||||
type_keys('i', 'J')
|
||||
|
||||
sleep(test_times.completion - 10)
|
||||
sleep(default_completion_delay - small_time)
|
||||
eq(get_completion(), {})
|
||||
type_keys('u')
|
||||
sleep(test_times.completion - 10)
|
||||
sleep(default_completion_delay - small_time)
|
||||
eq(get_completion(), {})
|
||||
sleep(10)
|
||||
sleep(small_time + small_time)
|
||||
eq(get_completion(), { 'June', 'July' })
|
||||
end
|
||||
|
||||
@ -273,7 +339,7 @@ T['Autocompletion']['uses fallback'] = function()
|
||||
set_cursor(2, 0)
|
||||
|
||||
type_keys('i', 'Ja')
|
||||
sleep(test_times.completion + 1)
|
||||
sleep(default_completion_delay + small_time)
|
||||
eq(get_completion(), { 'January' })
|
||||
|
||||
-- Due to how 'completefunc' and 'omnifunc' currently work, fallback won't
|
||||
@ -312,9 +378,9 @@ T['Autocompletion']['forces new LSP completion at LSP trigger'] = new_set(
|
||||
|
||||
type_keys('May.')
|
||||
eq(child.fn.pumvisible(), 0)
|
||||
sleep(test_times.completion - 10)
|
||||
sleep(default_completion_delay - small_time)
|
||||
eq(child.fn.pumvisible(), 0)
|
||||
sleep(10 + 10)
|
||||
sleep(small_time + small_time)
|
||||
eq(get_completion(), all_months)
|
||||
child.expect_screenshot()
|
||||
|
||||
@ -322,30 +388,30 @@ T['Autocompletion']['forces new LSP completion at LSP trigger'] = new_set(
|
||||
-- show no completion if there is no LSP completion (as is imitated
|
||||
-- inside commented lines).
|
||||
type_keys('<Esc>o', '# .')
|
||||
sleep(test_times.completion + 10)
|
||||
sleep(default_completion_delay + small_time)
|
||||
child.expect_screenshot()
|
||||
end,
|
||||
}
|
||||
)
|
||||
|
||||
T['Autocompletion']['respects `config.delay.completion`'] = function()
|
||||
child.lua('MiniCompletion.config.delay.completion = 300')
|
||||
child.lua('MiniCompletion.config.delay.completion = ' .. (2 * default_completion_delay))
|
||||
|
||||
type_keys('i', 'J')
|
||||
sleep(300 - 10)
|
||||
sleep(2 * default_completion_delay - small_time)
|
||||
eq(get_completion(), {})
|
||||
sleep(10)
|
||||
sleep(small_time + small_time)
|
||||
eq(get_completion(), { 'January', 'June', 'July' })
|
||||
|
||||
-- Should also use buffer local config
|
||||
child.ensure_normal_mode()
|
||||
set_lines({ '' })
|
||||
set_cursor(1, 0)
|
||||
child.b.minicompletion_config = { delay = { completion = 50 } }
|
||||
child.b.minicompletion_config = { delay = { completion = default_completion_delay } }
|
||||
type_keys('i', 'J')
|
||||
sleep(50 - 10)
|
||||
sleep(default_completion_delay - small_time)
|
||||
eq(get_completion(), {})
|
||||
sleep(10)
|
||||
sleep(small_time + small_time)
|
||||
eq(get_completion(), { 'January', 'June', 'July' })
|
||||
end
|
||||
|
||||
@ -354,7 +420,7 @@ T['Autocompletion']['respects `config.lsp_completion.process_items`'] = function
|
||||
child.lua('MiniCompletion.config.lsp_completion.process_items = _G.process_items')
|
||||
|
||||
type_keys('i', 'J')
|
||||
sleep(test_times.completion + 1)
|
||||
sleep(default_completion_delay + small_time)
|
||||
eq(get_completion(), { 'February', 'March' })
|
||||
|
||||
child.ensure_normal_mode()
|
||||
@ -364,7 +430,7 @@ T['Autocompletion']['respects `config.lsp_completion.process_items`'] = function
|
||||
child.lua('vim.b.minicompletion_config = { lsp_completion = { process_items = _G.process_items_2 } }')
|
||||
|
||||
type_keys('i', 'J')
|
||||
sleep(test_times.completion + 1)
|
||||
sleep(default_completion_delay + small_time)
|
||||
eq(get_completion(), { 'April', 'May' })
|
||||
end
|
||||
|
||||
@ -375,7 +441,7 @@ T['Autocompletion']['respects string `config.fallback_action`'] = function()
|
||||
set_lines({ 'Line number 1', '' })
|
||||
set_cursor(2, 0)
|
||||
type_keys('i', 'L')
|
||||
sleep(test_times.completion + 1)
|
||||
sleep(default_completion_delay + small_time)
|
||||
child.expect_screenshot()
|
||||
|
||||
-- Should also use buffer local config
|
||||
@ -384,20 +450,20 @@ T['Autocompletion']['respects string `config.fallback_action`'] = function()
|
||||
set_lines({ 'Line number 1', '' })
|
||||
set_cursor(2, 0)
|
||||
type_keys('i', 'L')
|
||||
sleep(test_times.completion + 1)
|
||||
sleep(default_completion_delay + small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
T['Autocompletion']['respects function `config.fallback_action`'] = function()
|
||||
child.lua([[MiniCompletion.config.fallback_action = function() _G.inside_fallback = true end]])
|
||||
type_keys('i', 'a')
|
||||
sleep(test_times.completion + 1)
|
||||
sleep(default_completion_delay + small_time)
|
||||
eq(child.lua_get('_G.inside_fallback'), true)
|
||||
|
||||
child.ensure_normal_mode()
|
||||
child.lua('vim.b.minicompletion_config = { fallback_action = function() _G.inside_local_fallback = true end }')
|
||||
type_keys('i', 'a')
|
||||
sleep(test_times.completion + 1)
|
||||
sleep(default_completion_delay + small_time)
|
||||
eq(child.lua_get('_G.inside_local_fallback'), true)
|
||||
end
|
||||
|
||||
@ -407,7 +473,7 @@ T['Autocompletion']['respects `vim.{g,b}.minicompletion_disable`'] = new_set({
|
||||
test = function(var_type)
|
||||
child[var_type].minicompletion_disable = true
|
||||
type_keys('i', 'J')
|
||||
sleep(test_times.completion + 1)
|
||||
sleep(default_completion_delay + small_time)
|
||||
eq(get_completion(), {})
|
||||
end,
|
||||
})
|
||||
@ -471,7 +537,7 @@ T['Manual completion']['applies `additionalTextEdits` from "textDocument/complet
|
||||
child.ensure_normal_mode()
|
||||
set_lines({})
|
||||
type_keys('i', 'Se', '<C-space>')
|
||||
poke_eventloop()
|
||||
child.poke_eventloop()
|
||||
type_keys('<C-n>', confirm_key)
|
||||
|
||||
eq(child.fn.mode(), 'i')
|
||||
@ -495,10 +561,10 @@ T['Manual completion']['applies `additionalTextEdits` from "completionItem/resol
|
||||
child.ensure_normal_mode()
|
||||
set_lines({})
|
||||
type_keys('i', word_start, '<C-space>')
|
||||
poke_eventloop()
|
||||
child.poke_eventloop()
|
||||
type_keys('<C-n>')
|
||||
-- Wait until `completionItem/resolve` request is sent
|
||||
sleep(test_times.info + 1)
|
||||
sleep(default_info_delay + small_time)
|
||||
type_keys('<C-y>')
|
||||
|
||||
eq(child.fn.mode(), 'i')
|
||||
@ -517,7 +583,7 @@ T['Manual completion']['applies `additionalTextEdits` from "completionItem/resol
|
||||
child.ensure_normal_mode()
|
||||
set_lines({})
|
||||
type_keys('i', 'Ja', '<C-space>')
|
||||
poke_eventloop()
|
||||
child.poke_eventloop()
|
||||
type_keys('<C-n>', '<C-y>')
|
||||
eq(get_lines(), { 'January' })
|
||||
end
|
||||
@ -560,17 +626,37 @@ T['Manual completion']['respects `filterText` from LSP response'] = function()
|
||||
eq(get_cursor(), { 1, 13 })
|
||||
end
|
||||
|
||||
T['Manual completion']['respects `kind_hlgroup` as item field'] = function()
|
||||
if child.fn.has('nvim-0.11') == 0 then MiniTest.skip('Kind highlighting is available on Neovim>=0.11') end
|
||||
child.set_size(10, 40)
|
||||
set_lines({})
|
||||
|
||||
child.lua([[
|
||||
MiniCompletion.config.lsp_completion.process_items = function(items, base)
|
||||
local res = vim.tbl_filter(function(x) return vim.startswith(x.label, base) end, items)
|
||||
table.sort(res, function(a, b) return a.sortText < b.sortText end)
|
||||
for _, item in ipairs(res) do
|
||||
if item.label == 'January' then item.kind_hlgroup = 'String' end
|
||||
if item.label == 'June' then item.kind_hlgroup = 'Comment' end
|
||||
end
|
||||
return res
|
||||
end
|
||||
]])
|
||||
type_keys('i', 'J', '<C-Space>')
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
T['Manual completion']['respects `vim.{g,b}.minicompletion_disable`'] = new_set({
|
||||
parametrize = { { 'g' }, { 'b' } },
|
||||
}, {
|
||||
test = function(var_type)
|
||||
child[var_type].minicompletion_disable = true
|
||||
type_keys('i', '<C-Space>')
|
||||
poke_eventloop()
|
||||
child.poke_eventloop()
|
||||
eq(get_completion(), {})
|
||||
|
||||
type_keys('i', '<M-Space>')
|
||||
poke_eventloop()
|
||||
child.poke_eventloop()
|
||||
eq(get_completion(), {})
|
||||
end,
|
||||
})
|
||||
@ -592,27 +678,27 @@ local validate_info_win = function(delay)
|
||||
|
||||
type_keys('<C-n>')
|
||||
eq(get_floating_windows(), {})
|
||||
sleep(delay - 10)
|
||||
sleep(delay - small_time)
|
||||
eq(get_floating_windows(), {})
|
||||
sleep(10 + 1)
|
||||
sleep(small_time + small_time)
|
||||
validate_single_floating_win({ lines = { 'Month #01' } })
|
||||
end
|
||||
|
||||
T['Information window']['works'] = function()
|
||||
child.set_size(10, 40)
|
||||
validate_info_win(test_times.info)
|
||||
validate_info_win(default_info_delay)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
T['Information window']['respects `config.delay.info`'] = function()
|
||||
child.lua('MiniCompletion.config.delay.info = 300')
|
||||
validate_info_win(300)
|
||||
child.lua('MiniCompletion.config.delay.info = ' .. (2 * default_info_delay))
|
||||
validate_info_win(2 * default_info_delay)
|
||||
|
||||
-- Should also use buffer local config
|
||||
child.ensure_normal_mode()
|
||||
set_lines({ '' })
|
||||
child.b.minicompletion_config = { delay = { info = 50 } }
|
||||
validate_info_win(50)
|
||||
child.b.minicompletion_config = { delay = { info = default_info_delay } }
|
||||
validate_info_win(default_info_delay)
|
||||
end
|
||||
|
||||
local validate_info_window_config = function(keys, completion_items, win_config)
|
||||
@ -622,7 +708,7 @@ local validate_info_window_config = function(keys, completion_items, win_config)
|
||||
type_keys('<C-n>')
|
||||
-- Some windows can take a while to process on slow machines. So add `10`
|
||||
-- to ensure that processing is finished.
|
||||
sleep(test_times.info + 10)
|
||||
sleep(default_info_delay + small_time)
|
||||
validate_single_floating_win({ config = win_config })
|
||||
end
|
||||
|
||||
@ -652,7 +738,7 @@ T['Information window']['accounts for border when picking side'] = function()
|
||||
|
||||
set_lines({ 'aaaaaaaaaaaa ' })
|
||||
type_keys('A', 'J', '<C-Space>', '<C-n>')
|
||||
sleep(test_times.info + 10)
|
||||
sleep(default_info_delay + small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
@ -669,7 +755,7 @@ T['Information window']['adjusts window width'] = function()
|
||||
child.lua([[MiniCompletion.config.window.info= { height = 15, width = 10, border = 'single' }]])
|
||||
|
||||
type_keys('i', 'J', '<C-Space>', '<C-n>')
|
||||
sleep(test_times.info + 10)
|
||||
sleep(default_info_delay + small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
@ -678,12 +764,12 @@ T['Information window']['implements debounce-style delay'] = function()
|
||||
eq(get_completion(), { 'January', 'June', 'July' })
|
||||
|
||||
type_keys('<C-n>')
|
||||
sleep(test_times.info - 10)
|
||||
sleep(default_info_delay - small_time)
|
||||
eq(#get_floating_windows(), 0)
|
||||
type_keys('<C-n>')
|
||||
sleep(test_times.info - 10)
|
||||
sleep(default_info_delay - small_time)
|
||||
eq(#get_floating_windows(), 0)
|
||||
sleep(10 + 1)
|
||||
sleep(small_time + small_time)
|
||||
validate_single_floating_win({ lines = { 'Month #06' } })
|
||||
end
|
||||
|
||||
@ -695,7 +781,7 @@ T['Information window']['is closed when forced outside of Insert mode'] = new_se
|
||||
eq(get_completion(), { 'January', 'June', 'July' })
|
||||
|
||||
type_keys('<C-n>')
|
||||
sleep(test_times.info + 5)
|
||||
sleep(default_info_delay + small_time)
|
||||
validate_single_floating_win({ lines = { 'Month #01' } })
|
||||
|
||||
type_keys(key)
|
||||
@ -705,14 +791,14 @@ T['Information window']['is closed when forced outside of Insert mode'] = new_se
|
||||
)
|
||||
|
||||
T['Information window']['handles all buffer wipeout'] = function()
|
||||
validate_info_win(test_times.info)
|
||||
validate_info_win(default_info_delay)
|
||||
child.ensure_normal_mode()
|
||||
|
||||
child.cmd('%bw!')
|
||||
new_buffer()
|
||||
mock_lsp()
|
||||
|
||||
validate_info_win(test_times.info)
|
||||
validate_info_win(default_info_delay)
|
||||
end
|
||||
|
||||
T['Information window']['respects `vim.{g,b}.minicompletion_disable`'] = new_set({
|
||||
@ -724,7 +810,7 @@ T['Information window']['respects `vim.{g,b}.minicompletion_disable`'] = new_set
|
||||
set_lines({ 'aa ab ', '' })
|
||||
set_cursor(2, 0)
|
||||
type_keys('i', '<C-n>', '<C-n>')
|
||||
sleep(test_times.info + 1)
|
||||
sleep(default_info_delay + small_time)
|
||||
eq(#get_floating_windows(), 0)
|
||||
end,
|
||||
})
|
||||
@ -744,27 +830,27 @@ local validate_signature_win = function(delay)
|
||||
type_keys('i', 'abc(')
|
||||
|
||||
eq(get_floating_windows(), {})
|
||||
sleep(delay - 10)
|
||||
sleep(delay - small_time)
|
||||
eq(get_floating_windows(), {})
|
||||
sleep(10 + 1)
|
||||
sleep(small_time + small_time)
|
||||
validate_single_floating_win({ lines = { 'abc(param1, param2)' } })
|
||||
end
|
||||
|
||||
T['Signature help']['works'] = function()
|
||||
child.set_size(5, 30)
|
||||
validate_signature_win(test_times.signature)
|
||||
validate_signature_win(default_signature_delay)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
T['Signature help']['respects `config.delay.signature`'] = function()
|
||||
child.lua('MiniCompletion.config.delay.signature = 300')
|
||||
validate_signature_win(300)
|
||||
child.lua('MiniCompletion.config.delay.signature = ' .. (2 * default_signature_delay))
|
||||
validate_signature_win(2 * default_signature_delay)
|
||||
|
||||
-- Should also use buffer local config
|
||||
child.ensure_normal_mode()
|
||||
set_lines({ '' })
|
||||
child.b.minicompletion_config = { delay = { signature = 50 } }
|
||||
validate_signature_win(50)
|
||||
child.b.minicompletion_config = { delay = { signature = default_signature_delay } }
|
||||
validate_signature_win(default_signature_delay)
|
||||
end
|
||||
|
||||
T['Signature help']['updates highlighting of active parameter'] = function()
|
||||
@ -772,23 +858,23 @@ T['Signature help']['updates highlighting of active parameter'] = function()
|
||||
child.cmd('startinsert')
|
||||
|
||||
type_keys('abc(')
|
||||
sleep(test_times.signature + 1)
|
||||
sleep(default_signature_delay + small_time)
|
||||
child.expect_screenshot()
|
||||
|
||||
type_keys('1,')
|
||||
sleep(test_times.signature + 1)
|
||||
sleep(default_signature_delay + small_time)
|
||||
child.expect_screenshot()
|
||||
|
||||
-- As there are only two parameters, nothing should be highlighted
|
||||
type_keys('2,')
|
||||
sleep(test_times.signature + 1)
|
||||
sleep(default_signature_delay + small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
local validate_signature_window_config = function(keys, win_config)
|
||||
child.cmd('startinsert')
|
||||
type_keys(keys)
|
||||
sleep(test_times.signature + 2)
|
||||
sleep(default_signature_delay + small_time)
|
||||
validate_single_floating_win({ config = win_config })
|
||||
end
|
||||
|
||||
@ -817,7 +903,7 @@ T['Signature help']['accounts for border when picking side'] = function()
|
||||
child.lua([[MiniCompletion.config.window.signature.border = 'single']])
|
||||
|
||||
type_keys('o<CR>', 'abc(')
|
||||
sleep(test_times.signature + 10)
|
||||
sleep(default_signature_delay + small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
@ -835,20 +921,20 @@ T['Signature help']['adjusts window height'] = function()
|
||||
child.lua([[MiniCompletion.config.window.signature = { height = 15, width = 10, border = 'single' }]])
|
||||
|
||||
type_keys('i', 'long(')
|
||||
sleep(test_times.signature + 10)
|
||||
sleep(default_signature_delay + small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
T['Signature help']['implements debounce-style delay'] = function()
|
||||
child.cmd('startinsert')
|
||||
type_keys('abc(')
|
||||
sleep(test_times.signature - 10)
|
||||
sleep(default_signature_delay - small_time)
|
||||
type_keys('d')
|
||||
sleep(test_times.signature + 1)
|
||||
sleep(default_signature_delay + small_time)
|
||||
eq(#get_floating_windows(), 0)
|
||||
|
||||
type_keys(',')
|
||||
sleep(test_times.signature + 1)
|
||||
sleep(default_signature_delay + small_time)
|
||||
validate_single_floating_win({ lines = { 'abc(param1, param2)' } })
|
||||
end
|
||||
|
||||
@ -857,7 +943,7 @@ T['Signature help']['is closed when forced outside of Insert mode'] = new_set(
|
||||
{
|
||||
test = function(key)
|
||||
type_keys('i', 'abc(')
|
||||
sleep(test_times.signature + 5)
|
||||
sleep(default_signature_delay + small_time)
|
||||
validate_single_floating_win({ lines = { 'abc(param1, param2)' } })
|
||||
|
||||
type_keys(key)
|
||||
@ -867,14 +953,14 @@ T['Signature help']['is closed when forced outside of Insert mode'] = new_set(
|
||||
)
|
||||
|
||||
T['Signature help']['handles all buffer wipeout'] = function()
|
||||
validate_signature_win(test_times.signature)
|
||||
validate_signature_win(default_signature_delay)
|
||||
child.ensure_normal_mode()
|
||||
|
||||
child.cmd('%bw!')
|
||||
new_buffer()
|
||||
mock_lsp()
|
||||
|
||||
validate_signature_win(test_times.signature)
|
||||
validate_signature_win(default_signature_delay)
|
||||
end
|
||||
|
||||
T['Signature help']['respects `vim.{g,b}.minicompletion_disable`'] = new_set({
|
||||
@ -884,7 +970,7 @@ T['Signature help']['respects `vim.{g,b}.minicompletion_disable`'] = new_set({
|
||||
child[var_type].minicompletion_disable = true
|
||||
|
||||
type_keys('i', 'abc(')
|
||||
sleep(test_times.signature + 1)
|
||||
sleep(default_signature_delay + small_time)
|
||||
eq(#get_floating_windows(), 0)
|
||||
end,
|
||||
})
|
||||
|
||||
@ -11,8 +11,7 @@ local unload_module = function() child.mini_unload('cursorword') end
|
||||
local set_cursor = function(...) return child.set_cursor(...) end
|
||||
local set_lines = function(...) return child.set_lines(...) end
|
||||
local type_keys = function(...) return child.type_keys(...) end
|
||||
local poke_eventloop = function() child.api.nvim_eval('1') end
|
||||
local sleep = function(ms) vim.loop.sleep(ms); poke_eventloop() end
|
||||
local sleep = function(ms) helpers.sleep(ms, child, true) end
|
||||
--stylua: ignore end
|
||||
|
||||
-- Make helpers
|
||||
@ -39,7 +38,9 @@ end
|
||||
-- Data =======================================================================
|
||||
local example_lines = { 'aa', 'aa', 'aaa' }
|
||||
|
||||
local test_times = { delay = 100 }
|
||||
-- Time constants
|
||||
local default_delay = 100
|
||||
local small_time = helpers.get_time_const(10)
|
||||
|
||||
-- Output test set ============================================================
|
||||
local T = new_set({
|
||||
@ -93,8 +94,8 @@ T['setup()']['validates `config` argument'] = function()
|
||||
expect_config_error({ delay = 'a' }, 'delay', 'number')
|
||||
end
|
||||
|
||||
T['setup()']['defines non-linked default highlighting on `ColorScheme`'] = function()
|
||||
child.cmd('colorscheme blue')
|
||||
T['setup()']['ensures colors'] = function()
|
||||
child.cmd('colorscheme default')
|
||||
expect.match(child.cmd_capture('hi MiniCursorword'), 'gui=underline')
|
||||
expect.match(child.cmd_capture('hi MiniCursorwordCurrent'), 'links to MiniCursorword')
|
||||
end
|
||||
@ -163,27 +164,27 @@ T['Autohighlighting'] = new_set({
|
||||
local validate_cursorword = function(delay)
|
||||
set_cursor(2, 0)
|
||||
eq(word_is_highlighted('aa'), false)
|
||||
sleep(delay - 10)
|
||||
sleep(delay - small_time)
|
||||
eq(word_is_highlighted('aa'), false)
|
||||
sleep(10)
|
||||
sleep(small_time)
|
||||
eq(word_is_highlighted('aa'), true)
|
||||
end
|
||||
|
||||
T['Autohighlighting']['works'] = function() validate_cursorword(test_times.delay) end
|
||||
T['Autohighlighting']['works'] = function() validate_cursorword(default_delay) end
|
||||
|
||||
T['Autohighlighting']['respects `config.delay`'] = function()
|
||||
child.lua('MiniCursorword.config.delay = 200')
|
||||
validate_cursorword(200)
|
||||
child.lua('MiniCursorword.config.delay = ' .. (3 * default_delay))
|
||||
validate_cursorword(3 * default_delay)
|
||||
|
||||
-- Should also use buffer local config
|
||||
set_cursor(3, 0)
|
||||
child.b.minicursorword_config = { delay = 50 }
|
||||
validate_cursorword(50)
|
||||
child.b.minicursorword_config = { delay = default_delay }
|
||||
validate_cursorword(default_delay)
|
||||
end
|
||||
|
||||
T['Autohighlighting']['removes highlight immediately after move'] = function()
|
||||
set_cursor(2, 0)
|
||||
sleep(test_times.delay)
|
||||
sleep(default_delay)
|
||||
eq(word_is_highlighted('aa'), true)
|
||||
set_cursor(3, 0)
|
||||
eq(child.fn.getmatches(), {})
|
||||
@ -191,12 +192,12 @@ end
|
||||
|
||||
local validate_immediate = function(move_command)
|
||||
set_cursor(2, 0)
|
||||
sleep(test_times.delay)
|
||||
sleep(default_delay)
|
||||
eq(word_is_highlighted('aa'), true)
|
||||
|
||||
local match_gen = get_match('MiniCursorword')
|
||||
child.cmd(move_command)
|
||||
sleep(0)
|
||||
child.poke_eventloop()
|
||||
eq(word_is_highlighted('aa'), true)
|
||||
|
||||
-- Check that general match group didn't change (as word is same)
|
||||
@ -233,7 +234,7 @@ end
|
||||
|
||||
T['Autohighlighting']['stops in Insert mode'] = function()
|
||||
set_cursor(2, 0)
|
||||
sleep(test_times.delay)
|
||||
sleep(default_delay)
|
||||
eq(word_is_highlighted('aa'), true)
|
||||
type_keys('i')
|
||||
eq(word_is_highlighted('aa'), false)
|
||||
@ -241,7 +242,7 @@ end
|
||||
|
||||
T['Autohighlighting']['stops in Terminal mode'] = function()
|
||||
set_cursor(2, 0)
|
||||
sleep(test_times.delay)
|
||||
sleep(default_delay)
|
||||
eq(word_is_highlighted('aa'), true)
|
||||
child.cmd('doautocmd TermEnter')
|
||||
eq(word_is_highlighted('aa'), false)
|
||||
@ -277,12 +278,12 @@ T['Autohighlighting']['respects `vim.{g,b}.minicursorword_disable`'] = new_set({
|
||||
|
||||
child[var_type].minicursorword_disable = true
|
||||
set_cursor(1, 0)
|
||||
sleep(test_times.delay)
|
||||
sleep(default_delay)
|
||||
eq(word_is_highlighted('aa'), false)
|
||||
|
||||
child[var_type].minicursorword_disable = false
|
||||
set_cursor(1, 1)
|
||||
sleep(test_times.delay)
|
||||
sleep(default_delay)
|
||||
eq(word_is_highlighted('aa'), true)
|
||||
end,
|
||||
})
|
||||
@ -296,12 +297,12 @@ T['Autohighlighting']['respects deferred `vim.{g,b}.minicursorword_disable`'] =
|
||||
local lua_cmd = string.format(
|
||||
'vim.defer_fn(function() vim.%s.minicursorword_disable = true end, %d)',
|
||||
var_type,
|
||||
math.floor(0.5 * test_times.delay)
|
||||
math.floor(0.5 * default_delay)
|
||||
)
|
||||
child.lua(lua_cmd)
|
||||
set_cursor(1, 0)
|
||||
|
||||
sleep(test_times.delay)
|
||||
sleep(default_delay)
|
||||
eq(word_is_highlighted('aa'), false)
|
||||
end,
|
||||
})
|
||||
|
||||
@ -8,15 +8,14 @@ local new_set = MiniTest.new_set
|
||||
--stylua: ignore start
|
||||
local load_module = function(config) child.mini_load('deps', config) end
|
||||
local unload_module = function() child.mini_unload('deps') end
|
||||
local poke_eventloop = function() child.api.nvim_eval('1') end
|
||||
local sleep = function(ms) vim.loop.sleep(ms); poke_eventloop() end
|
||||
local sleep = function(ms) helpers.sleep(ms, child) end
|
||||
--stylua: ignore end
|
||||
|
||||
-- TODO: Remove after compatibility with Neovim=0.9 is dropped
|
||||
local islist = vim.fn.has('nvim-0.10') == 1 and vim.islist or vim.tbl_islist
|
||||
|
||||
local test_dir = 'tests/dir-deps'
|
||||
local test_dir_absolute = vim.fn.fnamemodify(test_dir, ':p'):gsub('(.)/$', '%1')
|
||||
local test_dir_absolute = vim.fs.normalize(vim.fn.fnamemodify(test_dir, ':p')):gsub('(.)/$', '%1')
|
||||
local test_opt_dir = test_dir_absolute .. '/pack/deps/opt'
|
||||
local test_snap_path = test_dir_absolute .. '/snapshots/snap'
|
||||
local test_log_path = test_dir_absolute .. '/mini-deps.log'
|
||||
@ -88,7 +87,8 @@ end
|
||||
|
||||
local mock_hide_path = function(path)
|
||||
path = path or test_dir_absolute
|
||||
child.cmd(':%s/' .. child.fn.escape(path, ' /') .. '/MOCKDIR/')
|
||||
-- NOTE: use "^" as pattern separator because "/" can cause troubles
|
||||
child.cmd(':%s^' .. child.fn.escape(path, ' /') .. '^MOCKDIR^')
|
||||
child.bo.modified = false
|
||||
end
|
||||
|
||||
@ -160,6 +160,19 @@ end
|
||||
|
||||
local clear_notify_log = function() return child.lua('_G.notify_log = {}') end
|
||||
|
||||
-- Common validators
|
||||
local is_in_rtp = function(path)
|
||||
path = vim.fs.normalize(path)
|
||||
for _, p in ipairs(child.api.nvim_list_runtime_paths()) do
|
||||
if path == vim.fs.normalize(p) then return true end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- Time constants
|
||||
local small_time = helpers.get_time_const(10)
|
||||
local micro_time = 1
|
||||
|
||||
-- Output test set ============================================================
|
||||
local T = new_set({
|
||||
hooks = {
|
||||
@ -172,6 +185,7 @@ local T = new_set({
|
||||
-- Make more comfortable screenshots
|
||||
child.o.laststatus = 0
|
||||
child.o.ruler = false
|
||||
child.o.showtabline = 0
|
||||
|
||||
-- Mock `vim.notify()`
|
||||
mock_notify()
|
||||
@ -193,6 +207,9 @@ T['setup()']['creates side effects'] = function()
|
||||
-- Global variable
|
||||
eq(child.lua_get('type(_G.MiniDeps)'), 'table')
|
||||
|
||||
-- Autocommand group
|
||||
eq(child.fn.exists('#MiniDeps'), 1)
|
||||
|
||||
-- User commands
|
||||
local has_user_command = function(cmd) eq(child.fn.exists(':' .. cmd), 2) end
|
||||
has_user_command('DepsAdd')
|
||||
@ -262,6 +279,11 @@ T['setup()']['validates `config` argument'] = function()
|
||||
expect_config_error({ silent = 'a' }, 'silent', 'boolean')
|
||||
end
|
||||
|
||||
T['setup()']['ensures colors'] = function()
|
||||
child.cmd('colorscheme default')
|
||||
expect.match(child.cmd_capture('hi MiniDepsHint'), 'links to DiagnosticHint')
|
||||
end
|
||||
|
||||
T['setup()']["prepends 'packpath' with package path"] = function()
|
||||
mock_test_package(test_dir_absolute)
|
||||
eq(vim.startswith(child.o.packpath, test_dir_absolute), true)
|
||||
@ -281,22 +303,18 @@ T['add()'] = new_set({ hooks = { pre_case = mock_test_package } })
|
||||
T['add()']['works for present plugins'] = new_set({ parametrize = { { 'plugin_1' }, { { name = 'plugin_1' } } } }, {
|
||||
test = function(spec)
|
||||
local ref_path = test_opt_dir .. '/plugin_1'
|
||||
expect.no_match(child.o.runtimepath, vim.pesc(ref_path))
|
||||
eq(is_in_rtp(ref_path), false)
|
||||
eq(get_session(), {})
|
||||
|
||||
add(spec)
|
||||
|
||||
expect.match(child.o.runtimepath, vim.pesc(ref_path))
|
||||
eq(is_in_rtp(ref_path), true)
|
||||
eq(is_in_rtp(ref_path .. '/after'), true)
|
||||
eq(get_session(), { { name = 'plugin_1', path = ref_path, hooks = {}, depends = {} } })
|
||||
|
||||
-- No CLI process should be run as plugin is already present
|
||||
eq(get_spawn_log(), {})
|
||||
|
||||
-- Should add plugin to 'runtimepath'
|
||||
local rtp = vim.split(child.o.runtimepath, ',')
|
||||
eq(vim.tbl_contains(rtp, ref_path), true)
|
||||
eq(vim.tbl_contains(rtp, ref_path .. '/after'), true)
|
||||
|
||||
-- Should load 'plugin/', 'after/plugin/', etc.
|
||||
eq(child.lua_get('type(_G.plugin_log)'), 'table')
|
||||
end,
|
||||
@ -313,7 +331,7 @@ T['add()']['infers name from source'] = new_set({
|
||||
test = function(spec)
|
||||
local ref_path = test_opt_dir .. '/plugin_1'
|
||||
add(spec)
|
||||
expect.match(child.o.runtimepath, vim.pesc(ref_path))
|
||||
eq(is_in_rtp(ref_path), true)
|
||||
eq(
|
||||
get_session(),
|
||||
{ { source = 'https://github.com/user/plugin_1', name = 'plugin_1', path = ref_path, hooks = {}, depends = {} } }
|
||||
@ -1123,6 +1141,7 @@ T['add()']['Install']['works when no information about number of cores is availa
|
||||
end
|
||||
|
||||
T['add()']['Install']['respects `config.job.timeout`'] = function()
|
||||
child.lua('_G.duration = ' .. (10 * small_time))
|
||||
child.lua([[
|
||||
_G.stdio_queue = {
|
||||
{ out = 'git version 2.43.0'}, -- Check Git executable
|
||||
@ -1132,10 +1151,10 @@ T['add()']['Install']['respects `config.job.timeout`'] = function()
|
||||
}
|
||||
|
||||
-- Mock long execution of some jobs
|
||||
_G.process_mock_data = { [2] = { duration = 50 }, [3] = { duration = 0 }, [4] = { duration = 50 } }
|
||||
_G.process_mock_data = { [2] = { duration = _G.duration }, [3] = { duration = 0 }, [4] = { duration = _G.duration } }
|
||||
]])
|
||||
|
||||
child.lua('MiniDeps.config.job.timeout = 25')
|
||||
child.lua('MiniDeps.config.job.timeout = ' .. (5 * small_time))
|
||||
add({ source = 'user/new_plugin', depends = { 'user/dep_plugin' } })
|
||||
|
||||
local ref_notify_log = {
|
||||
@ -1879,6 +1898,9 @@ T['update()']['works when no information about number of cores is available'] =
|
||||
end
|
||||
|
||||
T['update()']['respects `config.job.timeout`'] = function()
|
||||
helpers.skip_if_slow()
|
||||
|
||||
child.lua('_G.duration = ' .. (10 * small_time))
|
||||
child.lua([[
|
||||
_G.stdio_queue = {
|
||||
{ out = 'git version 2.43.0'}, -- Check Git executable
|
||||
@ -1890,12 +1912,12 @@ T['update()']['respects `config.job.timeout`'] = function()
|
||||
}
|
||||
|
||||
-- Mock non-trivial durations
|
||||
_G.process_mock_data = { [3] = { duration = 50 }, [6] = { duration = 50 } }
|
||||
_G.process_mock_data = { [3] = { duration = _G.duration }, [6] = { duration = _G.duration } }
|
||||
]])
|
||||
add('user/plugin_1')
|
||||
add('user/plugin_2')
|
||||
|
||||
child.lua('MiniDeps.config.job.timeout = 25')
|
||||
child.lua('MiniDeps.config.job.timeout = ' .. (5 * small_time))
|
||||
update()
|
||||
|
||||
local ref_notify_log = {
|
||||
@ -2448,7 +2470,7 @@ T['now()']['can be called inside other `now()`/`later()` call'] = function()
|
||||
]])
|
||||
eq(child.lua_get('_G.immediate_log'), { 'now', 'now_now' })
|
||||
|
||||
sleep(20)
|
||||
sleep(small_time)
|
||||
eq(child.lua_get('_G.log'), { 'now', 'now_now', 'later', 'later_now' })
|
||||
end
|
||||
|
||||
@ -2461,7 +2483,7 @@ T['now()']['clears queue between different event loops'] = function()
|
||||
]])
|
||||
eq(child.lua_get('_G.immediate_log'), { 'now' })
|
||||
|
||||
sleep(2)
|
||||
sleep(small_time)
|
||||
child.lua('MiniDeps.now(_G.f)')
|
||||
-- If it did not clear the queue, it would have been 3 elements
|
||||
eq(child.lua_get('_G.log'), { 'now', 'now' })
|
||||
@ -2469,22 +2491,14 @@ end
|
||||
|
||||
T['now()']['notifies about errors after everything is executed'] = function()
|
||||
child.lua([[
|
||||
_G.log = {}
|
||||
MiniDeps.now(function() error('Inside now()') end)
|
||||
_G.f = function() log[#log + 1] = 'later' end
|
||||
MiniDeps.later(_G.f)
|
||||
MiniDeps.later(_G.f)
|
||||
MiniDeps.later(_G.f)
|
||||
MiniDeps.later(_G.f)
|
||||
MiniDeps.later(_G.f)
|
||||
local f = function() vim.notify('Info', vim.log.levels.INFO) end
|
||||
MiniDeps.later(f)
|
||||
MiniDeps.later(f)
|
||||
]])
|
||||
|
||||
sleep(1)
|
||||
validate_notifications({}, true)
|
||||
|
||||
sleep(10)
|
||||
eq(child.lua_get('_G.log'), { 'later', 'later', 'later', 'later', 'later' })
|
||||
validate_notifications({ { 'errors.*Inside now()', 'ERROR' } }, true)
|
||||
sleep(2 * small_time)
|
||||
validate_notifications({ { 'Info', 'INFO' }, { 'Info', 'INFO' }, { 'errors.*Inside now()', 'ERROR' } }, true)
|
||||
end
|
||||
|
||||
T['now()']['shows all errors at once'] = function()
|
||||
@ -2492,7 +2506,7 @@ T['now()']['shows all errors at once'] = function()
|
||||
MiniDeps.now(function() error('Inside now() #1') end)
|
||||
MiniDeps.now(function() error('Inside now() #2') end)
|
||||
]])
|
||||
sleep(2)
|
||||
sleep(micro_time)
|
||||
validate_notifications({ { 'errors.*Inside now%(%) #1.*Inside now%(%) #2', 'ERROR' } }, true)
|
||||
end
|
||||
|
||||
@ -2500,7 +2514,7 @@ T['now()']['does not respect `config.silent`'] = function()
|
||||
-- Should still show errors even if `config.silent = true`
|
||||
child.lua('MiniDeps.config.silent = true')
|
||||
child.lua('MiniDeps.now(function() error("Inside now()") end)')
|
||||
sleep(2)
|
||||
sleep(micro_time)
|
||||
validate_notifications({ { 'Inside now%(%)', 'ERROR' } }, true)
|
||||
end
|
||||
|
||||
@ -2516,7 +2530,7 @@ T['later()']['works'] = function()
|
||||
]])
|
||||
eq(child.lua_get('_G.log_in_this_loop'), { 'after later' })
|
||||
|
||||
sleep(2)
|
||||
sleep(small_time)
|
||||
eq(child.lua_get('_G.log'), { 'after later', 'later' })
|
||||
end
|
||||
|
||||
@ -2535,7 +2549,7 @@ T['later()']['can be called inside other `now()`/`later()` call'] = function()
|
||||
]])
|
||||
eq(child.lua_get('_G.immediate_log'), { 'now' })
|
||||
|
||||
sleep(10)
|
||||
sleep(2 * small_time)
|
||||
eq(child.lua_get('_G.log'), { 'now', 'later', 'now_later', 'later_later' })
|
||||
end
|
||||
|
||||
@ -2547,34 +2561,25 @@ T['later()']['clears queue between different event loops'] = function()
|
||||
_G.immediate_log = vim.deepcopy(_G.log)
|
||||
]])
|
||||
eq(child.lua_get('_G.immediate_log'), {})
|
||||
sleep(2)
|
||||
sleep(micro_time)
|
||||
eq(child.lua_get('_G.log'), { 'later' })
|
||||
|
||||
child.lua('MiniDeps.later(_G.f)')
|
||||
-- If it did not clear the queue, it would have been 3 elements
|
||||
sleep(4)
|
||||
sleep(2 * micro_time)
|
||||
eq(child.lua_get('_G.log'), { 'later', 'later' })
|
||||
end
|
||||
|
||||
T['later()']['notifies about errors after everything is executed'] = function()
|
||||
child.lua([[
|
||||
_G.log = {}
|
||||
MiniDeps.later(function() error('Inside later()') end)
|
||||
_G.f = function() log[#log + 1] = 'later' end
|
||||
MiniDeps.later(_G.f)
|
||||
MiniDeps.later(_G.f)
|
||||
MiniDeps.later(_G.f)
|
||||
MiniDeps.later(_G.f)
|
||||
MiniDeps.later(_G.f)
|
||||
local f = function() vim.notify('Info', vim.log.levels.INFO) end
|
||||
MiniDeps.later(f)
|
||||
MiniDeps.later(f)
|
||||
]])
|
||||
eq(child.lua_get('_G.log'), {})
|
||||
|
||||
sleep(1)
|
||||
validate_notifications({}, true)
|
||||
|
||||
sleep(10)
|
||||
eq(child.lua_get('_G.log'), { 'later', 'later', 'later', 'later', 'later' })
|
||||
validate_notifications({ { 'errors.*Inside later()', 'ERROR' } }, true)
|
||||
sleep(2 * small_time)
|
||||
validate_notifications({ { 'Info', 'INFO' }, { 'Info', 'INFO' }, { 'errors.*Inside later()', 'ERROR' } }, true)
|
||||
end
|
||||
|
||||
T['later()']['shows all errors at once'] = function()
|
||||
@ -2582,7 +2587,7 @@ T['later()']['shows all errors at once'] = function()
|
||||
MiniDeps.later(function() error('Inside later() #1') end)
|
||||
MiniDeps.later(function() error('Inside later() #2') end)
|
||||
]])
|
||||
sleep(5)
|
||||
sleep(2 * small_time)
|
||||
validate_notifications({ { 'errors.*Inside later%(%) #1.*Inside later%(%) #2', 'ERROR' } }, true)
|
||||
end
|
||||
|
||||
@ -2590,7 +2595,7 @@ T['later()']['does not respect `config.silent`'] = function()
|
||||
-- Should still show errors even if `config.silent = true`
|
||||
child.lua('MiniDeps.config.silent = true')
|
||||
child.lua('MiniDeps.later(function() error("Inside later()") end)')
|
||||
sleep(2)
|
||||
sleep(small_time)
|
||||
validate_notifications({ { 'Inside later%(%)', 'ERROR' } }, true)
|
||||
end
|
||||
|
||||
|
||||
@ -13,20 +13,18 @@ local get_cursor = function(...) return child.get_cursor(...) end
|
||||
local set_lines = function(...) return child.set_lines(...) end
|
||||
local get_lines = function(...) return child.get_lines(...) end
|
||||
local type_keys = function(...) return child.type_keys(...) end
|
||||
local poke_eventloop = function() child.api.nvim_eval('1') end
|
||||
local sleep = function(ms) vim.loop.sleep(ms); poke_eventloop() end
|
||||
local sleep = function(ms) helpers.sleep(ms, child) end
|
||||
local new_buf = function() return child.api.nvim_create_buf(true, false) end
|
||||
local new_scratch_buf = function() return child.api.nvim_create_buf(false, true) end
|
||||
local get_buf = function() return child.api.nvim_get_current_buf() end
|
||||
local set_buf = function(buf_id) child.api.nvim_set_current_buf(buf_id) end
|
||||
local edit = function(path) child.cmd('edit ' .. child.fn.fnameescape(path)) end
|
||||
--stylua: ignore end
|
||||
|
||||
-- TODO: Remove after compatibility with Neovim=0.9 is dropped
|
||||
local islist = vim.fn.has('nvim-0.10') == 1 and vim.islist or vim.tbl_islist
|
||||
|
||||
local test_dir = 'tests/dir-diff'
|
||||
local test_dir_absolute = vim.fn.fnamemodify(test_dir, ':p'):gsub('(.)/$', '%1')
|
||||
local test_dir_absolute = vim.fs.normalize(vim.fn.fnamemodify(test_dir, ':p')):gsub('(.)/$', '%1')
|
||||
local test_file_path = test_dir_absolute .. '/file'
|
||||
|
||||
local git_repo_dir = test_dir_absolute .. '/git-repo'
|
||||
@ -40,7 +38,24 @@ local forward_lua = function(fun_str)
|
||||
return function(...) return child.lua_get(lua_cmd, { ... }) end
|
||||
end
|
||||
|
||||
local set_ref_text = forward_lua([[require('mini.diff').set_ref_text]])
|
||||
-- Time constants
|
||||
local default_watch_debounce_delay = 50
|
||||
local dummy_text_change_delay = helpers.get_time_const(30)
|
||||
local small_time = helpers.get_time_const(10)
|
||||
local micro_time = 1
|
||||
|
||||
-- Common wrappers
|
||||
local edit = function(path)
|
||||
child.cmd('edit ' .. child.fn.fnameescape(path))
|
||||
-- Slow context needs a small delay to get things up to date
|
||||
if helpers.is_slow() then sleep(small_time) end
|
||||
end
|
||||
|
||||
local set_ref_text = function(...)
|
||||
local res = child.lua_get([[require('mini.diff').set_ref_text(...)]], { ... })
|
||||
-- Slow context needs a small delay to get things up to date
|
||||
if helpers.is_slow() then sleep(small_time) end
|
||||
end
|
||||
|
||||
local get_buf_hunks = function(buf_id)
|
||||
buf_id = buf_id or 0
|
||||
@ -62,12 +77,9 @@ end
|
||||
|
||||
local is_buf_enabled = function(buf_id) return get_buf_data(buf_id) ~= vim.NIL end
|
||||
|
||||
-- Common mocks
|
||||
local small_time = 10
|
||||
|
||||
-- - Dummy source, which is set by default in most tests
|
||||
local setup_with_dummy_source = function(text_change_delay)
|
||||
text_change_delay = text_change_delay or small_time
|
||||
text_change_delay = text_change_delay or dummy_text_change_delay
|
||||
child.lua([[
|
||||
_G.dummy_log = {}
|
||||
_G.dummy_source = {
|
||||
@ -106,7 +118,7 @@ end
|
||||
local mock_change_git_index = function()
|
||||
local index_path = git_git_dir .. '/index'
|
||||
child.fn.writefile({}, index_path .. '.lock')
|
||||
sleep(1)
|
||||
sleep(micro_time)
|
||||
child.fn.delete(index_path)
|
||||
child.loop.fs_rename(index_path .. '.lock', index_path)
|
||||
end
|
||||
@ -132,6 +144,7 @@ local validate_git_spawn_log = function(ref_log)
|
||||
elseif islist(ref) then
|
||||
eq(real, { executable = 'git', options = { args = ref, cwd = real.options.cwd } })
|
||||
else
|
||||
if real.options.cwd ~= nil then real.options.cwd = vim.fs.normalize(real.options.cwd) end
|
||||
eq(real, { executable = 'git', options = ref })
|
||||
end
|
||||
end
|
||||
@ -318,6 +331,11 @@ T['setup()']['validates `config` argument'] = function()
|
||||
expect_config_error({ options = { wrap_goto = 'a' } }, 'options.wrap_goto', 'boolean')
|
||||
end
|
||||
|
||||
T['setup()']['ensures colors'] = function()
|
||||
child.cmd('colorscheme default')
|
||||
expect.match(child.cmd_capture('hi MiniDiffOverAdd'), 'links to DiffAdd')
|
||||
end
|
||||
|
||||
T['setup()']['auto enables in all existing buffers'] = function()
|
||||
local buf_id_normal = new_buf()
|
||||
set_buf(buf_id_normal)
|
||||
@ -386,7 +404,7 @@ T['enable()']['makes sure buffer is loaded'] = function()
|
||||
end
|
||||
|
||||
T['enable()']['makes buffer update cache on `BufWinEnter`'] = function()
|
||||
eq(get_buf_data().config.delay.text_change, small_time)
|
||||
eq(get_buf_data().config.delay.text_change, dummy_text_change_delay)
|
||||
child.b.minidiff_config = { delay = { text_change = 200 } }
|
||||
child.api.nvim_exec_autocmds('BufWinEnter', { buffer = get_buf() })
|
||||
eq(get_buf_data().config.delay.text_change, 200)
|
||||
@ -846,7 +864,7 @@ T['gen_source']['git()']['can apply hunks'] = function()
|
||||
|
||||
-- Make change
|
||||
type_keys('G', 'cc', 'world')
|
||||
sleep(small_time + 5)
|
||||
sleep(small_time)
|
||||
|
||||
local ref_hunks = {
|
||||
{ buf_start = 0, buf_count = 0, ref_start = 1, ref_count = 2, type = 'delete' },
|
||||
@ -967,11 +985,13 @@ T['gen_source']['git()']['returns correct structure'] = function()
|
||||
end
|
||||
|
||||
T['gen_source']['git()']["reacts to change in 'index' Git file"] = function()
|
||||
helpers.skip_if_slow()
|
||||
|
||||
child.lua([[
|
||||
_G.stdio_queue = {
|
||||
{ { 'out', _G.git_dir } }, -- Get path to repo's Git dir
|
||||
{ { 'out', 'Line 1\nLine 2\n' } }, -- Get reference text
|
||||
{ { 'out', 'Line 1\nLine 22\n' } }, -- Get reference text after 'index' update
|
||||
{ { 'out', _G.git_dir } }, -- Get path to repo's Git dir
|
||||
{ { 'out', 'Line 1\nLine 2\n' } }, -- Get reference text
|
||||
{ { 'out', 'Line 1\nLine 22\n' } }, -- Get reference text after 'index' update
|
||||
}
|
||||
]])
|
||||
|
||||
@ -982,30 +1002,33 @@ T['gen_source']['git()']["reacts to change in 'index' Git file"] = function()
|
||||
-- Emulate change in 'index' as it is done by Git
|
||||
mock_count_set_ref_text()
|
||||
|
||||
-- Use slightly bigger yet constrained delay for more robust tests
|
||||
local small_time_bigger = math.min(2 * small_time, 0.9 * default_watch_debounce_delay)
|
||||
|
||||
-- Should react to change in 'index' file by reasking reference text
|
||||
-- These reactions should be debounced (currently by 50 ms)
|
||||
-- These reactions should be debounced
|
||||
mock_change_git_index()
|
||||
sleep(50 - 20)
|
||||
sleep(default_watch_debounce_delay - small_time_bigger)
|
||||
-- - No changes as less than 50 ms has passed
|
||||
eq(get_buf_data(0).ref_text, 'Line 1\nLine 2\n')
|
||||
eq(child.lua_get('_G.n_set_ref_text_calls'), 0)
|
||||
|
||||
mock_change_git_index()
|
||||
sleep(50 - 20)
|
||||
sleep(default_watch_debounce_delay - small_time_bigger)
|
||||
eq(child.lua_get('_G.n_set_ref_text_calls'), 0)
|
||||
sleep(20 + 5)
|
||||
sleep(small_time_bigger + small_time)
|
||||
eq(get_buf_data(0).ref_text, 'Line 1\nLine 22\n')
|
||||
eq(child.lua_get('_G.n_set_ref_text_calls'), 1)
|
||||
|
||||
-- Should react __only__ to changes in 'index' file
|
||||
child.fn.writefile({}, git_git_dir .. '/index.lock')
|
||||
sleep(50 + 5)
|
||||
sleep(default_watch_debounce_delay + small_time)
|
||||
eq(child.lua_get('_G.n_set_ref_text_calls'), 1)
|
||||
|
||||
-- Should stop reacting after detaching
|
||||
disable()
|
||||
mock_change_git_index()
|
||||
sleep(10 + 5)
|
||||
sleep(2 * small_time)
|
||||
eq(child.lua_get('_G.n_set_ref_text_calls'), 1)
|
||||
|
||||
-- Should make proper process spawns
|
||||
@ -1162,7 +1185,7 @@ T['gen_source']['save()']['works'] = function()
|
||||
-- Should update reference text on save
|
||||
validate_ref_text('aaa\nuuu\n')
|
||||
type_keys('G', 'o', 'vvv', '<Esc>')
|
||||
sleep(small_time + 5)
|
||||
sleep(small_time + small_time)
|
||||
validate_ref_text('aaa\nuuu\n')
|
||||
child.cmd('write')
|
||||
validate_ref_text('aaa\nuuu\nvvv\n')
|
||||
@ -1176,7 +1199,13 @@ T['gen_source']['save()']['works'] = function()
|
||||
local cur_changedtick = child.api.nvim_buf_get_changedtick(0)
|
||||
child.cmd('silent! checktime')
|
||||
-- - Wait for `:checktime` itself to process
|
||||
vim.wait(500, function() return child.api.nvim_buf_get_changedtick(0) ~= cur_changedtick end, 10)
|
||||
for _ = 1, 100 do
|
||||
if child.api.nvim_buf_get_changedtick(0) ~= cur_changedtick then break end
|
||||
vim.loop.sleep(small_time)
|
||||
end
|
||||
if child.api.nvim_buf_get_changedtick(0) == cur_changedtick then
|
||||
MiniTest.skip('Could not wait for `silent! checktime` to take effect')
|
||||
end
|
||||
validate_ref_text('bbb\nxxx\n')
|
||||
|
||||
-- Should clean up buffer autocommands on detach
|
||||
@ -1888,14 +1917,14 @@ T['Visualization']['works'] = function()
|
||||
type_keys('o', 'hello')
|
||||
validate_viz_extmarks(0, init_viz_extmarks)
|
||||
|
||||
sleep(small_time - 5)
|
||||
sleep(dummy_text_change_delay - 2 * small_time)
|
||||
validate_viz_extmarks(0, init_viz_extmarks)
|
||||
|
||||
type_keys('<CR>', 'world')
|
||||
sleep(small_time - 5)
|
||||
sleep(dummy_text_change_delay - 2 * small_time)
|
||||
validate_viz_extmarks(0, init_viz_extmarks)
|
||||
|
||||
sleep(5 + 5)
|
||||
sleep(2 * small_time + small_time)
|
||||
validate_viz_extmarks(0, {
|
||||
{ line = 2, sign_hl_group = 'MiniDiffSignAdd', sign_text = '▒ ' },
|
||||
{ line = 4, sign_hl_group = 'MiniDiffSignChange', sign_text = '▒ ' },
|
||||
@ -1984,6 +2013,7 @@ end
|
||||
|
||||
T['Visualization']['reacts to hunk lines delete/move'] = function()
|
||||
if child.fn.has('nvim-0.10') == 0 then MiniTest.skip('Reaction to line delete/move is available on Neovim>0.10.') end
|
||||
child.o.signcolumn = 'yes'
|
||||
|
||||
set_lines({ 'aaa', 'bbb', 'uuu', 'vvv', 'ccc', 'ddd' })
|
||||
set_ref_text(0, { 'aaa', 'bbb', 'ccc', 'ddd' })
|
||||
@ -1998,7 +2028,7 @@ T['Visualization']['reacts to hunk lines delete/move'] = function()
|
||||
-- Should be immediately not drawn (invalidated)
|
||||
child.expect_screenshot()
|
||||
|
||||
sleep(small_time + 5)
|
||||
sleep(dummy_text_change_delay + small_time)
|
||||
validate_viz_extmarks(0, {
|
||||
{ line = 2, sign_hl_group = 'MiniDiffSignAdd', sign_text = '▒ ' },
|
||||
{ line = 3, sign_hl_group = 'MiniDiffSignAdd', sign_text = '▒ ' },
|
||||
@ -2017,7 +2047,7 @@ T['Visualization']['forces redraw when it is needed'] = function()
|
||||
set_ref_text(0, { 'aaa' })
|
||||
|
||||
type_keys('gg', '<C-y>')
|
||||
sleep(small_time + 5)
|
||||
sleep(dummy_text_change_delay + small_time)
|
||||
validate_viz_extmarks(0, { { line = 2, sign_hl_group = 'MiniDiffSignAdd', sign_text = '▒ ' } })
|
||||
child.expect_screenshot()
|
||||
|
||||
@ -2126,7 +2156,7 @@ T['Overlay']['works'] = function()
|
||||
type_keys('A', '<CR>', 'EeE')
|
||||
|
||||
child.expect_screenshot()
|
||||
sleep(small_time + 5)
|
||||
sleep(dummy_text_change_delay + small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
@ -2317,7 +2347,9 @@ T['Diff']['works'] = function()
|
||||
eq(get_buf_hunks(0), ref_hunks_before)
|
||||
eq(get_buf_hunks(other_buf_id), ref_hunks_before)
|
||||
|
||||
sleep(small_time - 5)
|
||||
local small_time_bigger = 2 * small_time
|
||||
|
||||
sleep(dummy_text_change_delay - small_time_bigger)
|
||||
eq(get_buf_hunks(0), ref_hunks_before)
|
||||
eq(get_buf_hunks(other_buf_id), ref_hunks_before)
|
||||
|
||||
@ -2325,11 +2357,11 @@ T['Diff']['works'] = function()
|
||||
set_cursor(2, 0)
|
||||
type_keys('o', 'world', '<Esc>')
|
||||
|
||||
sleep(small_time - 5)
|
||||
sleep(dummy_text_change_delay - small_time_bigger)
|
||||
eq(get_buf_hunks(0), ref_hunks_before)
|
||||
eq(get_buf_hunks(other_buf_id), ref_hunks_before)
|
||||
|
||||
sleep(5 + 5)
|
||||
sleep(small_time_bigger + small_time)
|
||||
|
||||
local ref_hunks_after = { { buf_start = 2, buf_count = 2, ref_start = 1, ref_count = 0, type = 'add' } }
|
||||
eq(get_buf_hunks(0), ref_hunks_after)
|
||||
@ -2429,7 +2461,7 @@ T['Diff']['redraws statusline when diff is updated'] = function()
|
||||
|
||||
set_cursor(2, 0)
|
||||
type_keys('o', 'hello')
|
||||
sleep(small_time + 5)
|
||||
sleep(dummy_text_change_delay + small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
@ -2444,7 +2476,7 @@ T['Diff']['triggers dedicated event'] = function()
|
||||
type_keys('o', 'hello')
|
||||
|
||||
eq(child.lua_get('_G.n'), 1)
|
||||
sleep(small_time + 5)
|
||||
sleep(dummy_text_change_delay + small_time)
|
||||
eq(child.lua_get('_G.n'), 2)
|
||||
end
|
||||
|
||||
|
||||
@ -12,8 +12,7 @@ local get_cursor = function(...) return child.get_cursor(...) end
|
||||
local set_lines = function(...) return child.set_lines(...) end
|
||||
local get_lines = function(...) return child.get_lines(...) end
|
||||
local type_keys = function(...) return child.type_keys(...) end
|
||||
local poke_eventloop = function() child.api.nvim_eval('1') end
|
||||
local sleep = function(ms) vim.loop.sleep(ms); poke_eventloop() end
|
||||
local sleep = function(ms) helpers.sleep(ms, child) end
|
||||
--stylua: ignore end
|
||||
|
||||
-- TODO: Remove after compatibility with Neovim=0.9 is dropped
|
||||
@ -28,15 +27,12 @@ child.expect_screenshot = function(opts)
|
||||
end
|
||||
|
||||
-- Test paths helpers
|
||||
local join_path = function(...) return table.concat({ ... }, '/') end
|
||||
|
||||
local full_path = function(x)
|
||||
local res = child.fn.fnamemodify(x, ':p'):gsub('(.)/$', '%1')
|
||||
return res
|
||||
end
|
||||
local path_sep = package.config:sub(1, 1)
|
||||
local join_path = function(...) return (table.concat({ ... }, path_sep):gsub('([\\/])[\\/]*', '%1')) end
|
||||
local full_path = function(x) return (child.fn.fnamemodify(x, ':p'):gsub('(.)[\\/]$', '%1')) end
|
||||
|
||||
local test_dir = 'tests/dir-extra'
|
||||
local test_dir_absolute = vim.fn.fnamemodify(test_dir, ':p'):gsub('(.)/$', '%1')
|
||||
local test_dir_absolute = vim.fn.fnamemodify(test_dir, ':p'):gsub('(.)[\\/]$', '%1')
|
||||
local real_files_dir = 'tests/dir-extra/real-files'
|
||||
|
||||
local make_testpath = function(...) return join_path(test_dir, ...) end
|
||||
@ -63,7 +59,6 @@ local is_picker_active = forward_lua('MiniPick.is_picker_active')
|
||||
local validate_buf_name = function(buf_id, name)
|
||||
buf_id = buf_id or child.api.nvim_get_current_buf()
|
||||
name = name ~= '' and full_path(name) or ''
|
||||
name = name:gsub('/+$', '')
|
||||
eq(child.api.nvim_buf_get_name(buf_id), name)
|
||||
end
|
||||
|
||||
@ -191,6 +186,31 @@ local get_process_log = function() return child.lua_get('_G.process_log') end
|
||||
|
||||
local clear_process_log = function() child.lua('_G.process_log = {}') end
|
||||
|
||||
-- Mock consistent paths for more robust screenshot testing
|
||||
local mock_slash_path_sep = function()
|
||||
if path_sep == '/' then return end
|
||||
child.lua([[
|
||||
_G.fnamemodify_orig = vim.fn.fnamemodify
|
||||
vim.fn.fnamemodify = function(...)
|
||||
return (_G.fnamemodify_orig(...):gsub('\\', '/'))
|
||||
end
|
||||
|
||||
_G.getcwd_orig = vim.fn.getcwd
|
||||
vim.fn.getcwd = function() return (getcwd_orig():gsub('\\', '/')) end
|
||||
]])
|
||||
end
|
||||
|
||||
local unmock_slash_path_sep = function()
|
||||
if path_sep == '/' then return end
|
||||
child.lua([[
|
||||
package.config = _G.package_config_orig
|
||||
vim.fn.fnamemodify, vim.fn.getcwd = _G.fnamemodify_orig, _G.getcwd_orig
|
||||
]])
|
||||
end
|
||||
|
||||
-- Time constants
|
||||
local small_time = helpers.get_time_const(10)
|
||||
|
||||
-- Output test set ============================================================
|
||||
local T = new_set({
|
||||
hooks = {
|
||||
@ -198,9 +218,9 @@ local T = new_set({
|
||||
child.setup()
|
||||
|
||||
-- Make more comfortable screenshots
|
||||
child.set_size(15, 40)
|
||||
child.o.laststatus = 0
|
||||
child.o.ruler = false
|
||||
child.set_size(15, 40)
|
||||
end,
|
||||
post_once = child.stop,
|
||||
},
|
||||
@ -310,7 +330,7 @@ T['gen_ai_spec']['diagnostic()'] = new_set({
|
||||
hooks = {
|
||||
pre_case = function()
|
||||
local mock_path = make_testpath('mocks', 'diagnostic.lua')
|
||||
child.lua(string.format('dofile("%s")', mock_path))
|
||||
child.lua(string.format('dofile(%s)', vim.inspect(mock_path)))
|
||||
end,
|
||||
},
|
||||
})
|
||||
@ -782,6 +802,78 @@ T['pickers']['buf_lines()']['respects `local_opts.scope`'] = function()
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
T['pickers']['buf_lines()']['respects `local_opts.preserve_order`'] = function()
|
||||
set_lines({ 'axay', 'b', 'aaxy', 'ccc', 'xaa' })
|
||||
pick_buf_lines({ scope = 'current', preserve_order = true })
|
||||
|
||||
type_keys('x')
|
||||
eq(get_picker_matches().all_inds, { 1, 3, 5 })
|
||||
type_keys('y')
|
||||
eq(get_picker_matches().all_inds, { 1, 3 })
|
||||
end
|
||||
|
||||
T['pickers']['buf_lines()']['pads line numbers'] = function()
|
||||
local set_n_lines = function(buf_id, prefix, n)
|
||||
local lines = {}
|
||||
for i = 1, n do
|
||||
lines[i] = prefix .. '-' .. i
|
||||
end
|
||||
child.api.nvim_buf_set_lines(buf_id, 0, -1, false, lines)
|
||||
end
|
||||
|
||||
local buf_id_1 = child.api.nvim_create_buf(true, false)
|
||||
set_n_lines(buf_id_1, 'buf-1', 9)
|
||||
|
||||
local buf_id_2 = child.api.nvim_create_buf(true, false)
|
||||
set_n_lines(buf_id_2, 'buf-2', 10)
|
||||
|
||||
local buf_id_3 = child.api.nvim_create_buf(true, false)
|
||||
set_n_lines(buf_id_3, 'buf-3', 99)
|
||||
|
||||
local buf_id_4 = child.api.nvim_create_buf(true, false)
|
||||
set_n_lines(buf_id_4, 'buf-4', 100)
|
||||
|
||||
-- Should pad line numbers to achieve more aligned look
|
||||
child.lua_notify('MiniExtra.pickers.buf_lines()')
|
||||
sleep(small_time)
|
||||
local items = get_picker_items()
|
||||
|
||||
local validate_has_item_with_text = function(text)
|
||||
local res = false
|
||||
for _, item in ipairs(items) do
|
||||
if item.text == text then res = true end
|
||||
end
|
||||
eq(res, true)
|
||||
end
|
||||
|
||||
validate_has_item_with_text('\0001\000buf-1-1')
|
||||
validate_has_item_with_text('\0009\000buf-1-9')
|
||||
|
||||
validate_has_item_with_text('\000 1\000buf-2-1')
|
||||
validate_has_item_with_text('\000 9\000buf-2-9')
|
||||
validate_has_item_with_text('\00010\000buf-2-10')
|
||||
|
||||
validate_has_item_with_text('\000 1\000buf-3-1')
|
||||
validate_has_item_with_text('\00099\000buf-3-99')
|
||||
|
||||
validate_has_item_with_text('\000 1\000buf-4-1')
|
||||
validate_has_item_with_text('\000 99\000buf-4-99')
|
||||
validate_has_item_with_text('\000100\000buf-4-100')
|
||||
|
||||
type_keys('<C-c>')
|
||||
|
||||
-- Should work with `scope='current'`
|
||||
child.api.nvim_set_current_buf(buf_id_4)
|
||||
child.lua_notify('MiniExtra.pickers.buf_lines({ scope = "current" })')
|
||||
sleep(small_time)
|
||||
items = get_picker_items()
|
||||
|
||||
validate_has_item_with_text(' 1\000buf-4-1')
|
||||
validate_has_item_with_text(' 99\000buf-4-99')
|
||||
validate_has_item_with_text('100\000buf-4-100')
|
||||
type_keys('<C-c>')
|
||||
end
|
||||
|
||||
T['pickers']['buf_lines()']['can not show icons'] = function()
|
||||
setup_buffers()
|
||||
child.lua('MiniPick.config.source.show = MiniPick.default_show')
|
||||
@ -859,7 +951,7 @@ T['pickers']['diagnostic()'] = new_set({
|
||||
hooks = {
|
||||
pre_case = function()
|
||||
local mock_path = make_testpath('mocks', 'diagnostic.lua')
|
||||
child.lua(string.format('dofile("%s")', mock_path))
|
||||
child.lua(string.format('dofile(%s)', vim.inspect(mock_path)))
|
||||
end,
|
||||
},
|
||||
})
|
||||
@ -870,6 +962,7 @@ T['pickers']['diagnostic()']['works'] = function()
|
||||
child.set_size(25, 100)
|
||||
child.cmd('enew')
|
||||
|
||||
mock_slash_path_sep()
|
||||
child.lua_notify('_G.return_item = MiniExtra.pickers.diagnostic()')
|
||||
validate_picker_name('Diagnostic (all)')
|
||||
child.expect_screenshot()
|
||||
@ -894,6 +987,7 @@ T['pickers']['diagnostic()']['works'] = function()
|
||||
type_keys('<C-n>')
|
||||
type_keys('<Tab>')
|
||||
child.expect_screenshot()
|
||||
unmock_slash_path_sep()
|
||||
|
||||
-- Should properly choose
|
||||
type_keys('<CR>')
|
||||
@ -940,6 +1034,9 @@ T['pickers']['diagnostic()']['respects `local_opts.sort_by`'] = function()
|
||||
|
||||
local path_1 = make_testpath('mocks', 'diagnostic-file-1')
|
||||
local path_2 = make_testpath('mocks', 'diagnostic-file-2')
|
||||
if path_sep == '\\' then
|
||||
path_1, path_2 = (path_1:gsub('/', '\\')), (path_2:gsub('/', '\\'))
|
||||
end
|
||||
|
||||
pick_diagnostic({ sort_by = 'severity' })
|
||||
--stylua: ignore
|
||||
@ -998,7 +1095,7 @@ end
|
||||
|
||||
T['pickers']['diagnostic()']["forces 'buflisted' on opened buffer"] = function()
|
||||
-- This matters for project wide diagnostic done inside unlisted buffers
|
||||
child.api.nvim_buf_set_option(child.lua_get('_G.buf_id_2'), 'buflisted', false)
|
||||
child.lua('vim.bo[_G.buf_id_2].buflisted = false')
|
||||
|
||||
pick_diagnostic()
|
||||
type_keys('<C-p>', '<CR>')
|
||||
@ -1031,7 +1128,7 @@ T['pickers']['explorer()']['works'] = function()
|
||||
type_keys('<C-n>', '<CR>')
|
||||
child.expect_screenshot()
|
||||
validate_picker_name('File explorer')
|
||||
validate_picker_cwd(join_path(init_dir, 'dir1'))
|
||||
validate_picker_cwd(init_dir .. '/dir1')
|
||||
|
||||
-- - Should actually change items
|
||||
eq(vim.deep_equal(init_items, get_picker_items()), false)
|
||||
@ -1055,7 +1152,7 @@ T['pickers']['explorer()']['works'] = function()
|
||||
eq(get_lines(), { 'File 3' })
|
||||
|
||||
-- Should return chosen value
|
||||
eq(child.lua_get('_G.return_item'), { fs_type = 'file', path = join_path(init_dir, 'file3'), text = 'file3' })
|
||||
eq(child.lua_get('_G.return_item'), { fs_type = 'file', path = init_dir .. '/file3', text = 'file3' })
|
||||
end
|
||||
|
||||
T['pickers']['explorer()']['works with query'] = function()
|
||||
@ -1064,12 +1161,12 @@ T['pickers']['explorer()']['works with query'] = function()
|
||||
|
||||
pick_explorer()
|
||||
type_keys('^D')
|
||||
eq(get_picker_matches().all, { { fs_type = 'directory', path = join_path(init_dir, 'Dir2'), text = 'Dir2/' } })
|
||||
eq(get_picker_matches().all, { { fs_type = 'directory', path = init_dir .. '/Dir2', text = 'Dir2/' } })
|
||||
|
||||
type_keys('<CR>')
|
||||
eq(get_picker_matches().all, {
|
||||
{ fs_type = 'directory', path = init_dir, text = '..' },
|
||||
{ fs_type = 'file', path = join_path(init_dir, 'Dir2', 'file2-1'), text = 'file2-1' },
|
||||
{ fs_type = 'file', path = init_dir .. '/Dir2/file2-1', text = 'file2-1' },
|
||||
})
|
||||
-- - Should reset the query
|
||||
eq(child.lua_get('MiniPick.get_picker_query()'), {})
|
||||
@ -1084,7 +1181,7 @@ T['pickers']['explorer()']['can be resumed'] = function()
|
||||
stop_picker()
|
||||
|
||||
child.lua_notify('MiniPick.builtin.resume()')
|
||||
validate_picker_cwd(join_path(init_dir, 'dir1'))
|
||||
validate_picker_cwd(init_dir .. '/dir1')
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
@ -1627,7 +1724,7 @@ T['pickers']['git_hunks()']['works'] = function()
|
||||
local return_item_keys = vim.tbl_keys(return_item)
|
||||
table.sort(return_item_keys)
|
||||
eq(return_item_keys, { 'header', 'hunk', 'lnum', 'path', 'text' })
|
||||
eq(return_item.path, target_path)
|
||||
eq(return_item.path, 'git-files/git-file-2')
|
||||
eq(return_item.lnum, 12)
|
||||
end
|
||||
|
||||
@ -1779,12 +1876,13 @@ T['pickers']['hipatterns()'] = new_set()
|
||||
local pick_hipatterns = forward_lua_notify('MiniExtra.pickers.hipatterns')
|
||||
|
||||
local setup_hipatterns = function()
|
||||
child.lua('_G.delay = ' .. (2 * small_time))
|
||||
child.lua([[require('mini.hipatterns').setup({
|
||||
highlighters = {
|
||||
minmax = { pattern = { 'min', 'max' }, group = 'Error' },
|
||||
['local'] = { pattern = 'local', group = 'Comment' },
|
||||
},
|
||||
delay = { text_change = 20 },
|
||||
delay = { text_change = _G.delay },
|
||||
})]])
|
||||
child.cmd('edit ' .. real_file('a.lua'))
|
||||
local buf_id_1 = child.api.nvim_create_buf(true, false)
|
||||
@ -1792,7 +1890,7 @@ local setup_hipatterns = function()
|
||||
local buf_id_2 = child.api.nvim_create_buf(true, false)
|
||||
child.api.nvim_set_current_buf(buf_id_2)
|
||||
child.api.nvim_buf_set_lines(buf_id_2, 0, -1, false, { '', 'min', 'max', 'local' })
|
||||
sleep(20 + 5)
|
||||
sleep(2 * small_time + small_time)
|
||||
|
||||
-- Should not be present in results
|
||||
local buf_id_not_enabled = child.api.nvim_create_buf(true, false)
|
||||
@ -1805,6 +1903,7 @@ T['pickers']['hipatterns()']['works'] = function()
|
||||
child.set_size(15, 120)
|
||||
local _, buf_id_2 = setup_hipatterns()
|
||||
|
||||
mock_slash_path_sep()
|
||||
child.lua_notify('_G.return_item = MiniExtra.pickers.hipatterns()')
|
||||
validate_picker_name('Mini.hipatterns matches (all)')
|
||||
child.expect_screenshot()
|
||||
@ -1863,6 +1962,7 @@ T['pickers']['hipatterns()']['respects `local_opts.highlighters`'] = function()
|
||||
child.set_size(15, 120)
|
||||
setup_hipatterns()
|
||||
|
||||
mock_slash_path_sep()
|
||||
pick_hipatterns({ highlighters = { 'minmax' } })
|
||||
child.expect_screenshot()
|
||||
stop_picker()
|
||||
@ -2251,6 +2351,7 @@ local validate_qf_loc = function(scope)
|
||||
child.set_size(20, 70)
|
||||
|
||||
-- Setup quickfix/location list
|
||||
mock_slash_path_sep()
|
||||
local path = real_file('a.lua')
|
||||
child.cmd('edit ' .. path)
|
||||
child.cmd('enew')
|
||||
@ -2307,6 +2408,7 @@ T['pickers']['list()']['works for `jump`'] = function()
|
||||
type_keys('G', 'gg')
|
||||
|
||||
-- Start picker
|
||||
mock_slash_path_sep()
|
||||
child.lua_notify([[_G.return_item = MiniExtra.pickers.list({ scope = 'jump' })]])
|
||||
validate_picker_name('List (jump)')
|
||||
child.expect_screenshot()
|
||||
@ -2331,7 +2433,7 @@ T['pickers']['list()']['works for `change`'] = function()
|
||||
child.set_size(20, 70)
|
||||
|
||||
-- Setup jump list
|
||||
local path = real_file('a.lua')
|
||||
local path = real_file('a.lua'):gsub('\\', '/')
|
||||
child.cmd('edit ' .. path)
|
||||
set_cursor(1, 1)
|
||||
type_keys('i', ' Change 1 ', '<Esc>')
|
||||
@ -2340,6 +2442,7 @@ T['pickers']['list()']['works for `change`'] = function()
|
||||
type_keys('i', ' Change 2 ', '<Esc>')
|
||||
|
||||
-- Start picker
|
||||
mock_slash_path_sep()
|
||||
child.lua_notify([[_G.return_item = MiniExtra.pickers.list({ scope = 'change' })]])
|
||||
validate_picker_name('List (change)')
|
||||
child.expect_screenshot()
|
||||
@ -2408,6 +2511,7 @@ end
|
||||
local validate_location_scope = function(scope)
|
||||
local file_path, file_path_full = setup_lsp()
|
||||
|
||||
mock_slash_path_sep()
|
||||
pick_lsp({ scope = scope })
|
||||
eq(child.lua_get('_G.lsp_buf_calls'), { scope })
|
||||
validate_picker_name('LSP (' .. scope .. ')')
|
||||
@ -2416,6 +2520,7 @@ local validate_location_scope = function(scope)
|
||||
-- Should preview position
|
||||
type_keys('<Tab>')
|
||||
child.expect_screenshot()
|
||||
unmock_slash_path_sep()
|
||||
|
||||
-- Should have proper items
|
||||
local ref_item = {
|
||||
@ -2423,7 +2528,7 @@ local validate_location_scope = function(scope)
|
||||
path = file_path_full,
|
||||
lnum = 3,
|
||||
col = 16,
|
||||
text = file_path .. '│3│16│ x = math.max(a, 2),',
|
||||
text = file_path:gsub('\\', '/') .. '│3│16│ x = math.max(a, 2),',
|
||||
}
|
||||
eq(get_picker_items()[1], ref_item)
|
||||
|
||||
@ -2433,9 +2538,10 @@ local validate_location_scope = function(scope)
|
||||
eq(get_cursor(), { 3, 15 })
|
||||
end
|
||||
|
||||
local validate_symbol_scope = function(scope)
|
||||
local validate_symbol_scope = function(scope, skip_preview)
|
||||
local file_path, file_path_full = setup_lsp()
|
||||
|
||||
mock_slash_path_sep()
|
||||
pick_lsp({ scope = scope })
|
||||
validate_picker_name('LSP (' .. scope .. ')')
|
||||
eq(child.lua_get('_G.lsp_buf_calls'), { scope })
|
||||
@ -2459,19 +2565,25 @@ local validate_symbol_scope = function(scope)
|
||||
eq(get_extra_picker_extmarks(0, -1), ref_extmark_data)
|
||||
|
||||
-- Should preview position
|
||||
type_keys('<Tab>')
|
||||
child.expect_screenshot()
|
||||
if not skip_preview then
|
||||
type_keys('<Tab>')
|
||||
child.expect_screenshot()
|
||||
end
|
||||
unmock_slash_path_sep()
|
||||
|
||||
-- Should have proper items
|
||||
local text_prefix = scope == 'workspace_symbol' and (file_path .. '│1│7│ ') or ''
|
||||
if has_mini_icons then text_prefix = ' ' .. text_prefix end
|
||||
local text_prefix = scope == 'workspace_symbol' and (file_path:gsub('\\', '/') .. '│1│7│ ') or ''
|
||||
local kind_name = child.lua_get('vim.lsp.protocol.SymbolKind[16]')
|
||||
-- - Icon should be added only if it is not already assumed to be inside
|
||||
-- `SymbolKind` map (as after `MiniIcons.tweak_lsp_kind()`).
|
||||
if has_mini_icons and kind_name == 'Number' then text_prefix = ' ' .. text_prefix end
|
||||
local ref_item = {
|
||||
filename = file_path_full,
|
||||
path = file_path_full,
|
||||
lnum = 1,
|
||||
col = 7,
|
||||
kind = 'Number',
|
||||
text = text_prefix .. '[Number] a',
|
||||
text = text_prefix .. '[' .. kind_name .. '] a',
|
||||
hl = ref_extmark_data[1].hl_group,
|
||||
}
|
||||
eq(get_picker_items()[1], ref_item)
|
||||
@ -2482,6 +2594,16 @@ local validate_symbol_scope = function(scope)
|
||||
eq(get_cursor(), { 1, 6 })
|
||||
end
|
||||
|
||||
local validate_symbol_scope_with_tweaked_kind = function(scope, tweak_lsp_kind_mode)
|
||||
child.lua('_G.symbol_kind_orig = vim.deepcopy(vim.lsp.protocol.SymbolKind)')
|
||||
child.lua("require('mini.icons').setup()")
|
||||
child.lua('MiniIcons.tweak_lsp_kind(...)', { tweak_lsp_kind_mode })
|
||||
|
||||
validate_symbol_scope(scope, true)
|
||||
|
||||
child.lua('vim.lsp.protocol.SymbolKind = _G.symbol_kind_orig')
|
||||
end
|
||||
|
||||
T['pickers']['lsp()']['works for `declaration`'] = function() validate_location_scope('declaration') end
|
||||
|
||||
T['pickers']['lsp()']['works for `definition`'] = function() validate_location_scope('definition') end
|
||||
@ -2493,11 +2615,18 @@ T['pickers']['lsp()']["works for `document_symbol` with 'mini.icons' set up"] =
|
||||
validate_symbol_scope('document_symbol')
|
||||
end
|
||||
|
||||
T['pickers']['lsp()']['works for `document_symbol` after `MiniIcons.tweak_lsp_kind()`'] = function()
|
||||
validate_symbol_scope_with_tweaked_kind('document_symbol', 'prepend')
|
||||
validate_symbol_scope_with_tweaked_kind('document_symbol', 'append')
|
||||
validate_symbol_scope_with_tweaked_kind('document_symbol', 'replace')
|
||||
end
|
||||
|
||||
T['pickers']['lsp()']['works for `implementation`'] = function() validate_location_scope('implementation') end
|
||||
|
||||
T['pickers']['lsp()']['works for `references`'] = function()
|
||||
local file_path, file_path_full = setup_lsp()
|
||||
|
||||
mock_slash_path_sep()
|
||||
pick_lsp({ scope = 'references' })
|
||||
validate_picker_name('LSP (references)')
|
||||
eq(child.lua_get('_G.lsp_buf_calls'), { 'references' })
|
||||
@ -2506,6 +2635,7 @@ T['pickers']['lsp()']['works for `references`'] = function()
|
||||
-- Should preview position
|
||||
type_keys('<C-n>', '<Tab>')
|
||||
child.expect_screenshot()
|
||||
unmock_slash_path_sep()
|
||||
|
||||
-- Should have proper items
|
||||
local ref_item = {
|
||||
@ -2513,7 +2643,7 @@ T['pickers']['lsp()']['works for `references`'] = function()
|
||||
path = file_path_full,
|
||||
lnum = 3,
|
||||
col = 16,
|
||||
text = file_path .. '│3│16│ x = math.max(a, 2),',
|
||||
text = file_path:gsub('\\', '/') .. '│3│16│ x = math.max(a, 2),',
|
||||
}
|
||||
eq(get_picker_items()[2], ref_item)
|
||||
|
||||
@ -2532,6 +2662,12 @@ T['pickers']['lsp()']["works for `workspace_symbol` with 'mini.icons' set up"] =
|
||||
validate_symbol_scope('workspace_symbol')
|
||||
end
|
||||
|
||||
T['pickers']['lsp()']['works for `workspace_symbol` after `MiniIcons.tweak_lsp_kind()`'] = function()
|
||||
validate_symbol_scope_with_tweaked_kind('workspace_symbol', 'prepend')
|
||||
validate_symbol_scope_with_tweaked_kind('workspace_symbol', 'append')
|
||||
validate_symbol_scope_with_tweaked_kind('workspace_symbol', 'replace')
|
||||
end
|
||||
|
||||
T['pickers']['lsp()']['respects `local_opts.symbol_query`'] = function()
|
||||
setup_lsp()
|
||||
|
||||
@ -2590,6 +2726,7 @@ T['pickers']['marks()']['works'] = function()
|
||||
child.set_size(20, 70)
|
||||
setup_marks()
|
||||
|
||||
mock_slash_path_sep()
|
||||
child.lua_notify('_G.return_item = MiniExtra.pickers.marks()')
|
||||
validate_picker_name('Marks (all)')
|
||||
child.expect_screenshot()
|
||||
@ -2601,6 +2738,7 @@ T['pickers']['marks()']['works'] = function()
|
||||
child.expect_screenshot()
|
||||
type_keys('<C-n>', '<C-n>', '<C-n>', '<C-n>')
|
||||
child.expect_screenshot()
|
||||
unmock_slash_path_sep()
|
||||
|
||||
-- Should properly choose by positioning on mark
|
||||
local path = real_file('a.lua')
|
||||
@ -2609,13 +2747,16 @@ T['pickers']['marks()']['works'] = function()
|
||||
eq(get_cursor(), { 1, 5 })
|
||||
|
||||
-- Should return chosen value
|
||||
eq(child.lua_get('_G.return_item'), { col = 6, lnum = 1, path = path, text = 'A │ ' .. path .. '│1│6' })
|
||||
local path_slash = path:gsub('\\', '/')
|
||||
local ref_item = { col = 6, lnum = 1, path = path_slash, text = 'A │ ' .. path_slash .. '│1│6' }
|
||||
eq(child.lua_get('_G.return_item'), ref_item)
|
||||
end
|
||||
|
||||
T['pickers']['marks()']['respects `local_opts.scope`'] = function()
|
||||
local buffers = setup_marks()
|
||||
child.set_size(15, 40)
|
||||
|
||||
mock_slash_path_sep()
|
||||
pick_marks({ scope = 'global' })
|
||||
child.expect_screenshot()
|
||||
stop_picker()
|
||||
@ -2644,12 +2785,18 @@ T['pickers']['marks()']['validates arguments'] = function()
|
||||
validate({ scope = '1' }, '`pickers%.marks`.*"scope".*"1".*one of')
|
||||
end
|
||||
|
||||
T['pickers']['oldfiles()'] = new_set()
|
||||
T['pickers']['oldfiles()'] = new_set({
|
||||
hooks = {
|
||||
pre_case = function()
|
||||
child.set_size(10, 70)
|
||||
mock_slash_path_sep()
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
local pick_oldfiles = forward_lua_notify('MiniExtra.pickers.oldfiles')
|
||||
|
||||
T['pickers']['oldfiles()']['works'] = function()
|
||||
child.set_size(10, 70)
|
||||
local path_1, path_2 = real_file('LICENSE'), make_testpath('mocks', 'diagnostic.lua')
|
||||
local ref_oldfiles = { full_path(path_1), full_path(path_2), 'not-existing' }
|
||||
child.v.oldfiles = ref_oldfiles
|
||||
@ -2657,9 +2804,11 @@ T['pickers']['oldfiles()']['works'] = function()
|
||||
child.lua_notify('_G.return_item = MiniExtra.pickers.oldfiles()')
|
||||
validate_picker_name('Old files')
|
||||
child.expect_screenshot()
|
||||
unmock_slash_path_sep()
|
||||
|
||||
-- Should have proper items (only readable files with short paths)
|
||||
eq(get_picker_items(), { path_1, path_2 })
|
||||
local path_1_slash, path_2_slash = (path_1:gsub('\\', '/')), (path_2:gsub('\\', '/'))
|
||||
eq(get_picker_items(), { path_1_slash, path_2_slash })
|
||||
|
||||
-- Should properly choose
|
||||
type_keys('<CR>')
|
||||
@ -2668,7 +2817,7 @@ T['pickers']['oldfiles()']['works'] = function()
|
||||
|
||||
--stylua: ignore
|
||||
-- Should return chosen value with proper structure
|
||||
eq(child.lua_get('_G.return_item'), path_1)
|
||||
eq(child.lua_get('_G.return_item'), path_1_slash)
|
||||
end
|
||||
|
||||
T['pickers']['oldfiles()']['works with empty `v:oldfiles`'] = function()
|
||||
@ -2700,6 +2849,17 @@ T['pickers']['oldfiles()']['respects `local_opts.current_dir'] = function()
|
||||
eq(items[1], 'LICENSE')
|
||||
end
|
||||
|
||||
T['pickers']['oldfiles()']['respects `local_opts.preserve_order`'] = function()
|
||||
child.lua('vim.fn.filereadable = function() return 1 end')
|
||||
child.v.oldfiles = { 'axay', 'b', 'aaxy', 'ccc', 'xaa' }
|
||||
pick_oldfiles({ preserve_order = true })
|
||||
|
||||
type_keys('x')
|
||||
eq(get_picker_matches().all_inds, { 1, 3, 5 })
|
||||
type_keys('y')
|
||||
eq(get_picker_matches().all_inds, { 1, 3 })
|
||||
end
|
||||
|
||||
T['pickers']['oldfiles()']['respects `opts`'] = function()
|
||||
pick_oldfiles({}, { source = { name = 'My name' } })
|
||||
validate_picker_name('My name')
|
||||
@ -2999,7 +3159,7 @@ local setup_treesitter = function()
|
||||
local path = real_file('a.lua')
|
||||
child.cmd('edit ' .. path)
|
||||
child.lua('vim.treesitter.start()')
|
||||
sleep(10)
|
||||
sleep(small_time)
|
||||
|
||||
return path
|
||||
end
|
||||
@ -3045,22 +3205,25 @@ T['pickers']['treesitter()']['respects `opts`'] = function()
|
||||
end
|
||||
|
||||
local setup_visits = function()
|
||||
--stylua: ignore
|
||||
-- NOTE: 'mini.visits' uses forward slashes in index
|
||||
local dir = test_dir_absolute:gsub('\\', '/')
|
||||
local path_1 = full_path(make_testpath('git-files', 'git-file-1')):gsub('\\', '/')
|
||||
local path_2 = full_path(make_testpath('git-files', 'git-file-2')):gsub('\\', '/')
|
||||
local visit_index = {
|
||||
[test_dir_absolute] = {
|
||||
[join_path(test_dir_absolute, 'file-xyyx')] = { count = 5, latest = 5 },
|
||||
[join_path(test_dir_absolute, 'file-xx')] = { count = 1, labels = { xxx = true, uuu = true }, latest = 10 },
|
||||
[join_path(test_dir_absolute, 'file-xyx')] = { count = 10, labels = { xxx = true }, latest = 2 },
|
||||
[join_path(test_dir_absolute, 'real-files', 'a.lua')] = { count = 3, labels = { yyy = true }, latest = 3 },
|
||||
[dir] = {
|
||||
[dir .. '/file-xyyx'] = { count = 5, latest = 5 },
|
||||
[dir .. '/file-xx'] = { count = 1, labels = { xxx = true, uuu = true }, latest = 10 },
|
||||
[dir .. '/file-xyx'] = { count = 10, labels = { xxx = true }, latest = 2 },
|
||||
[dir .. '/real-files/a.lua'] = { count = 3, labels = { yyy = true }, latest = 3 },
|
||||
},
|
||||
[join_path(test_dir_absolute, 'git-files')] = {
|
||||
[full_path(make_testpath('git-files', 'git-file-1'))] = { count = 0, labels = { xxx = true, www = true }, latest = 0 },
|
||||
[full_path(make_testpath('git-files', 'git-file-2'))] = { count = 100, latest = 100 },
|
||||
[dir .. '/git-files'] = {
|
||||
[path_1] = { count = 0, labels = { xxx = true, www = true }, latest = 0 },
|
||||
[path_2] = { count = 100, latest = 100 },
|
||||
},
|
||||
}
|
||||
|
||||
child.lua([[require('mini.visits').set_index(...)]], { visit_index })
|
||||
child.fn.chdir(test_dir_absolute)
|
||||
child.fn.chdir(dir)
|
||||
end
|
||||
|
||||
T['pickers']['visit_paths()'] = new_set({ hooks = { pre_case = setup_visits } })
|
||||
@ -3083,7 +3246,7 @@ T['pickers']['visit_paths()']['works'] = function()
|
||||
validate_buf_name(0, join_path('real-files', 'a.lua'))
|
||||
|
||||
-- Should return chosen value
|
||||
eq(child.lua_get('_G.return_item'), join_path('real-files', 'a.lua'))
|
||||
eq(child.lua_get('_G.return_item'), 'real-files/a.lua')
|
||||
end
|
||||
|
||||
T['pickers']['visit_paths()']['respects `local_opts.cwd`'] = function()
|
||||
@ -3091,12 +3254,12 @@ T['pickers']['visit_paths()']['respects `local_opts.cwd`'] = function()
|
||||
validate_picker_name('Visit paths (all)')
|
||||
eq(get_picker_items(), {
|
||||
-- Should use short paths relative to the current working directory
|
||||
join_path('git-files', 'git-file-2'),
|
||||
'git-files/git-file-2',
|
||||
'file-xyyx',
|
||||
'file-xx',
|
||||
'file-xyx',
|
||||
join_path('real-files', 'a.lua'),
|
||||
join_path('git-files', 'git-file-1'),
|
||||
'real-files/a.lua',
|
||||
'git-files/git-file-1',
|
||||
})
|
||||
end
|
||||
|
||||
@ -3121,11 +3284,11 @@ end
|
||||
|
||||
T['pickers']['visit_paths()']['respects `local_opts.recency_weight`'] = function()
|
||||
pick_visit_paths({ recency_weight = 1 })
|
||||
eq(get_picker_items(), { 'file-xx', 'file-xyyx', join_path('real-files', 'a.lua'), 'file-xyx' })
|
||||
eq(get_picker_items(), { 'file-xx', 'file-xyyx', 'real-files/a.lua', 'file-xyx' })
|
||||
end
|
||||
|
||||
T['pickers']['visit_paths()']['respects `local_opts.sort`'] = function()
|
||||
child.lua([[_G.sort = function() return { { path = vim.fn.getcwd() .. '/aaa' } } end]])
|
||||
child.lua([[_G.sort = function() return { { path = vim.fn.getcwd():gsub('\\', '/') .. '/aaa' } } end]])
|
||||
child.lua_notify([[MiniExtra.pickers.visit_paths({ sort = _G.sort })]])
|
||||
eq(get_picker_items(), { 'aaa' })
|
||||
end
|
||||
@ -3177,7 +3340,7 @@ T['pickers']['visit_labels()']['works'] = function()
|
||||
validate_buf_name(0, join_path('real-files', 'a.lua'))
|
||||
|
||||
-- Should return chosen path
|
||||
eq(child.lua_get('_G.return_item'), join_path('real-files', 'a.lua'))
|
||||
eq(child.lua_get('_G.return_item'), 'real-files/a.lua')
|
||||
end
|
||||
|
||||
T['pickers']['visit_labels()']['respects `local_opts.cwd`'] = function()
|
||||
@ -3199,7 +3362,7 @@ end
|
||||
|
||||
T['pickers']['visit_labels()']['respects `local_opts.sort`'] = function()
|
||||
child.set_size(15, 60)
|
||||
child.lua([[_G.sort = function() return { { path = vim.fn.getcwd() .. '/aaa' } } end]])
|
||||
child.lua([[_G.sort = function() return { { path = vim.fn.getcwd():gsub('\\', '/') .. '/aaa' } } end]])
|
||||
child.lua_notify([[MiniExtra.pickers.visit_labels({ sort = _G.sort })]])
|
||||
eq(get_picker_items(), { 'xxx', 'uuu', 'yyy' })
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -12,33 +12,44 @@ local get_cursor = function(...) return child.get_cursor(...) end
|
||||
local set_lines = function(...) return child.set_lines(...) end
|
||||
local get_lines = function(...) return child.get_lines(...) end
|
||||
local type_keys = function(...) return child.type_keys(...) end
|
||||
local poke_eventloop = function() child.api.nvim_eval('1') end
|
||||
local sleep = function(ms) vim.loop.sleep(ms); poke_eventloop() end
|
||||
local sleep = function(ms) helpers.sleep(ms, child) end
|
||||
local new_buf = function() return child.api.nvim_create_buf(true, false) end
|
||||
local new_scratch_buf = function() return child.api.nvim_create_buf(false, true) end
|
||||
local get_buf = function() return child.api.nvim_get_current_buf() end
|
||||
local set_buf = function(buf_id) child.api.nvim_set_current_buf(buf_id) end
|
||||
local get_win = function() return child.api.nvim_get_current_win() end
|
||||
local edit = function(path) child.cmd('edit ' .. child.fn.fnameescape(path)) end
|
||||
--stylua: ignore end
|
||||
|
||||
-- TODO: Remove after compatibility with Neovim=0.9 is dropped
|
||||
local islist = vim.fn.has('nvim-0.10') == 1 and vim.islist or vim.tbl_islist
|
||||
|
||||
local path_sep = package.config:sub(1, 1)
|
||||
local test_dir = 'tests/dir-git'
|
||||
local test_dir_absolute = vim.fn.fnamemodify(test_dir, ':p'):gsub('(.)/$', '%1')
|
||||
local test_file_absolute = test_dir_absolute .. '/file'
|
||||
local test_dir_absolute = vim.fn.fnamemodify(test_dir, ':p'):gsub('(.)[\\/]$', '%1')
|
||||
local test_file_absolute = test_dir_absolute .. path_sep .. 'file'
|
||||
|
||||
local git_root_dir = test_dir_absolute .. '/git-repo'
|
||||
local git_repo_dir = git_root_dir .. '/.git-dir'
|
||||
local git_dir_path = git_root_dir .. '/dir-in-git'
|
||||
local git_file_path = git_root_dir .. '/file-in-git'
|
||||
local git_root_dir = test_dir_absolute .. path_sep .. 'git-repo'
|
||||
local git_repo_dir = git_root_dir .. path_sep .. '.git-dir'
|
||||
local git_dir_path = git_root_dir .. path_sep .. 'dir-in-git'
|
||||
local git_file_path = git_root_dir .. path_sep .. 'file-in-git'
|
||||
|
||||
local forward_lua = function(fun_str)
|
||||
local lua_cmd = fun_str .. '(...)'
|
||||
return function(...) return child.lua_get(lua_cmd, { ... }) end
|
||||
end
|
||||
|
||||
-- Time constants
|
||||
local repo_watch_delay = 50
|
||||
local small_time = helpers.get_time_const(10)
|
||||
local micro_time = 1
|
||||
|
||||
-- Common wrappers
|
||||
local edit = function(path)
|
||||
child.cmd('edit ' .. child.fn.fnameescape(path))
|
||||
-- Slow context needs a small delay to get things up to date
|
||||
if helpers.is_slow() then sleep(small_time) end
|
||||
end
|
||||
|
||||
local log_calls = function(fun_name)
|
||||
--stylua: ignore
|
||||
local lua_cmd = string.format(
|
||||
@ -66,13 +77,11 @@ local validate_minigit_name = function(buf_id, ref_name)
|
||||
end
|
||||
|
||||
-- Common mocks
|
||||
local small_time = 10
|
||||
|
||||
-- - Git mocks
|
||||
local mock_change_git_index = function()
|
||||
local index_path = git_repo_dir .. '/index'
|
||||
child.fn.writefile({}, index_path .. '.lock')
|
||||
sleep(1)
|
||||
sleep(micro_time)
|
||||
child.fn.delete(index_path)
|
||||
child.loop.fs_rename(index_path .. '.lock', index_path)
|
||||
end
|
||||
@ -243,7 +252,8 @@ T['show_at_cursor()']['works on commit'] = function()
|
||||
|
||||
show_at_cursor()
|
||||
|
||||
local ref_git_spawn_log = { { args = { '--no-pager', 'show', 'abc1234' }, cwd = child.fn.getcwd() } }
|
||||
local ref_args = { '--no-pager', 'show', '--stat', '--patch', 'abc1234' }
|
||||
local ref_git_spawn_log = { { args = ref_args, cwd = child.fn.getcwd() } }
|
||||
validate_git_spawn_log(ref_git_spawn_log)
|
||||
clear_spawn_log()
|
||||
|
||||
@ -271,7 +281,8 @@ T['show_at_cursor()']['uses correct pattern to match commit'] = function()
|
||||
clear_spawn_log()
|
||||
|
||||
show_at_cursor()
|
||||
local is_commit = vim.deep_equal(get_spawn_log()[1].options.args, { '--no-pager', 'show', cword })
|
||||
local ref_args = { '--no-pager', 'show', '--stat', '--patch', cword }
|
||||
local is_commit = vim.deep_equal(get_spawn_log()[1].options.args, ref_args)
|
||||
eq(is_commit, ref_is_commit)
|
||||
end
|
||||
|
||||
@ -295,6 +306,140 @@ T['show_at_cursor()']['uses `opts` on commit'] = function()
|
||||
eq(child.o.filetype, 'git')
|
||||
end
|
||||
|
||||
T['show_at_cursor()']["works in 'mini.deps' confirmation buffer"] = function()
|
||||
local deps_buf_id = new_scratch_buf()
|
||||
set_buf(deps_buf_id)
|
||||
local lines = child.fn.readfile(test_dir_absolute .. '/deps-confirm')
|
||||
set_lines(lines)
|
||||
child.bo.filetype = 'minideps-confirm'
|
||||
child.api.nvim_buf_set_name(0, 'mini-deps://confirm-update')
|
||||
|
||||
local validate_no_show = function(l_num)
|
||||
-- Assume not existing `cwd` (because it should be called during checking
|
||||
-- if the buffer's directory is inside git repo, which is not)
|
||||
child.lua([[vim.fn.isdirectory = function() return 0 end]])
|
||||
|
||||
-- Should not depend on column
|
||||
set_cursor(l_num, l_num % 13)
|
||||
show_at_cursor()
|
||||
|
||||
eq(get_buf(), deps_buf_id)
|
||||
eq(#child.api.nvim_list_tabpages(), 1)
|
||||
|
||||
-- A spawn log as if nothing is detected at "show commit" step (entries
|
||||
-- come from the next steps)
|
||||
validate_git_spawn_log({})
|
||||
clear_spawn_log()
|
||||
validate_notifications({ { '(mini.git) Nothing Git-related to show at cursor', 'WARN' } })
|
||||
clear_notify_log()
|
||||
end
|
||||
|
||||
local validate_show = function(l_num, commit, plugin_name)
|
||||
-- Prepare spawn mocks data
|
||||
mock_spawn()
|
||||
child.lua([[_G.stdio_queue = { { { 'out', 'commit abc123456\nHello' } } }]])
|
||||
-- Assume `cwd` always exists (for easier `deps-confirm` mock text)
|
||||
child.lua([[vim.fn.isdirectory = function() return 1 end]])
|
||||
|
||||
set_cursor(l_num, l_num % 13)
|
||||
show_at_cursor()
|
||||
|
||||
-- Should show in commit info in separate tabpage
|
||||
expect.no_equality(get_buf(), deps_buf_id)
|
||||
eq(child.bo.filetype, 'git')
|
||||
eq(get_lines(), { 'commit abc123456', 'Hello' })
|
||||
eq(#child.api.nvim_list_tabpages(), 2)
|
||||
eq(child.api.nvim_tabpage_get_number(0), 2)
|
||||
eq(#child.api.nvim_tabpage_list_wins(0), 1)
|
||||
|
||||
local ref_git_spawn_log = {
|
||||
{
|
||||
args = { '--no-pager', 'show', '--stat', '--patch', commit },
|
||||
cwd = '/home/user/.local/share/nvim/site/pack/deps/opt/' .. plugin_name,
|
||||
},
|
||||
}
|
||||
validate_git_spawn_log(ref_git_spawn_log)
|
||||
clear_spawn_log()
|
||||
validate_notifications({})
|
||||
clear_notify_log()
|
||||
|
||||
-- Clean up
|
||||
child.cmd('quit')
|
||||
end
|
||||
|
||||
for i = 1, 11 do
|
||||
validate_no_show(i)
|
||||
end
|
||||
validate_show(12, 'aa339f6ab611da07183a7fe44daa482605392502', 'plugin_b')
|
||||
validate_show(13, '093b29f2b409278e2ed69a90462fee54714b5a84', 'plugin_b')
|
||||
validate_show(14, '093b29f2b409278e2ed69a90462fee54714b5a84', 'plugin_b')
|
||||
validate_show(15, '093b29f2b409278e2ed69a90462fee54714b5a84', 'plugin_b')
|
||||
validate_show(16, '093b29f2', 'plugin_b')
|
||||
validate_show(17, '093b29f2', 'plugin_b')
|
||||
validate_show(18, '093b29f2', 'plugin_b')
|
||||
validate_show(19, 'bfe74a48', 'plugin_b')
|
||||
validate_show(20, 'bfe74a48', 'plugin_b')
|
||||
validate_show(21, 'bfe74a48', 'plugin_b')
|
||||
validate_show(22, '3826d0c4', 'plugin_b')
|
||||
validate_show(23, '3826d0c4', 'plugin_b')
|
||||
validate_show(24, '3826d0c4', 'plugin_b')
|
||||
validate_no_show(25)
|
||||
validate_no_show(26)
|
||||
validate_no_show(27)
|
||||
validate_show(28, '3a3c6244553f13fdd92d312c82722b57ce6c4bec', 'plugin_c')
|
||||
validate_show(29, 'fe3deb7f67ce0cc4ebfe2ea6c1c7ae1c7a939d73', 'plugin_c')
|
||||
validate_show(30, 'fe3deb7f67ce0cc4ebfe2ea6c1c7ae1c7a939d73', 'plugin_c')
|
||||
validate_show(31, 'fe3deb7f67ce0cc4ebfe2ea6c1c7ae1c7a939d73', 'plugin_c')
|
||||
validate_show(32, 'fe3deb7', 'plugin_c')
|
||||
validate_show(33, 'fe3deb7', 'plugin_c')
|
||||
validate_show(34, 'fe3deb7', 'plugin_c')
|
||||
validate_no_show(35)
|
||||
validate_no_show(36)
|
||||
validate_no_show(37)
|
||||
validate_show(38, 'd231729b13da28fd1625c3d85f2315886ddeb05d', 'plugin_d')
|
||||
end
|
||||
|
||||
T['show_at_cursor()']["uses `opts` in 'mini.deps' confirmation buffer"] = function()
|
||||
local deps_buf_id = new_scratch_buf()
|
||||
set_buf(deps_buf_id)
|
||||
local lines = child.fn.readfile(test_dir_absolute .. '/deps-confirm')
|
||||
set_lines(lines)
|
||||
child.bo.filetype = 'minideps-confirm'
|
||||
child.api.nvim_buf_set_name(0, 'mini-deps://confirm-update')
|
||||
|
||||
child.lua([[vim.fn.isdirectory = function() return 1 end]])
|
||||
child.lua([[_G.stdio_queue = { { { 'out', 'commit abc123456\nHello' } } }]])
|
||||
|
||||
local init_win_id = get_win()
|
||||
set_cursor(16, 0)
|
||||
show_at_cursor({ split = 'vertical' })
|
||||
|
||||
expect.no_equality(get_buf(), deps_buf_id)
|
||||
eq(child.api.nvim_tabpage_get_number(0), 1)
|
||||
eq(child.fn.winlayout(), { 'row', { { 'leaf', get_win() }, { 'leaf', init_win_id } } })
|
||||
eq(get_lines(), { 'commit abc123456', 'Hello' })
|
||||
eq(child.o.filetype, 'git')
|
||||
end
|
||||
|
||||
T['show_at_cursor()']['shows message if can not find commit'] = function()
|
||||
local lines = child.fn.readfile(test_dir_absolute .. '/deps-confirm')
|
||||
set_lines(lines)
|
||||
set_cursor(16, 2)
|
||||
|
||||
-- Commit at cursor
|
||||
show_at_cursor()
|
||||
validate_notifications({ { '(mini.git) Can not show commit 093b29f2 in repo ' .. child.fn.getcwd(), 'WARN' } })
|
||||
clear_notify_log()
|
||||
|
||||
-- 'mini.deps' confirmation buffer
|
||||
child.bo.filetype = 'minideps-confirm'
|
||||
child.api.nvim_buf_set_name(0, 'mini-deps://confirm-update')
|
||||
|
||||
show_at_cursor()
|
||||
local path = '/home/user/.local/share/nvim/site/pack/deps/opt/plugin_b'
|
||||
validate_notifications({ { '(mini.git) Can not show commit 093b29f2 in repo ' .. path, 'WARN' } })
|
||||
end
|
||||
|
||||
T['show_at_cursor()']['works for diff source'] = function()
|
||||
child.lua('MiniGit.show_diff_source = function() end')
|
||||
log_calls('MiniGit.show_diff_source')
|
||||
@ -1157,6 +1302,7 @@ local enable = forward_lua('MiniGit.enable')
|
||||
|
||||
T['enable()']['works'] = function()
|
||||
enable()
|
||||
if helpers.is_slow() then sleep(small_time) end
|
||||
--stylua: ignore
|
||||
local ref_git_spawn_log = {
|
||||
{
|
||||
@ -1261,13 +1407,16 @@ T['enable()']['properly formats buffer-local summary string'] = function()
|
||||
edit(git_file_path)
|
||||
validate('main (??)')
|
||||
|
||||
child.cmd('edit')
|
||||
edit('')
|
||||
child.poke_eventloop()
|
||||
validate('main-1')
|
||||
|
||||
child.cmd('edit')
|
||||
edit('')
|
||||
child.poke_eventloop()
|
||||
validate('main-2 (A )')
|
||||
|
||||
child.cmd('edit')
|
||||
edit('')
|
||||
child.poke_eventloop()
|
||||
validate('main-3 ( M)')
|
||||
end
|
||||
|
||||
@ -1430,8 +1579,7 @@ T['get_buf_data()']['works with several actions in progress'] = function()
|
||||
|
||||
mock_spawn()
|
||||
child.lua('_G.stdio_queue = _G.init_track_stdio_queue')
|
||||
child.cmd('edit')
|
||||
sleep(small_time)
|
||||
edit('')
|
||||
eq(get_buf_data().in_progress, 'merge,revert')
|
||||
end
|
||||
|
||||
@ -1517,7 +1665,7 @@ T['Auto enable']['works after `:edit`'] = function()
|
||||
log_calls('MiniGit.enable')
|
||||
log_calls('MiniGit.disable')
|
||||
|
||||
child.cmd('edit')
|
||||
edit('')
|
||||
validate_calls({ { 'MiniGit.disable', buf_id }, { 'MiniGit.enable', buf_id } })
|
||||
eq(get_buf_data(buf_id).root, git_root_dir)
|
||||
end
|
||||
@ -1565,7 +1713,7 @@ T['Tracking']['updates all buffers from same repo on repo change'] = function()
|
||||
|
||||
-- Make change in '.git' directory
|
||||
mock_change_git_index()
|
||||
sleep(50 + small_time)
|
||||
sleep(repo_watch_delay + small_time)
|
||||
|
||||
eq(get_buf_data(buf_id_1).status, 'MM')
|
||||
eq(get_buf_data(buf_id_2).status, 'A ')
|
||||
@ -1667,6 +1815,8 @@ T['Tracking']['reacts to buffer rename'] = function()
|
||||
-- This is the chosen way to track change in root/repo.
|
||||
-- Rely on manual `:edit` otherwise.
|
||||
local new_root, new_repo = child.fn.getcwd(), test_dir_absolute
|
||||
local file_rel = 'tests' .. path_sep .. 'dir-git' .. path_sep .. 'file'
|
||||
child.lua('_G.file_rel = ' .. vim.inspect(file_rel))
|
||||
local new_rev_parse_track = new_repo .. '\n' .. new_root
|
||||
child.lua('_G.new_rev_parse_track = ' .. vim.inspect(new_rev_parse_track))
|
||||
child.lua([[_G.stdio_queue = {
|
||||
@ -1674,9 +1824,9 @@ T['Tracking']['reacts to buffer rename'] = function()
|
||||
{ { 'out', 'abc1234\nmain' } }, -- First get HEAD data
|
||||
{ { 'out', 'M file-in-git' } }, -- First get file status data
|
||||
|
||||
{ { 'out', _G.new_rev_parse_track } }, -- Second get path to root and repo
|
||||
{ { 'out', 'def4321\ntmp' } }, -- Second get HEAD data
|
||||
{ { 'out', 'MM tests/dir-git/file' } }, -- Second get file status data
|
||||
{ { 'out', _G.new_rev_parse_track } }, -- Second get path to root and repo
|
||||
{ { 'out', 'def4321\ntmp' } }, -- Second get HEAD data
|
||||
{ { 'out', 'MM ' .. _G.file_rel } }, -- Second get file status data
|
||||
}
|
||||
]])
|
||||
|
||||
@ -1709,7 +1859,7 @@ T['Tracking']['reacts to buffer rename'] = function()
|
||||
cwd = new_root,
|
||||
},
|
||||
{
|
||||
args = { '-c', 'gc.auto=0', 'status', '--verbose', '--untracked-files=all', '--ignored', '--porcelain', '-z', '--', 'tests/dir-git/file' },
|
||||
args = { '-c', 'gc.auto=0', 'status', '--verbose', '--untracked-files=all', '--ignored', '--porcelain', '-z', '--', file_rel },
|
||||
cwd = new_root,
|
||||
},
|
||||
}
|
||||
@ -1764,7 +1914,7 @@ T['Tracking']['reacts to staging'] = function()
|
||||
mock_change_git_index()
|
||||
|
||||
-- - Reaction to change in '.git' directory is debouned with delay of 50 ms
|
||||
sleep(50 - small_time)
|
||||
sleep(repo_watch_delay - small_time)
|
||||
eq(get_buf_data().status, 'MM')
|
||||
eq(#get_spawn_log(), 3)
|
||||
|
||||
@ -1805,7 +1955,7 @@ T['Tracking']['reacts to change in HEAD'] = function()
|
||||
eq(get_buf_data().head_name, 'main')
|
||||
child.fn.writefile({ 'ref: refs/heads/tmp' }, git_repo_dir .. '/HEAD')
|
||||
|
||||
sleep(50 - small_time)
|
||||
sleep(repo_watch_delay - small_time)
|
||||
eq(get_buf_data().head_name, 'main')
|
||||
eq(#get_spawn_log(), 3)
|
||||
|
||||
@ -1868,7 +2018,7 @@ T['Tracking']['reacts to new action in progress'] = function()
|
||||
for _, name in ipairs(action_files) do
|
||||
local path = git_repo_dir .. '/' .. name
|
||||
child.fn.writefile({ '' }, path)
|
||||
sleep(50 + small_time)
|
||||
sleep(repo_watch_delay + small_time)
|
||||
output_in_progress[name] = get_buf_data().in_progress
|
||||
summary_strings[name] = child.b.minigit_summary_string
|
||||
child.fn.delete(path)
|
||||
@ -1899,11 +2049,12 @@ T['Tracking']['does not react to ".lock" files in repo directory'] = function()
|
||||
mock_init_track_stdio_queue()
|
||||
child.lua('_G.stdio_queue = _G.init_track_stdio_queue')
|
||||
edit(git_file_path)
|
||||
sleep(small_time)
|
||||
eq(#get_spawn_log(), 3)
|
||||
|
||||
child.fn.writefile({ '' }, git_repo_dir .. '/tmp.lock')
|
||||
MiniTest.finally(function() child.fn.delete(git_repo_dir .. '/tmp.lock') end)
|
||||
sleep(50 + small_time)
|
||||
sleep(repo_watch_delay + small_time)
|
||||
eq(#get_spawn_log(), 3)
|
||||
end
|
||||
|
||||
@ -1940,7 +2091,7 @@ T['Tracking']['redraws statusline when summary is updated'] = function()
|
||||
|
||||
-- Status change
|
||||
mock_change_git_index()
|
||||
sleep(50 + small_time)
|
||||
sleep(repo_watch_delay + small_time)
|
||||
child.expect_screenshot()
|
||||
|
||||
-- File content change
|
||||
@ -1950,14 +2101,14 @@ T['Tracking']['redraws statusline when summary is updated'] = function()
|
||||
|
||||
-- Branch change
|
||||
child.fn.writefile({ 'ref: refs/heads/tmp' }, git_repo_dir .. '/HEAD')
|
||||
sleep(50 + small_time)
|
||||
sleep(repo_watch_delay + small_time)
|
||||
child.expect_screenshot()
|
||||
|
||||
-- "In progress" change
|
||||
local path = git_repo_dir .. '/BISECT_LOG'
|
||||
child.fn.writefile({ '' }, path)
|
||||
MiniTest.finally(function() child.fn.delete(path) end)
|
||||
sleep(50 + small_time)
|
||||
sleep(repo_watch_delay + small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
@ -2108,19 +2259,20 @@ local validate_command_call = function(log_index, args, executable, cwd)
|
||||
end
|
||||
|
||||
T[':Git']['works'] = function()
|
||||
child.lua('_G.dur = ' .. (10 * small_time))
|
||||
child.lua([[
|
||||
-- Command stdout
|
||||
table.insert(_G.stdio_queue, { { 'out', 'abc1234 Hello\ndef4321 World' } })
|
||||
|
||||
-- Mock non-trivial command execution time
|
||||
_G.process_mock_data = { [4] = { duration = 50 } }
|
||||
_G.process_mock_data = { [4] = { duration = _G.dur } }
|
||||
]])
|
||||
|
||||
-- Should execute command synchronously
|
||||
local start_time = vim.loop.hrtime()
|
||||
child.cmd('Git log --oneline')
|
||||
local duration = 0.000001 * (vim.loop.hrtime() - start_time)
|
||||
eq(50 <= duration and duration <= 70, true)
|
||||
eq(10 * small_time <= duration and duration <= 14 * small_time, true)
|
||||
|
||||
-- Should properly gather subcommand data before executing command
|
||||
local spawn_log = get_spawn_log()
|
||||
@ -2157,7 +2309,7 @@ T[':Git']['works asynchronously with bang modifier'] = function()
|
||||
|
||||
-- Should in some way show the output when the process is done
|
||||
eq(child.bo.filetype == 'git', false)
|
||||
sleep(50 - small_time)
|
||||
sleep(repo_watch_delay - small_time)
|
||||
eq(child.bo.filetype == 'git', false)
|
||||
sleep(2 * small_time)
|
||||
eq(child.bo.filetype == 'git', true)
|
||||
@ -2367,7 +2519,7 @@ T[':Git']['opens Git editor in current instance'] = new_set(
|
||||
child.lua('MiniGit.config.job.timeout = 5')
|
||||
|
||||
-- Set up content of edit message file
|
||||
local editmsg_path = git_repo_dir .. '/COMMIT_EDITMSG'
|
||||
local editmsg_path = git_repo_dir .. path_sep .. 'COMMIT_EDITMSG'
|
||||
child.lua('_G.editmsg_path = ' .. vim.inspect(editmsg_path))
|
||||
local cur_lines = vim.fn.readfile(editmsg_path)
|
||||
MiniTest.finally(function() vim.fn.writefile(cur_lines, editmsg_path) end)
|
||||
@ -2403,7 +2555,7 @@ T[':Git']['opens Git editor in current instance'] = new_set(
|
||||
local init_win_id = get_win()
|
||||
child.cmd(':belowright vert Git commit --amend')
|
||||
|
||||
sleep(small_time)
|
||||
sleep(3 * small_time)
|
||||
eq(child.api.nvim_buf_get_name(0), editmsg_path)
|
||||
eq(get_lines(), { '', '# This is a mock of Git template for its `GIT_EDITOR`' })
|
||||
eq(child.fn.winlayout(), { 'row', { { 'leaf', init_win_id }, { 'leaf', get_win() } } })
|
||||
@ -2414,7 +2566,7 @@ T[':Git']['opens Git editor in current instance'] = new_set(
|
||||
-- Should not stop due to timeout
|
||||
local is_job_active = function() return child.lua_get('pcall(vim.fn.jobpid, _G.channel)') end
|
||||
eq(is_job_active(), true)
|
||||
sleep(50)
|
||||
sleep(repo_watch_delay)
|
||||
eq(is_job_active(), true)
|
||||
|
||||
-- Should wait until editing is done (window is closed)
|
||||
@ -2523,18 +2675,19 @@ T[':Git']['respects `job.git_executable`'] = function()
|
||||
end
|
||||
|
||||
T[':Git']['respects `job.timeout`'] = function()
|
||||
child.lua('_G.duration = ' .. (5 * small_time))
|
||||
child.lua([[
|
||||
table.insert(_G.stdio_queue, { { 'out', 'Hello' } })
|
||||
|
||||
_G.process_mock_data = { [4] = { duration = 50 } }
|
||||
_G.process_mock_data = { [4] = { duration = _G.duration } }
|
||||
]])
|
||||
|
||||
child.lua('MiniGit.config.job.timeout = 20')
|
||||
child.lua('MiniGit.config.job.timeout = ' .. (2 * small_time))
|
||||
|
||||
local start_time = vim.loop.hrtime()
|
||||
child.cmd('Git log')
|
||||
local duration = 0.000001 * (vim.loop.hrtime() - start_time)
|
||||
eq(15 <= duration and duration <= 25, true)
|
||||
eq((1.5 * small_time) <= duration and duration <= (2.5 * small_time), true)
|
||||
|
||||
local ref_notify_log = {
|
||||
{ '(mini.git) PROCESS REACHED TIMEOUT', 'WARN' },
|
||||
@ -2907,8 +3060,8 @@ T[':Git']['event `MiniGitCommandSplit` can be used to tweak window-local options
|
||||
local init_win_id = get_win()
|
||||
child.cmd(':Git log')
|
||||
eq(child.api.nvim_win_get_option(init_win_id, 'scrollbind'), true)
|
||||
eq(child.api.nvim_win_get_option(0, 'scrollbind'), true)
|
||||
eq(child.api.nvim_win_get_option(0, 'foldlevel'), 0)
|
||||
eq(child.wo.scrollbind, true)
|
||||
eq(child.wo.foldlevel, 0)
|
||||
end
|
||||
|
||||
return T
|
||||
|
||||
@ -9,8 +9,7 @@ local new_set = MiniTest.new_set
|
||||
local load_module = function(config) child.mini_load('hipatterns', config) end
|
||||
local set_lines = function(...) return child.set_lines(...) end
|
||||
local type_keys = function(...) return child.type_keys(...) end
|
||||
local poke_eventloop = function() child.api.nvim_eval('1') end
|
||||
local sleep = function(ms) vim.loop.sleep(ms); poke_eventloop() end
|
||||
local sleep = function(ms) helpers.sleep(ms, child, true) end
|
||||
--stylua: ignore end
|
||||
|
||||
local forward_lua = function(fun_str)
|
||||
@ -51,13 +50,16 @@ end
|
||||
local validate_hl_group = function(name, pattern) expect.match(child.cmd_capture('hi ' .. name), pattern) end
|
||||
|
||||
-- Data =======================================================================
|
||||
local test_lines = { 'abcd abcd', 'Abcd ABCD', 'abcdaabcd' }
|
||||
|
||||
-- Time constants
|
||||
local small_time = helpers.get_time_const(10)
|
||||
|
||||
-- Test config
|
||||
local test_config = {
|
||||
highlighters = { abcd = { pattern = 'abcd', group = 'Error' } },
|
||||
delay = { text_change = 30, scroll = 10 },
|
||||
delay = { text_change = 5 * small_time, scroll = 2 * small_time },
|
||||
}
|
||||
local small_time = 5
|
||||
|
||||
local test_lines = { 'abcd abcd', 'Abcd ABCD', 'abcdaabcd' }
|
||||
|
||||
-- Output test set ============================================================
|
||||
local T = new_set({
|
||||
@ -65,6 +67,8 @@ local T = new_set({
|
||||
pre_case = function()
|
||||
child.setup()
|
||||
child.set_size(10, 15)
|
||||
|
||||
child.lua('_G.test_config = ' .. vim.inspect(test_config))
|
||||
end,
|
||||
post_once = child.stop,
|
||||
},
|
||||
@ -121,6 +125,12 @@ T['setup()']['validates `config` argument'] = function()
|
||||
expect_config_error({ delay = { scroll = 'a' } }, 'delay.scroll', 'number')
|
||||
end
|
||||
|
||||
T['setup()']['ensures colors'] = function()
|
||||
load_module()
|
||||
child.cmd('colorscheme default')
|
||||
expect.match(child.cmd_capture('hi MiniHipatternsFixme'), 'links to DiagnosticError')
|
||||
end
|
||||
|
||||
T['Auto enable'] = new_set()
|
||||
|
||||
T['Auto enable']['enables for normal buffers'] = function()
|
||||
@ -139,11 +149,13 @@ T['Auto enable']['enables for normal buffers'] = function()
|
||||
set_lines({ '33abcd33' })
|
||||
|
||||
load_module(test_config)
|
||||
sleep(small_time)
|
||||
-- Should enable in all proper buffers currently shown in some window
|
||||
child.expect_screenshot()
|
||||
eq(child.lua_get('MiniHipatterns.get_enabled_buffers()'), { buf_id_1, buf_id_3 })
|
||||
|
||||
child.api.nvim_set_current_buf(buf_id_2)
|
||||
sleep(small_time)
|
||||
child.expect_screenshot()
|
||||
eq(child.lua_get('MiniHipatterns.get_enabled_buffers()'), { buf_id_1, buf_id_2, buf_id_3 })
|
||||
end
|
||||
@ -191,14 +203,14 @@ T['Autocommands']['resets on color scheme change'] = function()
|
||||
}]])
|
||||
child.lua([[require('mini.hipatterns').setup({
|
||||
highlighters = { aaa = _G.new_hl_group_highlighter },
|
||||
delay = { text_change = 20 },
|
||||
delay = _G.test_config.delay,
|
||||
})]])
|
||||
|
||||
set_lines({ 'aaa' })
|
||||
child.cmd('wincmd v | enew')
|
||||
set_lines({ 'xxaaaxx' })
|
||||
|
||||
sleep(20 + 2)
|
||||
sleep(test_config.delay.text_change + small_time)
|
||||
child.expect_screenshot()
|
||||
|
||||
-- After `:hi clear` highlighting disappears as highlight group is cleared
|
||||
@ -308,14 +320,15 @@ T['enable()']['reacts to buffer enter'] = function()
|
||||
child.api.nvim_set_current_buf(other_buf_id)
|
||||
|
||||
-- On buffer enter it should update config and highlighting (after delay)
|
||||
local lua_cmd = string.format('vim.b[%d].minihipatterns_config = { delay = { text_change = 10 } }', init_buf_id)
|
||||
local lua_cmd =
|
||||
string.format('vim.b[%d].minihipatterns_config = { delay = { text_change = %d } }', init_buf_id, 2 * small_time)
|
||||
child.lua(lua_cmd)
|
||||
child.api.nvim_buf_set_lines(init_buf_id, 0, -1, false, { 'abcd' })
|
||||
|
||||
child.api.nvim_set_current_buf(init_buf_id)
|
||||
|
||||
child.expect_screenshot()
|
||||
sleep(10 + small_time)
|
||||
sleep(2 * small_time + small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
@ -330,7 +343,7 @@ T['enable()']['reacts to filetype change'] = function()
|
||||
group = 'Error'
|
||||
},
|
||||
},
|
||||
delay = { text_change = 20 },
|
||||
delay = _G.test_config.delay,
|
||||
}]])
|
||||
|
||||
set_lines({ 'xxabcdxx' })
|
||||
@ -340,13 +353,12 @@ T['enable()']['reacts to filetype change'] = function()
|
||||
-- Should update highlighting after delay
|
||||
child.cmd('set filetype=aaa')
|
||||
child.expect_screenshot()
|
||||
sleep(20 + 2)
|
||||
sleep(test_config.delay.text_change + small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
T['enable()']['reacts to window scroll'] = function()
|
||||
local config = { highlighters = test_config.highlighters, delay = { text_change = 30, scroll = 10 } }
|
||||
enable(0, config)
|
||||
enable(0, test_config)
|
||||
|
||||
-- Change same line each before `delay.text_change`. This creates a situation
|
||||
-- when only one line will be highlighted while others - don't (but should).
|
||||
@ -356,14 +368,14 @@ T['enable()']['reacts to window scroll'] = function()
|
||||
type_keys('P')
|
||||
end
|
||||
|
||||
sleep(30 + 2)
|
||||
sleep(test_config.delay.text_change + small_time)
|
||||
child.expect_screenshot()
|
||||
|
||||
-- Scroll should update highlighting inside view with `delay.scroll` debounce
|
||||
type_keys('<C-e>')
|
||||
sleep(5)
|
||||
sleep(0.5 * test_config.delay.scroll)
|
||||
type_keys('<C-e>')
|
||||
sleep(10 + 1)
|
||||
sleep(test_config.delay.scroll + small_time)
|
||||
child.expect_screenshot()
|
||||
|
||||
-- Update should be done only on the final view
|
||||
@ -381,16 +393,16 @@ T['enable()']['reacts to delete of line with match'] = function()
|
||||
group = '',
|
||||
extmark_opts = { virt_text = { { 'Hello', 'Error' } }, virt_text_pos = 'right_align' },
|
||||
}
|
||||
local config = { highlighters = { abcd = hi_abcd }, delay = { text_change = 30, scroll = 10 } }
|
||||
local config = { highlighters = { abcd = hi_abcd }, delay = test_config.delay }
|
||||
enable(0, config)
|
||||
|
||||
sleep(30 + small_time)
|
||||
sleep(test_config.delay.text_change + small_time)
|
||||
child.expect_screenshot()
|
||||
|
||||
local validate = function(line_to_delete)
|
||||
child.api.nvim_win_set_cursor(0, { line_to_delete, 0 })
|
||||
type_keys('dd')
|
||||
sleep(30 + small_time)
|
||||
sleep(test_config.delay.text_change + small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
@ -410,10 +422,10 @@ T['Highlighters']['silently skips wrong entries'] = function()
|
||||
group_wrong_type = { pattern = 'aaa', group = 1 },
|
||||
priority_wrong_type = { pattern = 'aaa', group = 'Error', extmark_opts = 'a' },
|
||||
}
|
||||
enable(0, { highlighters = highlighters, delay = { text_change = 20 } })
|
||||
enable(0, { highlighters = highlighters, delay = test_config.delay })
|
||||
|
||||
set_lines({ 'xxabcd', 'aaa' })
|
||||
sleep(20 + 2)
|
||||
sleep(test_config.delay.text_change + small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
@ -424,11 +436,11 @@ T['Highlighters']['allows submatch in `pattern`'] = function()
|
||||
child.lua([[require('mini.hipatterns').disable()]])
|
||||
local config = {
|
||||
highlighters = { abcd = { pattern = pattern, group = 'Error' } },
|
||||
delay = { text_change = 20 },
|
||||
delay = test_config.delay,
|
||||
}
|
||||
enable(0, config)
|
||||
|
||||
sleep(20 + 2)
|
||||
sleep(test_config.delay.text_change + small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
@ -447,12 +459,12 @@ end
|
||||
T['Highlighters']['allows frontier pattern in `pattern`'] = function()
|
||||
local config = {
|
||||
highlighters = { abcd = { pattern = '%f[%w]abcd%f[%W]', group = 'Error' } },
|
||||
delay = { text_change = 20 },
|
||||
delay = test_config.delay,
|
||||
}
|
||||
enable(0, config)
|
||||
|
||||
set_lines({ 'abcd', 'xabcd', 'abcdx', 'xabcdx', ' abcd ' })
|
||||
sleep(20 + 2)
|
||||
sleep(test_config.delay.text_change + small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
@ -466,14 +478,11 @@ T['Highlighters']['allows callable `pattern`'] = function()
|
||||
}]])
|
||||
child.lua([[require('mini.hipatterns').enable(
|
||||
0,
|
||||
{
|
||||
highlighters = { test = _G.hi_callable_pattern },
|
||||
delay = { text_change = 20 },
|
||||
}
|
||||
{ highlighters = { test = _G.hi_callable_pattern }, delay = _G.test_config.delay }
|
||||
)]])
|
||||
|
||||
set_lines({ 'xxabcd' })
|
||||
sleep(20 + 2)
|
||||
sleep(test_config.delay.text_change + small_time)
|
||||
child.expect_screenshot()
|
||||
-- Should be called with correct signature
|
||||
eq(child.lua_get('_G.args'), { child.api.nvim_get_current_buf() })
|
||||
@ -489,16 +498,16 @@ T['Highlighters']['allows return `nil` `pattern` to not highlight'] = function()
|
||||
}]])
|
||||
child.lua([[require('mini.hipatterns').enable(
|
||||
0,
|
||||
{ highlighters = { test = _G.hi_conditional_pattern }, delay = { text_change = 20 } }
|
||||
{ highlighters = { test = _G.hi_conditional_pattern }, delay = _G.test_config.delay }
|
||||
)]])
|
||||
|
||||
set_lines({ 'xxabcd' })
|
||||
sleep(20 + 2)
|
||||
sleep(test_config.delay.text_change + small_time)
|
||||
child.expect_screenshot()
|
||||
|
||||
child.b.not_highlight = true
|
||||
set_lines({ 'xxabcd' })
|
||||
sleep(20 + 2)
|
||||
sleep(test_config.delay.text_change + small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
@ -516,16 +525,16 @@ T['Highlighters']['allows array `pattern`'] = function()
|
||||
}]])
|
||||
child.lua([[require('mini.hipatterns').enable(
|
||||
0,
|
||||
{ highlighters = { array = _G.hi_array }, delay = { text_change = 20 } }
|
||||
{ highlighters = { array = _G.hi_array }, delay = _G.test_config.delay }
|
||||
)]])
|
||||
|
||||
set_lines({ 'xxabcd', 'xxefgh' })
|
||||
sleep(20 + 2)
|
||||
sleep(test_config.delay.text_change + small_time)
|
||||
child.expect_screenshot()
|
||||
|
||||
child.b.not_highlight = true
|
||||
set_lines({ 'xxabcd', 'xxefgh' })
|
||||
sleep(20 + 2)
|
||||
sleep(test_config.delay.text_change + small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
@ -539,14 +548,11 @@ T['Highlighters']['allows callable `group`'] = function()
|
||||
}]])
|
||||
child.lua([[require('mini.hipatterns').enable(
|
||||
0,
|
||||
{
|
||||
highlighters = { test = _G.hi_callable_group },
|
||||
delay = { text_change = 20 },
|
||||
}
|
||||
{ highlighters = { test = _G.hi_callable_group }, delay = _G.test_config.delay }
|
||||
)]])
|
||||
|
||||
set_lines({ 'xxabcd' })
|
||||
sleep(20 + 2)
|
||||
sleep(test_config.delay.text_change + small_time)
|
||||
child.expect_screenshot()
|
||||
-- Should be called with correct signature
|
||||
eq(child.lua_get('_G.args'), { 1, 'abcd', { full_match = 'abcd', line = 1, from_col = 3, to_col = 6 } })
|
||||
@ -556,7 +562,7 @@ T['Highlighters']['allows callable `group`'] = function()
|
||||
child.lua('_G.args = nil')
|
||||
child.lua('_G.hi_callable_group.pattern = ' .. vim.inspect(pattern))
|
||||
set_lines({ 'abcd' })
|
||||
sleep(20 + 2)
|
||||
sleep(test_config.delay.text_change + small_time)
|
||||
eq(child.lua_get('_G.args'), ref_args)
|
||||
end
|
||||
|
||||
@ -578,11 +584,11 @@ T['Highlighters']['allows return `nil` `group` to not highlight'] = function()
|
||||
}]])
|
||||
child.lua([[require('mini.hipatterns').enable(
|
||||
0,
|
||||
{ highlighters = { test = _G.hi_conditional_group }, delay = { text_change = 20 } }
|
||||
{ highlighters = { test = _G.hi_conditional_group }, delay = _G.test_config.delay }
|
||||
)]])
|
||||
|
||||
set_lines({ 'xxabcd', 'xxabcd', 'xxabcd', 'xxabcd', 'xxabcd' })
|
||||
sleep(20 + 2)
|
||||
sleep(test_config.delay.text_change + small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
@ -898,11 +904,11 @@ T['get_matches()']['works'] = function()
|
||||
end,
|
||||
},
|
||||
},
|
||||
delay = { text_change = 20 },
|
||||
delay = _G.test_config.delay,
|
||||
})]])
|
||||
|
||||
enable(buf_id_1)
|
||||
sleep(20 + small_time)
|
||||
sleep(test_config.delay.text_change + small_time)
|
||||
local matches = get_matches(buf_id_1)
|
||||
|
||||
-- Order should be guaranteed (as tostring(10) is less than 'aaa')
|
||||
@ -919,7 +925,7 @@ T['get_matches()']['works'] = function()
|
||||
|
||||
-- Should return empty table if no matches
|
||||
enable(buf_id_2)
|
||||
sleep(20 + small_time)
|
||||
sleep(test_config.delay.text_change + small_time)
|
||||
eq(get_matches(buf_id_2), {})
|
||||
end
|
||||
|
||||
@ -928,10 +934,10 @@ T['get_matches()']['respects `buf_id` argument'] = function()
|
||||
child.api.nvim_buf_set_lines(buf_id, 0, -1, false, { 'bbb aaa' })
|
||||
child.lua([[require('mini.hipatterns').setup({
|
||||
highlighters = { aaa = { pattern = 'aaa', group = 'Error' } },
|
||||
delay = { text_change = 20 },
|
||||
delay = _G.test_config.delay,
|
||||
})]])
|
||||
enable(buf_id)
|
||||
sleep(20 + small_time)
|
||||
sleep(test_config.delay.text_change + small_time)
|
||||
|
||||
-- Should allow both `nil` and `0` to mean current buffer
|
||||
local ref_output =
|
||||
@ -949,10 +955,10 @@ T['get_matches()']['respects `highlighters` argument'] = function()
|
||||
aaa = { pattern = { 'aaa', 'AAA' }, group = 'Error' },
|
||||
bbb = { pattern = 'bbb', group = 'Comment' },
|
||||
},
|
||||
delay = { text_change = 20 },
|
||||
delay = _G.test_config.delay,
|
||||
})]])
|
||||
enable(buf_id)
|
||||
sleep(20 + small_time)
|
||||
sleep(test_config.delay.text_change + small_time)
|
||||
|
||||
-- Should respect order of `highlighters` in output and discard any not
|
||||
-- present highlighter identifiers
|
||||
@ -980,6 +986,7 @@ local enable_hex_color = function(...)
|
||||
})]],
|
||||
{ ... }
|
||||
)
|
||||
sleep(small_time)
|
||||
end
|
||||
|
||||
T['gen_highlighter']['hex_color()']['works'] = function()
|
||||
|
||||
@ -37,6 +37,9 @@ T['setup()']['creates side effects'] = function()
|
||||
-- Global variable
|
||||
eq(child.lua_get('type(_G.MiniIcons)'), 'table')
|
||||
|
||||
-- Autocommand group
|
||||
eq(child.fn.exists('#MiniIcons'), 1)
|
||||
|
||||
-- Highlight groups
|
||||
child.cmd('hi clear')
|
||||
load_module()
|
||||
@ -97,6 +100,11 @@ T['setup()']['validates `config` argument'] = function()
|
||||
expect_config_error({ use_file_extension = 1 }, 'use_file_extension', 'function')
|
||||
end
|
||||
|
||||
T['setup()']['ensures colors'] = function()
|
||||
child.cmd('colorscheme default')
|
||||
expect.match(child.cmd_capture('hi MiniIconsAzure'), 'links to Function')
|
||||
end
|
||||
|
||||
T['setup()']['can customize icons'] = function()
|
||||
-- Both override existing and provide new ones
|
||||
load_module({
|
||||
@ -311,8 +319,8 @@ T['get()']['respects `config.use_file_extension`'] = function()
|
||||
eq(get('file', '/extra.dots.yml'), { '', 'MiniIconsPurple', false })
|
||||
|
||||
-- - '/queries/.*%.scm' pattern should be built-in
|
||||
eq(get('file', 'queries/lua.scm'), { '', 'MiniIconsGreen', false })
|
||||
eq(get('file', 'queries/extra.dots.scm'), { '', 'MiniIconsGreen', false })
|
||||
eq(get('file', './queries/lua.scm'), { '', 'MiniIconsGreen', false })
|
||||
eq(get('file', './queries/extra.dots.scm'), { '', 'MiniIconsGreen', false })
|
||||
eq(get('file', 'lua.scm'), { '', 'MiniIconsGrey', false })
|
||||
|
||||
-- Should not be called if there is no extension
|
||||
@ -521,6 +529,12 @@ T['get()']['respects `config.style`'] = function()
|
||||
-- - 'not-supported' is resolved to use "file" default
|
||||
eq(get('file', 'not-supported'), { 'F', 'MiniIconsGrey', true })
|
||||
|
||||
-- Should work with full paths
|
||||
eq(get('file', '/home/user/LICENSE'), { 'L', 'MiniIconsCyan', false })
|
||||
eq(get('file', '/home/user/world.lua'), { 'L', 'MiniIconsAzure', false })
|
||||
eq(get('file', '/home/user/Cargo.lock'), { 'T', 'MiniIconsOrange', false })
|
||||
eq(get('file', '/home/user/not-supported-2'), { 'F', 'MiniIconsGrey', true })
|
||||
|
||||
-- Should work with all categories
|
||||
eq(get('default', 'lsp')[1], 'L')
|
||||
eq(get('directory', 'nvim')[1], 'N')
|
||||
|
||||
@ -15,8 +15,7 @@ local get_cursor = function(...) return child.get_cursor(...) end
|
||||
local set_lines = function(...) return child.set_lines(...) end
|
||||
local get_lines = function(...) return child.get_lines(...) end
|
||||
local type_keys = function(...) return child.type_keys(...) end
|
||||
local poke_eventloop = function() child.api.nvim_eval('1') end
|
||||
local sleep = function(ms) vim.loop.sleep(ms); poke_eventloop() end
|
||||
local sleep = function(ms) helpers.sleep(ms, child, true) end
|
||||
--stylua: ignore end
|
||||
|
||||
-- Data =======================================================================
|
||||
@ -50,7 +49,11 @@ local example_lines = {
|
||||
-- aa
|
||||
local example_lines_nested = { 'aa', ' aa', ' aa', ' aa', ' aa', ' aa', ' aa', ' aa', 'aa' }
|
||||
|
||||
local test_times = { delay = 100, animation_step = 20 }
|
||||
-- Time constants
|
||||
local default_draw_delay = 100
|
||||
local default_animation_step = 20
|
||||
local small_time = helpers.get_time_const(10)
|
||||
local micro_time = 1
|
||||
|
||||
-- Output test set ============================================================
|
||||
local T = new_set({
|
||||
@ -140,6 +143,11 @@ T['setup()']['properly handles `config.mappings`'] = function()
|
||||
eq(has_map('[i', 'indent scope'), false)
|
||||
end
|
||||
|
||||
T['setup()']['ensures colors'] = function()
|
||||
child.cmd('colorscheme default')
|
||||
expect.match(child.cmd_capture('hi MiniIndentscopeSymbol'), 'links to Delimiter')
|
||||
end
|
||||
|
||||
T['get_scope()'] = new_set({
|
||||
hooks = {
|
||||
pre_case = function() set_lines(example_lines) end,
|
||||
@ -389,11 +397,11 @@ T['draw()']['works'] = function()
|
||||
-- Should be single symbol at cursor line
|
||||
child.expect_screenshot()
|
||||
|
||||
sleep(test_times.animation_step)
|
||||
sleep(default_animation_step)
|
||||
child.expect_screenshot()
|
||||
sleep(test_times.animation_step)
|
||||
sleep(default_animation_step)
|
||||
child.expect_screenshot()
|
||||
sleep(test_times.animation_step)
|
||||
sleep(default_animation_step)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
@ -418,7 +426,7 @@ T['draw()']['uses correct highlight groups'] = new_set(
|
||||
set_cursor(2, 4)
|
||||
|
||||
child.lua('MiniIndentscope.draw()')
|
||||
sleep(test_times.animation_step)
|
||||
sleep(default_animation_step)
|
||||
|
||||
validate_hl_group(hl_group)
|
||||
end,
|
||||
@ -432,23 +440,26 @@ T['draw()']['respects `config.draw.animation`'] = function()
|
||||
set_cursor(5, 4)
|
||||
child.lua('MiniIndentscope.draw()')
|
||||
|
||||
sleep(duration - 10)
|
||||
sleep(duration - small_time)
|
||||
-- Should still be one symbol
|
||||
child.expect_screenshot()
|
||||
sleep(10 + 1)
|
||||
sleep(small_time + small_time)
|
||||
-- Should be two symbols
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
local duration = 2.5 * test_times.animation_step
|
||||
local duration = 2 * small_time
|
||||
local command = string.format('MiniIndentscope.config.draw.animation = function() return %d end', duration)
|
||||
child.lua(command)
|
||||
validate(duration)
|
||||
|
||||
-- Should also use buffer local config
|
||||
set_cursor(1, 0)
|
||||
child.lua('vim.b.miniindentscope_config = { draw = { animation = function() return 30 end } }')
|
||||
validate(30)
|
||||
local other_duration = 3 * small_time
|
||||
local other_command =
|
||||
string.format('vim.b.miniindentscope_config = { draw = { animation = function() return %d end } }', other_duration)
|
||||
child.lua(other_command)
|
||||
validate(other_duration)
|
||||
end
|
||||
|
||||
T['draw()']['respects `config.draw.priority`'] = function()
|
||||
@ -459,14 +470,14 @@ T['draw()']['respects `config.draw.priority`'] = function()
|
||||
|
||||
set_cursor(5, 0)
|
||||
child.lua('MiniIndentscope.draw()')
|
||||
sleep(test_times.animation_step)
|
||||
sleep(default_animation_step)
|
||||
child.expect_screenshot()
|
||||
|
||||
child.lua('MiniIndentscope.undraw()')
|
||||
|
||||
child.lua('MiniIndentscope.config.draw.priority = 6')
|
||||
child.lua('MiniIndentscope.draw()')
|
||||
sleep(test_times.animation_step)
|
||||
sleep(default_animation_step)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
@ -499,13 +510,16 @@ T['draw()']["does not overshadow 'listchars'"] = function()
|
||||
end
|
||||
|
||||
T['draw()']['does not round time of every animation step'] = function()
|
||||
child.lua('MiniIndentscope.config.draw.animation = function() return 2.99 end')
|
||||
helpers.skip_if_slow()
|
||||
|
||||
local fractional_step = 0.99 * default_animation_step
|
||||
child.lua('_G.fractional_step = ' .. fractional_step)
|
||||
child.lua('MiniIndentscope.config.draw.animation = function() return _G.fractional_step end')
|
||||
|
||||
set_cursor(6, 0)
|
||||
child.lua('MiniIndentscope.draw()')
|
||||
|
||||
-- Should be single symbol at cursor line
|
||||
sleep(2 * 3)
|
||||
sleep(2 * fractional_step)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
@ -531,6 +545,12 @@ T['draw()']['shows symbols on wrapped lines without overlapping'] = function()
|
||||
child.wo.breakindent = true
|
||||
child.wo.breakindentopt = 'min:0'
|
||||
validate()
|
||||
|
||||
-- Should try to not overlap 'showbreak'
|
||||
child.wo.breakindent = true
|
||||
child.wo.breakindentopt = 'sbr'
|
||||
child.wo.showbreak = 'x'
|
||||
validate()
|
||||
end
|
||||
|
||||
T['undraw()'] = new_set({
|
||||
@ -568,16 +588,15 @@ T['Auto drawing']['works in Normal mode'] = function()
|
||||
mark_flaky()
|
||||
|
||||
set_cursor(5, 4)
|
||||
|
||||
sleep(test_times.delay - 10)
|
||||
sleep(default_draw_delay - small_time)
|
||||
-- Nothing should yet be shown
|
||||
child.expect_screenshot()
|
||||
|
||||
sleep(10)
|
||||
sleep(small_time)
|
||||
-- Symbol at cursor line should be drawn immediately
|
||||
child.expect_screenshot()
|
||||
|
||||
sleep(test_times.animation_step)
|
||||
sleep(default_animation_step)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
@ -589,10 +608,10 @@ T['Auto drawing']['respects common events'] = new_set({
|
||||
|
||||
set_cursor(5, 4)
|
||||
child.lua('MiniIndentscope.undraw()')
|
||||
sleep(10)
|
||||
sleep(small_time)
|
||||
|
||||
child.cmd('doautocmd ' .. event_name)
|
||||
sleep(test_times.delay + test_times.animation_step * 1 + 1)
|
||||
sleep(default_draw_delay + default_animation_step + small_time)
|
||||
child.expect_screenshot()
|
||||
end,
|
||||
})
|
||||
@ -612,42 +631,42 @@ T['Auto drawing']['respects ModeChanged event'] = function()
|
||||
child.lua([[require('mini.indentscope').setup({ draw = { delay = 0, animation = function() return 0 end } })]])
|
||||
|
||||
set_cursor(5, 4)
|
||||
sleep(10)
|
||||
sleep(small_time)
|
||||
child.expect_screenshot()
|
||||
|
||||
type_keys('i')
|
||||
sleep(10)
|
||||
sleep(small_time)
|
||||
child.expect_screenshot()
|
||||
|
||||
type_keys('<Esc>')
|
||||
sleep(10)
|
||||
sleep(small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
T['Auto drawing']['respects `config.draw.delay`'] = function()
|
||||
child.lua('MiniIndentscope.config.draw.delay = ' .. 0.5 * test_times.delay)
|
||||
child.lua('MiniIndentscope.config.draw.delay = ' .. (0.5 * default_draw_delay))
|
||||
set_cursor(5, 4)
|
||||
|
||||
sleep(0.5 * test_times.delay)
|
||||
sleep(0.5 * default_draw_delay)
|
||||
child.expect_screenshot()
|
||||
|
||||
-- Should also use buffer local config
|
||||
set_cursor(1, 0)
|
||||
child.b.miniindentscope_config = { draw = { delay = 30 } }
|
||||
child.b.miniindentscope_config = { draw = { delay = 2 * default_draw_delay } }
|
||||
set_cursor(5, 4)
|
||||
sleep(30)
|
||||
sleep(2 * default_draw_delay)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
T['Auto drawing']['implements debounce-style delay'] = function()
|
||||
set_cursor(5, 4)
|
||||
sleep(test_times.delay - 10)
|
||||
sleep(default_draw_delay - small_time)
|
||||
set_cursor(2, 0)
|
||||
sleep(test_times.delay - 10)
|
||||
sleep(default_draw_delay - small_time)
|
||||
|
||||
-- Should draw nothing
|
||||
child.expect_screenshot()
|
||||
sleep(10)
|
||||
sleep(small_time)
|
||||
-- Should start drawing
|
||||
child.expect_screenshot()
|
||||
end
|
||||
@ -675,15 +694,15 @@ T['Auto drawing']['works in Insert mode'] = function()
|
||||
set_cursor(5, 4)
|
||||
type_keys('i')
|
||||
|
||||
sleep(test_times.delay - 10)
|
||||
sleep(default_draw_delay - small_time)
|
||||
-- Nothing yet should be shown
|
||||
child.expect_screenshot()
|
||||
|
||||
sleep(10)
|
||||
sleep(small_time)
|
||||
-- Show only on cursor line
|
||||
child.expect_screenshot()
|
||||
|
||||
sleep(test_times.animation_step)
|
||||
sleep(default_animation_step)
|
||||
-- One new step should be drawn
|
||||
child.expect_screenshot()
|
||||
end
|
||||
@ -692,7 +711,7 @@ T['Auto drawing']['updates immediately when scopes intersect'] = function()
|
||||
child.set_size(15, 15)
|
||||
|
||||
set_cursor(5, 4)
|
||||
sleep(test_times.delay + test_times.animation_step + 10)
|
||||
sleep(default_draw_delay + default_animation_step + small_time)
|
||||
-- Full scope should be shown
|
||||
child.expect_screenshot()
|
||||
|
||||
|
||||
@ -14,8 +14,7 @@ local get_cursor = function(...) return child.get_cursor(...) end
|
||||
local set_lines = function(...) return child.set_lines(...) end
|
||||
local get_lines = function(...) return child.get_lines(...) end
|
||||
local type_keys = function(...) return child.type_keys(...) end
|
||||
local poke_eventloop = function() child.api.nvim_eval('1') end
|
||||
local sleep = function(ms) vim.loop.sleep(ms); poke_eventloop() end
|
||||
local sleep = function(ms) helpers.sleep(ms, child, true) end
|
||||
--stylua: ignore end
|
||||
|
||||
-- Data =======================================================================
|
||||
@ -26,7 +25,10 @@ local example_lines = {
|
||||
'`!@#$%^&*()_+=.,1234567890',
|
||||
}
|
||||
|
||||
local test_times = { highlight = 250 }
|
||||
-- Time constants
|
||||
local default_highlight_delay = 250
|
||||
local helper_message_delay = 1000
|
||||
local small_time = helpers.get_time_const(10)
|
||||
|
||||
-- Output test set ============================================================
|
||||
local T = new_set({
|
||||
@ -98,6 +100,11 @@ T['setup()']['validates `config` argument'] = function()
|
||||
expect_config_error({ silent = 1 }, 'silent', 'boolean')
|
||||
end
|
||||
|
||||
T['setup()']['ensures colors'] = function()
|
||||
child.cmd('colorscheme default')
|
||||
expect.match(child.cmd_capture('hi MiniJump'), 'links to SpellRare')
|
||||
end
|
||||
|
||||
T['setup()']['properly handles `config.mappings`'] = function()
|
||||
local has_map = function(lhs, pattern) return child.cmd_capture('nmap ' .. lhs):find(pattern) ~= nil end
|
||||
eq(has_map('f', 'Jump'), true)
|
||||
@ -315,7 +322,7 @@ T['smart_jump()'] = new_set({
|
||||
|
||||
T['smart_jump()']['works'] = function()
|
||||
child.lua_notify('MiniJump.smart_jump()')
|
||||
poke_eventloop()
|
||||
child.poke_eventloop()
|
||||
type_keys('m')
|
||||
eq(get_cursor(), { 1, 4 })
|
||||
end
|
||||
@ -660,11 +667,11 @@ T['Jumping with f/t/F/T']['shows helper message after one idle second'] = functi
|
||||
set_lines(example_lines)
|
||||
set_cursor(1, 0)
|
||||
type_keys('f', 'e')
|
||||
sleep(200)
|
||||
sleep(0.5 * helper_message_delay)
|
||||
|
||||
-- Start another jump
|
||||
type_keys('h', 'f')
|
||||
sleep(1000)
|
||||
sleep(helper_message_delay + small_time)
|
||||
-- Should show colored helper message without adding it to `:messages` and
|
||||
-- causing hit-enter-prompt
|
||||
child.expect_screenshot()
|
||||
@ -733,7 +740,7 @@ T['Jumping with f/t/F/T']['respects `config.silent`'] = function()
|
||||
set_lines({ '1e2e3e4e' })
|
||||
set_cursor(1, 0)
|
||||
type_keys('f')
|
||||
sleep(1000 + 15)
|
||||
sleep(helper_message_delay + small_time)
|
||||
|
||||
-- Should not show helper message
|
||||
child.expect_screenshot()
|
||||
@ -938,10 +945,10 @@ T['Delayed highlighting']['works'] = new_set(
|
||||
set_cursor(1, key == key:lower() and 0 or 3)
|
||||
type_keys(key, 'e')
|
||||
|
||||
sleep(test_times.highlight - 10)
|
||||
sleep(default_highlight_delay - small_time)
|
||||
-- Nothing should yet be shown
|
||||
child.expect_screenshot()
|
||||
sleep(10)
|
||||
sleep(small_time)
|
||||
-- Everything should be shown
|
||||
child.expect_screenshot()
|
||||
end,
|
||||
@ -955,15 +962,16 @@ T['Delayed highlighting']['respects `config.delay.highlight`'] = new_set(
|
||||
local key = vim.endswith(direction, '_till') and 't' or 'f'
|
||||
key = vim.startswith(direction, 'backward') and key:upper() or key
|
||||
|
||||
child.lua('MiniJump.config.delay.highlight = 100')
|
||||
local new_highlight_delay = 5 * small_time
|
||||
child.lua('MiniJump.config.delay.highlight = ' .. new_highlight_delay)
|
||||
|
||||
set_cursor(1, key == key:lower() and 0 or 3)
|
||||
type_keys(key, 'e')
|
||||
|
||||
sleep(100 - 10)
|
||||
sleep(new_highlight_delay - small_time)
|
||||
-- Nothing should yet be shown
|
||||
child.expect_screenshot()
|
||||
sleep(10)
|
||||
sleep(small_time)
|
||||
-- Everything should be shown
|
||||
child.expect_screenshot()
|
||||
end,
|
||||
@ -971,16 +979,17 @@ T['Delayed highlighting']['respects `config.delay.highlight`'] = new_set(
|
||||
)
|
||||
|
||||
T['Delayed highlighting']['respects `vim.b.minijump_config`'] = function()
|
||||
child.lua('MiniJump.config.delay.highlight = 100')
|
||||
child.b.minijump_config = { delay = { highlight = 50 } }
|
||||
child.lua('MiniJump.config.delay.highlight = ' .. (5 * small_time))
|
||||
local new_highlight_delay = 3 * small_time
|
||||
child.b.minijump_config = { delay = { highlight = new_highlight_delay } }
|
||||
|
||||
set_cursor(1, 0)
|
||||
type_keys('f', 'e')
|
||||
|
||||
sleep(50 - 10)
|
||||
sleep(new_highlight_delay - small_time)
|
||||
-- Nothing should yet be shown
|
||||
child.expect_screenshot()
|
||||
sleep(10)
|
||||
sleep(small_time)
|
||||
-- Everything should be shown
|
||||
child.expect_screenshot()
|
||||
end
|
||||
@ -990,23 +999,23 @@ T['Delayed highlighting']['implements debounce-style delay'] = function()
|
||||
set_cursor(1, 0)
|
||||
|
||||
type_keys('f', 'e')
|
||||
sleep(test_times.highlight - 10)
|
||||
sleep(default_highlight_delay - small_time)
|
||||
-- Nothing should yet be shown
|
||||
child.expect_screenshot()
|
||||
|
||||
type_keys('f')
|
||||
sleep(test_times.highlight - 10)
|
||||
sleep(default_highlight_delay - small_time)
|
||||
-- Nothing should yet be shown (because debounce-style)
|
||||
child.expect_screenshot()
|
||||
|
||||
sleep(10)
|
||||
sleep(small_time)
|
||||
-- Nothing should yet be shown
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
T['Delayed highlighting']['stops immediately when not jumping'] = function()
|
||||
type_keys('f', 'e')
|
||||
sleep(test_times.highlight)
|
||||
sleep(default_highlight_delay)
|
||||
-- Should be highlighted
|
||||
child.expect_screenshot()
|
||||
|
||||
@ -1021,7 +1030,7 @@ T['Delayed highlighting']['updates immediately within same jumping'] = function(
|
||||
set_cursor(1, 0)
|
||||
type_keys('f', 'e')
|
||||
|
||||
sleep(test_times.highlight)
|
||||
sleep(default_highlight_delay)
|
||||
child.expect_screenshot()
|
||||
type_keys('t')
|
||||
child.expect_screenshot()
|
||||
@ -1038,11 +1047,11 @@ T['Delayed highlighting']['never highlights in Insert mode'] = function()
|
||||
set_cursor(1, 0)
|
||||
type_keys('f', 'e')
|
||||
|
||||
sleep(test_times.highlight)
|
||||
sleep(default_highlight_delay)
|
||||
child.expect_screenshot()
|
||||
|
||||
type_keys('ct', 'f')
|
||||
sleep(test_times.highlight + 10)
|
||||
sleep(default_highlight_delay + small_time)
|
||||
-- Shouldn't start highlighting
|
||||
child.expect_screenshot()
|
||||
end
|
||||
@ -1054,7 +1063,7 @@ T['Delayed highlighting']["respects 'ignorecase'"] = function()
|
||||
set_cursor(1, 0)
|
||||
type_keys('f', 'e')
|
||||
|
||||
sleep(test_times.highlight)
|
||||
sleep(default_highlight_delay)
|
||||
-- Should highlight both 'e'and 'E'
|
||||
child.expect_screenshot()
|
||||
end
|
||||
@ -1067,17 +1076,15 @@ T['Delayed highlighting']["respects 'smartcase'"] = function()
|
||||
set_cursor(1, 0)
|
||||
type_keys('f', 'E')
|
||||
|
||||
sleep(test_times.highlight)
|
||||
sleep(default_highlight_delay)
|
||||
-- Should highlight only 'E'
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
local delay = test_times.highlight + 25
|
||||
|
||||
T['Stop jumping after idle'] = new_set({
|
||||
hooks = {
|
||||
pre_case = function()
|
||||
child.lua('MiniJump.config.delay.idle_stop = ' .. delay)
|
||||
child.lua('MiniJump.config.delay.idle_stop = ' .. (default_highlight_delay + 2 * small_time))
|
||||
set_lines({ '1e2e3e4e', 'ff' })
|
||||
set_cursor(1, 0)
|
||||
child.set_size(5, 12)
|
||||
@ -1086,18 +1093,19 @@ T['Stop jumping after idle'] = new_set({
|
||||
})
|
||||
|
||||
T['Stop jumping after idle']['works'] = function()
|
||||
local idle_stop_delay = child.lua_get('MiniJump.config.delay.idle_stop')
|
||||
type_keys('f', 'e')
|
||||
eq(get_cursor(), { 1, 1 })
|
||||
|
||||
-- It works
|
||||
sleep(delay - 10)
|
||||
sleep(idle_stop_delay - small_time)
|
||||
type_keys('f')
|
||||
eq(get_cursor(), { 1, 3 })
|
||||
-- Should highlight
|
||||
-- Should highlight (as idle delay is bigger than highlight delay)
|
||||
child.expect_screenshot()
|
||||
|
||||
-- It implements debounce-style delay
|
||||
sleep(delay + 1)
|
||||
sleep(idle_stop_delay + small_time)
|
||||
-- It should have stopped jumping and this should initiate new jump
|
||||
type_keys('f', 'f')
|
||||
eq(get_cursor(), { 2, 0 })
|
||||
@ -1106,19 +1114,21 @@ T['Stop jumping after idle']['works'] = function()
|
||||
end
|
||||
|
||||
T['Stop jumping after idle']['works if should be done before target highlighting'] = function()
|
||||
child.lua('MiniJump.config.delay.idle_stop = ' .. test_times.highlight - 50)
|
||||
child.lua('MiniJump.config.delay.idle_stop = ' .. (default_highlight_delay - small_time))
|
||||
|
||||
type_keys('f', 'e')
|
||||
eq(get_cursor(), { 1, 1 })
|
||||
sleep(test_times.highlight + 1)
|
||||
sleep(default_highlight_delay + small_time)
|
||||
-- Should also not trigger highlighting
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
T['Stop jumping after idle']['respects `vim.b.minijump_config`'] = function()
|
||||
child.b.minijump_config = { delay = { idle_stop = 50 } }
|
||||
local idle_stop_delay = child.lua_get('MiniJump.config.delay.idle_stop')
|
||||
local new_idle_stop_delay = idle_stop_delay - 2 * small_time
|
||||
child.b.minijump_config = { delay = { idle_stop = new_idle_stop_delay } }
|
||||
type_keys('f', 'e')
|
||||
sleep(50)
|
||||
sleep(new_idle_stop_delay)
|
||||
|
||||
-- It should have stopped jumping and this should initiate new jump
|
||||
type_keys('f', 'f')
|
||||
|
||||
@ -13,8 +13,7 @@ local set_cursor = function(...) return child.set_cursor(...) end
|
||||
local get_cursor = function(...) return child.get_cursor(...) end
|
||||
local set_lines = function(...) return child.set_lines(...) end
|
||||
local type_keys = function(...) return child.type_keys(...) end
|
||||
local poke_eventloop = function() child.api.nvim_eval('1') end
|
||||
local sleep = function(ms) vim.loop.sleep(ms); poke_eventloop() end
|
||||
local sleep = function(ms) helpers.sleep(ms, child) end
|
||||
local get_latest_message = function() return child.cmd_capture('1messages') end
|
||||
--stylua: ignore end
|
||||
|
||||
@ -81,6 +80,10 @@ local setup_two_windows = function()
|
||||
return wins
|
||||
end
|
||||
|
||||
-- Time constants
|
||||
local helper_message_delay = 1000
|
||||
local small_time = helpers.get_time_const(10)
|
||||
|
||||
-- Output test set ============================================================
|
||||
local T = new_set({
|
||||
hooks = {
|
||||
@ -174,6 +177,11 @@ T['setup()']['validates `config` argument'] = function()
|
||||
expect_config_error({ silent = 'a' }, 'silent', 'boolean')
|
||||
end
|
||||
|
||||
T['setup()']['ensures colors'] = function()
|
||||
child.cmd('colorscheme default')
|
||||
expect.match(child.cmd_capture('hi MiniJump2dSpot'), 'gui=bold,nocombine guifg=[Ww]hite guibg=[Bb]lack')
|
||||
end
|
||||
|
||||
T['setup()']['applies `config.mappings`'] = function()
|
||||
child.set_size(5, 12)
|
||||
set_lines({ 'xxxx', 'xxxx' })
|
||||
@ -210,11 +218,6 @@ T['setup()']['resets <CR> mapping in command-line window'] = function()
|
||||
eq(child.get_lines(), { 'Hello', '' })
|
||||
end
|
||||
|
||||
T['setup()']['defines non-linked default highlighting on `ColorScheme`'] = function()
|
||||
child.cmd('colorscheme blue')
|
||||
expect.match(child.cmd_capture('hi MiniJump2dSpot'), 'gui=bold,nocombine guifg=[Ww]hite guibg=[Bb]lack')
|
||||
end
|
||||
|
||||
T['start()'] = new_set({
|
||||
hooks = {
|
||||
pre_case = function()
|
||||
@ -230,7 +233,7 @@ T['start()'] = new_set({
|
||||
|
||||
local start = function(...)
|
||||
child.lua('MiniJump2d.start(...)', { ... })
|
||||
poke_eventloop()
|
||||
child.poke_eventloop()
|
||||
end
|
||||
|
||||
T['start()']['works'] = function()
|
||||
@ -355,7 +358,7 @@ T['start()']['prompts helper message after one idle second'] = function()
|
||||
child.lua([[MiniJump2d.config.labels = 'jk']])
|
||||
|
||||
start()
|
||||
sleep(1000 + 10)
|
||||
sleep(helper_message_delay + small_time)
|
||||
|
||||
-- Should show helper message without adding it to `:messages` and causing
|
||||
-- hit-enter-prompt
|
||||
@ -364,11 +367,11 @@ T['start()']['prompts helper message after one idle second'] = function()
|
||||
|
||||
-- Should clean afterwards
|
||||
type_keys('j')
|
||||
sleep(10)
|
||||
sleep(small_time)
|
||||
child.expect_screenshot()
|
||||
|
||||
-- Should show message for every key in sequence
|
||||
sleep(1000 + 10)
|
||||
sleep(helper_message_delay + small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
@ -856,7 +859,7 @@ T['start()']['respects `config.silent`'] = function()
|
||||
child.set_size(10, 20)
|
||||
|
||||
start()
|
||||
sleep(1000 + 15)
|
||||
sleep(helper_message_delay + small_time)
|
||||
|
||||
-- Should not show helper message
|
||||
child.expect_screenshot()
|
||||
@ -1142,9 +1145,9 @@ T['builtin_opts.single_character']['prompts helper message after one idle second
|
||||
|
||||
start_single_char()
|
||||
eq(get_latest_message(), '')
|
||||
sleep(1000 - 10)
|
||||
sleep(helper_message_delay - small_time)
|
||||
eq(get_latest_message(), '')
|
||||
sleep(10 + 1)
|
||||
sleep(small_time + small_time)
|
||||
|
||||
-- Should show helper message without adding it to `:messages` and causing
|
||||
-- hit-enter-prompt
|
||||
|
||||
@ -241,6 +241,11 @@ T['setup()']['validates `config` argument'] = function()
|
||||
expect_config_error({ window = { zindex = 'a' } }, 'window.zindex', 'number')
|
||||
end
|
||||
|
||||
T['setup()']['ensures colors'] = function()
|
||||
child.cmd('colorscheme default')
|
||||
expect.match(child.cmd_capture('hi MiniMapNormal'), 'links to NormalFloat')
|
||||
end
|
||||
|
||||
local encode_strings = function(strings, opts)
|
||||
local cmd = string.format('MiniMap.encode_strings(%s, %s)', vim.inspect(strings), vim.inspect(opts))
|
||||
return child.lua_get(cmd)
|
||||
@ -1215,17 +1220,16 @@ T['gen_integration']['diff()']['updates when appropriate'] = function()
|
||||
|
||||
mock_diff()
|
||||
child.lua([[
|
||||
MiniMap.current.opts.integrations = { MiniMap.gen_integration.diff() }
|
||||
_G.log = {}
|
||||
local refresh_orig = MiniMap.refresh
|
||||
MiniMap.refresh = function(...)
|
||||
table.insert(_G.log, { ... })
|
||||
_G.n = (_G.n or 0) + 1
|
||||
refresh_orig(...)
|
||||
end
|
||||
]])
|
||||
eq(child.lua_get('#_G.log'), 0)
|
||||
child.lua('MiniMap.current.opts.integrations = { MiniMap.gen_integration.diff() }')
|
||||
child.lua('_G.n = 0')
|
||||
child.cmd('doautocmd User MiniDiffUpdated')
|
||||
eq(child.lua_get('#_G.log'), 1)
|
||||
eq(child.lua_get('_G.n'), 1)
|
||||
end
|
||||
|
||||
T['gen_integration']['diff()']['works if no diff data is found'] = function()
|
||||
|
||||
@ -4,9 +4,17 @@ local child = helpers.new_child_neovim()
|
||||
local expect, eq = helpers.expect, helpers.expect.equality
|
||||
local new_set = MiniTest.new_set
|
||||
|
||||
local path_sep = package.config:sub(1, 1)
|
||||
local project_root = vim.fn.fnamemodify(vim.fn.getcwd(), ':p')
|
||||
local dir_misc_path = project_root .. 'tests/dir-misc/'
|
||||
local fs_normalize = vim.fs.normalize
|
||||
if vim.fn.has('nvim-0.9') == 0 then
|
||||
fs_normalize = function(...) return vim.fs.normalize(...):gsub('(.)/+$', '%1') end
|
||||
end
|
||||
|
||||
local skip_if_no_010 = function()
|
||||
if child.fn.has('nvim-0.10') == 0 then MiniTest.skip('`setup_termbg_sync()` works only on Neovim>=0.10') end
|
||||
end
|
||||
|
||||
local project_root = fs_normalize(vim.fn.fnamemodify(vim.fn.getcwd(), ':p'))
|
||||
local dir_misc_path = project_root .. '/tests/dir-misc'
|
||||
|
||||
-- Helpers with child processes
|
||||
--stylua: ignore start
|
||||
@ -15,14 +23,18 @@ local unload_module = function() child.mini_unload('misc') end
|
||||
local reload_module = function(config) unload_module(); load_module(config) end
|
||||
local set_lines = function(...) return child.set_lines(...) end
|
||||
local get_lines = function(...) return child.get_lines(...) end
|
||||
local make_path = function(...) return table.concat({...}, path_sep):gsub(path_sep .. path_sep, path_sep) end
|
||||
local make_path = function(...) return fs_normalize(table.concat({...}, '/')) end
|
||||
local make_abspath = function(...) return make_path(project_root, ...) end
|
||||
local getcwd = function() return child.fn.fnamemodify(child.fn.getcwd(), ':p') end
|
||||
local getcwd = function() return fs_normalize(child.fn.getcwd()) end
|
||||
local set_cursor = function(...) return child.set_cursor(...) end
|
||||
local get_cursor = function(...) return child.get_cursor(...) end
|
||||
local edit = function(x) child.cmd('edit ' .. x) end
|
||||
--stylua: ignore end
|
||||
|
||||
-- Time constants
|
||||
local small_time = helpers.get_time_const(10)
|
||||
local no_term_response_delay = 1000
|
||||
|
||||
-- Output test set ============================================================
|
||||
local T = new_set({
|
||||
hooks = {
|
||||
@ -72,7 +84,10 @@ end
|
||||
|
||||
T['bench_time()'] = new_set({
|
||||
hooks = {
|
||||
pre_case = function() child.lua('_G.f = function(ms) ms = ms or 10; vim.loop.sleep(ms); return ms end') end,
|
||||
pre_case = function()
|
||||
child.lua('_G.small_time = ' .. small_time)
|
||||
child.lua('_G.f = function(ms) ms = ms or _G.small_time; vim.loop.sleep(ms); return ms end')
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
@ -80,13 +95,15 @@ local bench_time = function(...) return unpack(child.lua_get('{ MiniMisc.bench_t
|
||||
|
||||
-- Validate that benchmark is within tolerable error from target. This is
|
||||
-- needed due to random nature of benchmarks.
|
||||
local validate_benchmark = function(time_tbl, target, error)
|
||||
error = error or 0.2
|
||||
local validate_benchmark = function(time_tbl, target)
|
||||
helpers.skip_if_slow()
|
||||
|
||||
local s, n = 0, 0
|
||||
for _, x in ipairs(time_tbl) do
|
||||
s, n = s + x, n + 1
|
||||
end
|
||||
|
||||
local error = 0.2
|
||||
eq(n * target * (1 - error) < s, true)
|
||||
eq(s < target * (1 + error) * n, true)
|
||||
end
|
||||
@ -95,23 +112,23 @@ T['bench_time()']['works'] = function()
|
||||
local b, res = bench_time()
|
||||
-- By default should run function once
|
||||
eq(#b, 1)
|
||||
validate_benchmark(b, 0.01)
|
||||
validate_benchmark(b, 0.001 * small_time)
|
||||
-- Second value is function output
|
||||
eq(res, 10)
|
||||
eq(res, small_time)
|
||||
end
|
||||
|
||||
T['bench_time()']['respects `n` argument'] = function()
|
||||
local b, _ = bench_time(5)
|
||||
-- By default should run function once
|
||||
eq(#b, 5)
|
||||
validate_benchmark(b, 0.01)
|
||||
validate_benchmark(b, 0.001 * small_time)
|
||||
end
|
||||
|
||||
T['bench_time()']['respects `...` as benched time arguments'] = function()
|
||||
local b, res = bench_time(1, 50)
|
||||
validate_benchmark(b, 0.05)
|
||||
local b, res = bench_time(1, 5 * small_time)
|
||||
validate_benchmark(b, 0.001 * 5 * small_time)
|
||||
-- Second value is function output
|
||||
eq(res, 50)
|
||||
eq(res, 5 * small_time)
|
||||
end
|
||||
|
||||
T['get_gutter_width()'] = new_set()
|
||||
@ -204,7 +221,7 @@ T['resize_window()']['works'] = function()
|
||||
end
|
||||
|
||||
T['resize_window()']['correctly computes default `text_width` argument'] = function()
|
||||
child.api.nvim_win_set_option(0, 'signcolumn', 'yes:2')
|
||||
child.wo.signcolumn = 'yes:2'
|
||||
|
||||
-- min(vim.o.columns, 79) < textwidth < colorcolumn
|
||||
child.o.columns = 160
|
||||
@ -234,15 +251,11 @@ T['resize_window()']['correctly computes default `text_width` argument'] = funct
|
||||
eq(child.api.nvim_win_get_width(0), 40 + 4)
|
||||
end
|
||||
|
||||
local git_repo_path = make_abspath('tests/dir-misc/mocked-git-repo/')
|
||||
local git_repo_path = make_abspath('tests/dir-misc/mocked-git-repo')
|
||||
local git_path = make_abspath('tests/dir-misc/mocked-git-repo/.git')
|
||||
local test_file_makefile = make_abspath('tests/dir-misc/aaa.lua')
|
||||
local test_file_git = make_abspath('tests/dir-misc/mocked-git-repo/bbb.lua')
|
||||
|
||||
local skip_if_no_fs = function()
|
||||
if child.lua_get('type(vim.fs)') == 'nil' then MiniTest.skip('No `vim.fs`.') end
|
||||
end
|
||||
|
||||
local init_mock_git = function(git_type)
|
||||
if git_type == 'file' then
|
||||
-- File '.git' is used inside submodules
|
||||
@ -259,7 +272,6 @@ T['setup_auto_root()'] = new_set({ hooks = { post_case = cleanup_mock_git } })
|
||||
local setup_auto_root = function(...) child.lua('MiniMisc.setup_auto_root(...)', { ... }) end
|
||||
|
||||
T['setup_auto_root()']['works'] = function()
|
||||
skip_if_no_fs()
|
||||
eq(getcwd(), project_root)
|
||||
child.o.autochdir = true
|
||||
|
||||
@ -285,15 +297,12 @@ T['setup_auto_root()']['works'] = function()
|
||||
end
|
||||
|
||||
T['setup_auto_root()']['validates input'] = function()
|
||||
skip_if_no_fs()
|
||||
|
||||
expect.error(function() setup_auto_root('a') end, '`names`.*array')
|
||||
expect.error(function() setup_auto_root({ 1 }) end, '`names`.*string')
|
||||
expect.error(function() setup_auto_root({ '.git' }, 1) end, '`fallback`.*callable')
|
||||
end
|
||||
|
||||
T['setup_auto_root()']['respects `names` argument'] = function()
|
||||
skip_if_no_fs()
|
||||
init_mock_git('directory')
|
||||
setup_auto_root({ 'Makefile' })
|
||||
|
||||
@ -303,7 +312,6 @@ T['setup_auto_root()']['respects `names` argument'] = function()
|
||||
end
|
||||
|
||||
T['setup_auto_root()']['allows callable `names`'] = function()
|
||||
skip_if_no_fs()
|
||||
init_mock_git('directory')
|
||||
child.lua([[_G.find_aaa = function(x) return x == 'aaa.lua' end]])
|
||||
child.lua('MiniMisc.setup_auto_root(_G.find_aaa)')
|
||||
@ -315,8 +323,6 @@ T['setup_auto_root()']['allows callable `names`'] = function()
|
||||
end
|
||||
|
||||
T['setup_auto_root()']['respects `fallback` argument'] = function()
|
||||
skip_if_no_fs()
|
||||
|
||||
-- Should return and cache fallback result if not found root by going up
|
||||
-- NOTE: More tests are done in `find_root()`
|
||||
local lua_cmd = string.format(
|
||||
@ -326,13 +332,11 @@ T['setup_auto_root()']['respects `fallback` argument'] = function()
|
||||
child.lua(lua_cmd)
|
||||
|
||||
child.cmd('edit ' .. test_file_git)
|
||||
eq(child.lua_get('_G.path_arg'), child.api.nvim_buf_get_name(0))
|
||||
eq(child.lua_get('_G.path_arg'), fs_normalize(child.api.nvim_buf_get_name(0)))
|
||||
eq(getcwd(), dir_misc_path)
|
||||
end
|
||||
|
||||
T['setup_auto_root()']['works in buffers without path'] = function()
|
||||
skip_if_no_fs()
|
||||
|
||||
setup_auto_root()
|
||||
|
||||
local scratch_buf_id = child.api.nvim_create_buf(false, true)
|
||||
@ -347,8 +351,6 @@ T['find_root()'] = new_set({ hooks = { post_case = cleanup_mock_git } })
|
||||
local find_root = function(...) return child.lua_get('MiniMisc.find_root(...)', { ... }) end
|
||||
|
||||
T['find_root()']['works'] = function()
|
||||
skip_if_no_fs()
|
||||
|
||||
-- Respects 'Makefile'
|
||||
child.cmd('edit ' .. test_file_makefile)
|
||||
eq(find_root(), dir_misc_path)
|
||||
@ -365,8 +367,6 @@ T['find_root()']['works'] = function()
|
||||
end
|
||||
|
||||
T['find_root()']['validates arguments'] = function()
|
||||
skip_if_no_fs()
|
||||
|
||||
expect.error(function() find_root('a') end, '`buf_id`.*number')
|
||||
expect.error(function() find_root(0, 1) end, '`names`.*string')
|
||||
expect.error(function() find_root(0, '.git') end, '`names`.*array')
|
||||
@ -374,7 +374,6 @@ T['find_root()']['validates arguments'] = function()
|
||||
end
|
||||
|
||||
T['find_root()']['respects `buf_id` argument'] = function()
|
||||
skip_if_no_fs()
|
||||
init_mock_git('directory')
|
||||
|
||||
child.cmd('edit ' .. test_file_makefile)
|
||||
@ -386,7 +385,6 @@ T['find_root()']['respects `buf_id` argument'] = function()
|
||||
end
|
||||
|
||||
T['find_root()']['respects `names` argument'] = function()
|
||||
skip_if_no_fs()
|
||||
init_mock_git('directory')
|
||||
|
||||
-- Should not stop on git repo directory, but continue going up
|
||||
@ -395,7 +393,6 @@ T['find_root()']['respects `names` argument'] = function()
|
||||
end
|
||||
|
||||
T['find_root()']['allows callable `names`'] = function()
|
||||
skip_if_no_fs()
|
||||
init_mock_git('directory')
|
||||
child.cmd('edit ' .. test_file_git)
|
||||
|
||||
@ -404,8 +401,6 @@ T['find_root()']['allows callable `names`'] = function()
|
||||
end
|
||||
|
||||
T['find_root()']['respects `fallback` argument'] = function()
|
||||
skip_if_no_fs()
|
||||
|
||||
local validate = function(fallback_output, ref)
|
||||
local lua_cmd = string.format(
|
||||
[[MiniMisc.find_root(
|
||||
@ -418,7 +413,7 @@ T['find_root()']['respects `fallback` argument'] = function()
|
||||
eq(child.lua_get(lua_cmd), ref)
|
||||
|
||||
-- Fallback should be called with buffer path
|
||||
eq(child.lua_get('_G.path_arg'), child.api.nvim_buf_get_name(0))
|
||||
eq(child.lua_get('_G.path_arg'), fs_normalize(child.api.nvim_buf_get_name(0)))
|
||||
|
||||
-- Cleanup
|
||||
child.lua('_G.path_arg = nil')
|
||||
@ -440,16 +435,12 @@ T['find_root()']['respects `fallback` argument'] = function()
|
||||
end
|
||||
|
||||
T['find_root()']['works in buffers without path'] = function()
|
||||
skip_if_no_fs()
|
||||
|
||||
local scratch_buf_id = child.api.nvim_create_buf(false, true)
|
||||
child.api.nvim_set_current_buf(scratch_buf_id)
|
||||
eq(find_root(), vim.NIL)
|
||||
end
|
||||
|
||||
T['find_root()']['uses cache'] = function()
|
||||
skip_if_no_fs()
|
||||
|
||||
child.cmd('edit ' .. test_file_git)
|
||||
-- Returns root based on 'Makefile' as there is no git root
|
||||
eq(find_root(), dir_misc_path)
|
||||
@ -463,16 +454,21 @@ end
|
||||
T['setup_termbg_sync()'] = new_set({
|
||||
hooks = {
|
||||
pre_case = function()
|
||||
-- Mock `io.write` used to send control sequences to terminal emulator
|
||||
child.lua([[
|
||||
-- Mock `io.stdout:write` used to send control sequences to terminal emulator
|
||||
_G.log = {}
|
||||
io.write = function(...) table.insert(_G.log, { ... }) end
|
||||
io.stdout = { write = function(self, ...) table.insert(_G.log, { ... }) end }
|
||||
|
||||
-- Mock attached UI
|
||||
vim.api.nvim_list_uis = function() return { { stdout_tty = true } } end
|
||||
]])
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
T['setup_termbg_sync()']['works'] = function()
|
||||
skip_if_no_010()
|
||||
|
||||
local eq_log = function(ref_log)
|
||||
eq(child.lua_get('_G.log'), ref_log)
|
||||
child.lua('_G.log = {}')
|
||||
@ -495,12 +491,15 @@ T['setup_termbg_sync()']['works'] = function()
|
||||
child.api.nvim_exec_autocmds(event, {})
|
||||
eq_log({ { log_entry } })
|
||||
end
|
||||
validate_event('UIEnter', '\027]11;#dddddd\007')
|
||||
validate_event('VimResume', '\027]11;#dddddd\007')
|
||||
validate_event('ColorScheme', '\027]11;#dddddd\007')
|
||||
validate_event('UILeave', '\027]11;#11262d\007')
|
||||
validate_event('VimLeavePre', '\027]11;#11262d\007')
|
||||
validate_event('VimSuspend', '\027]11;#11262d\007')
|
||||
end
|
||||
|
||||
T['setup_termbg_sync()']['can be called multiple times'] = function()
|
||||
skip_if_no_010()
|
||||
|
||||
child.cmd('hi Normal guifg=#222222 guibg=#dddddd')
|
||||
child.lua('MiniMisc.setup_termbg_sync()')
|
||||
child.api.nvim_exec_autocmds('TermResponse', { data = '\27]11;rgb:1111/2626/2d2d' })
|
||||
@ -514,11 +513,31 @@ T['setup_termbg_sync()']['can be called multiple times'] = function()
|
||||
child.lua('_G.log = {}')
|
||||
|
||||
-- Should reset to the color from the very first call
|
||||
child.api.nvim_exec_autocmds('UILeave', {})
|
||||
child.api.nvim_exec_autocmds('VimLeavePre', {})
|
||||
eq(child.lua_get('_G.log'), { { '\27]11;#11262d\a' } })
|
||||
end
|
||||
|
||||
T['setup_termbg_sync()']['does nothing if there is no proper stdout'] = function()
|
||||
skip_if_no_010()
|
||||
|
||||
local validate = function()
|
||||
child.lua('MiniMisc.setup_termbg_sync()')
|
||||
child.api.nvim_create_augroup('MiniMiscTermbgSync', { clear = false })
|
||||
eq(child.lua_get('#vim.api.nvim_get_autocmds({ group = "MiniMiscTermbgSync" })'), 0)
|
||||
end
|
||||
|
||||
-- No UI
|
||||
child.lua('vim.api.nvim_list_uis = function() return {} end')
|
||||
validate()
|
||||
|
||||
-- UI without stdout (like GUI)
|
||||
child.lua('vim.api.nvim_list_uis = function() return { { stdout_tty = false } } end')
|
||||
validate()
|
||||
end
|
||||
|
||||
T['setup_termbg_sync()']['handles no response from terminal emulator'] = function()
|
||||
skip_if_no_010()
|
||||
|
||||
child.lua('_G.notify_log = {}; vim.notify = function(...) table.insert(_G.notify_log, { ... }) end')
|
||||
child.lua('MiniMisc.setup_termbg_sync()')
|
||||
local validate_n_autocmds = function(ref_n)
|
||||
@ -527,7 +546,7 @@ T['setup_termbg_sync()']['handles no response from terminal emulator'] = functio
|
||||
validate_n_autocmds(1)
|
||||
|
||||
-- If there is no response from terminal emulator for 1s, delete autocmd
|
||||
vim.loop.sleep(1000 + 10)
|
||||
vim.loop.sleep(no_term_response_delay + small_time)
|
||||
validate_n_autocmds(0)
|
||||
|
||||
-- Should show informative notification
|
||||
@ -539,6 +558,8 @@ T['setup_termbg_sync()']['handles no response from terminal emulator'] = functio
|
||||
end
|
||||
|
||||
T['setup_termbg_sync()']['handles bad response from terminal emulator'] = function()
|
||||
skip_if_no_010()
|
||||
|
||||
child.lua('_G.notify_log = {}; vim.notify = function(...) table.insert(_G.notify_log, { ... }) end')
|
||||
child.lua('MiniMisc.setup_termbg_sync()')
|
||||
child.api.nvim_exec_autocmds('TermResponse', { data = 'something-bad' })
|
||||
@ -555,6 +576,8 @@ T['setup_termbg_sync()']['handles bad response from terminal emulator'] = functi
|
||||
end
|
||||
|
||||
T['setup_termbg_sync()']['handles different color formats'] = function()
|
||||
skip_if_no_010()
|
||||
|
||||
local validate = function(term_response_color, ref_color)
|
||||
-- Mock clean start to overcome that color is parsed only once per session
|
||||
child.lua('package.loaded["mini.misc"] = nil')
|
||||
@ -563,7 +586,7 @@ T['setup_termbg_sync()']['handles different color formats'] = function()
|
||||
|
||||
-- Should properly parse initial background and use it to reset on exit
|
||||
child.lua('_G.log = {}')
|
||||
child.api.nvim_exec_autocmds('UILeave', {})
|
||||
child.api.nvim_exec_autocmds('VimLeavePre', {})
|
||||
eq(child.lua_get('_G.log'), { { '\027]11;' .. ref_color .. '\007' } })
|
||||
|
||||
-- Clean up
|
||||
@ -770,15 +793,15 @@ T['use_nested_comments()'] = new_set({
|
||||
})
|
||||
|
||||
T['use_nested_comments()']['works'] = function()
|
||||
child.api.nvim_buf_set_option(0, 'commentstring', '# %s')
|
||||
child.bo.commentstring = '# %s'
|
||||
child.lua('MiniMisc.use_nested_comments()')
|
||||
eq(child.api.nvim_buf_get_option(0, 'comments'), 'n:#,' .. comments_option)
|
||||
eq(child.bo.comments, 'n:#,' .. comments_option)
|
||||
end
|
||||
|
||||
T['use_nested_comments()']["ignores 'commentstring' with two parts"] = function()
|
||||
child.api.nvim_buf_set_option(0, 'commentstring', '/*%s*/')
|
||||
child.bo.commentstring = '/*%s*/'
|
||||
child.lua('MiniMisc.use_nested_comments()')
|
||||
eq(child.api.nvim_buf_get_option(0, 'comments'), comments_option)
|
||||
eq(child.bo.comments, comments_option)
|
||||
end
|
||||
|
||||
T['use_nested_comments()']['respects `buf_id` argument'] = function()
|
||||
@ -787,7 +810,7 @@ T['use_nested_comments()']['respects `buf_id` argument'] = function()
|
||||
|
||||
child.lua('MiniMisc.use_nested_comments(...)', { new_buf_id })
|
||||
|
||||
eq(child.api.nvim_buf_get_option(0, 'comments'), comments_option)
|
||||
eq(child.bo.comments, comments_option)
|
||||
eq(child.api.nvim_buf_get_option(new_buf_id, 'comments'), 'n:#,' .. comments_option)
|
||||
end
|
||||
|
||||
|
||||
@ -18,6 +18,27 @@ local type_keys = function(...) return child.type_keys(...) end
|
||||
|
||||
local get_fold_range = function(line_num) return { child.fn.foldclosed(line_num), child.fn.foldclosedend(line_num) } end
|
||||
|
||||
local setup_registers = function()
|
||||
local reginfo_arr = {
|
||||
{ reg = '0', info = { regcontents = { '0', '0', '0' }, regtype = '\0221' } },
|
||||
{ reg = '1', info = { regcontents = { '111', '111' }, regtype = 'V' } },
|
||||
{ reg = '2', info = { regcontents = { '222', '222' }, regtype = 'V' } },
|
||||
{ reg = '9', info = { regcontents = { '999', '999' }, regtype = 'V' } },
|
||||
{ reg = '-', info = { regcontents = { '---' }, regtype = 'v' } },
|
||||
{ reg = 'z', info = { regcontents = { 'zzz' }, regtype = 'v' } },
|
||||
{ reg = '"', info = { points_to = 'z' } },
|
||||
}
|
||||
local ref = {}
|
||||
for _, data in ipairs(reginfo_arr) do
|
||||
child.fn.setreg(data.reg, data.info)
|
||||
ref[data.reg] = child.fn.getreginfo(data.reg)
|
||||
end
|
||||
-- Make sure that 'z' register has proper `isunnamed` field
|
||||
ref['z'] = child.fn.getreginfo('z')
|
||||
|
||||
return ref
|
||||
end
|
||||
|
||||
local validate_state = function(lines, selection)
|
||||
eq(get_lines(), lines)
|
||||
eq({ { child.fn.line('v'), child.fn.col('v') }, { child.fn.line('.'), child.fn.col('.') } }, selection)
|
||||
@ -736,17 +757,44 @@ T['move_selection()']['works with multibyte characters'] = function()
|
||||
validate_state({ 'ыыы', '', 'ыыXXыыы' }, { { 3, 5 }, { 3, 6 } })
|
||||
end
|
||||
|
||||
T['move_selection()']['works in small buffers'] = function()
|
||||
local validate = function(line_before, vis_mode, direction, line_after)
|
||||
child.ensure_normal_mode()
|
||||
set_lines({ line_before })
|
||||
set_cursor(1, 1)
|
||||
type_keys(vis_mode)
|
||||
move(direction)
|
||||
eq(get_lines(), { line_after or line_before })
|
||||
end
|
||||
|
||||
-- Should do nothing in empty buffer
|
||||
for _, vis_mode in ipairs({ 'v', 'V', '<C-v>' }) do
|
||||
for _, direction in ipairs({ 'up', 'down', 'left', 'right' }) do
|
||||
validate('', vis_mode, direction)
|
||||
end
|
||||
end
|
||||
|
||||
-- Should work only horizontally in single line buffer
|
||||
validate('abc', 'v', 'up', 'abc')
|
||||
validate('abc', 'v', 'down', 'abc')
|
||||
validate('abc', 'V', 'up', 'abc')
|
||||
validate('abc', 'V', 'down', 'abc')
|
||||
validate('abc', '<C-v>', 'up', 'abc')
|
||||
validate('abc', '<C-v>', 'down', 'abc')
|
||||
|
||||
validate('abc', 'v', 'left', 'bac')
|
||||
validate('abc', 'v', 'right', 'acb')
|
||||
validate('\tabc', 'V', 'left', 'abc')
|
||||
validate('abc', 'V', 'right', '\tabc')
|
||||
validate('abc', '<C-v>', 'left', 'bac')
|
||||
validate('abc', '<C-v>', 'right', 'acb')
|
||||
end
|
||||
|
||||
T['move_selection()']['has no side effects'] = function()
|
||||
set_lines({ 'abXcd' })
|
||||
set_lines({ 'aaa', 'bbb' })
|
||||
|
||||
-- Shouldn't modify used `z` or unnamed registers
|
||||
set_cursor(1, 0)
|
||||
type_keys('"zyl')
|
||||
eq(child.fn.getreg('z'), 'a')
|
||||
|
||||
set_cursor(1, 1)
|
||||
type_keys('yl')
|
||||
eq(child.fn.getreg('"'), 'b')
|
||||
-- Shouldn't modify any possibly affected registers
|
||||
local reginfo_ref = setup_registers()
|
||||
|
||||
-- Shouldn't modify 'virtualedit'
|
||||
child.o.virtualedit = 'block,insert'
|
||||
@ -754,18 +802,29 @@ T['move_selection()']['has no side effects'] = function()
|
||||
-- Shouldn't affect yank history from 'mini.bracketed'
|
||||
child.cmd('au TextYankPost * lua if not vim.b.minibracketed_disable then _G.been_here = true end')
|
||||
|
||||
-- Perform move
|
||||
set_cursor(1, 2)
|
||||
type_keys('v')
|
||||
move('right')
|
||||
validate_state1d('abcXd', { 4, 4 })
|
||||
local validate = function()
|
||||
for reg, info in pairs(reginfo_ref) do
|
||||
eq(child.fn.getreginfo(reg), info)
|
||||
end
|
||||
eq(child.o.virtualedit, 'block,insert')
|
||||
eq(child.lua_get('_G.been_here'), vim.NIL)
|
||||
eq(child.lua_get('vim.b.minibracketed_disable'), vim.NIL)
|
||||
end
|
||||
|
||||
-- Check
|
||||
eq(child.fn.getreg('z'), 'a')
|
||||
eq(child.fn.getreg('"'), 'b')
|
||||
eq(child.o.virtualedit, 'block,insert')
|
||||
eq(child.lua_get('_G.been_here'), vim.NIL)
|
||||
eq(child.lua_get('vim.b.minibracketed_disable'), vim.NIL)
|
||||
-- Perform linewise move
|
||||
set_cursor(1, 0)
|
||||
type_keys('V')
|
||||
move('down')
|
||||
validate_state({ 'bbb', 'aaa' }, { { 2, 1 }, { 2, 1 } })
|
||||
validate()
|
||||
child.ensure_normal_mode()
|
||||
|
||||
-- Perform charwise move
|
||||
set_cursor(1, 1)
|
||||
type_keys('v')
|
||||
move('down')
|
||||
validate_state({ 'bb', 'abaa' }, { { 2, 2 }, { 2, 2 } })
|
||||
validate()
|
||||
end
|
||||
|
||||
T['move_selection()']['works with `virtualedit=all`'] = function()
|
||||
@ -1061,17 +1120,32 @@ T['move_line()']['respects `opts.n_times` horizontally'] = function()
|
||||
validate_line_state({ '\taa' }, { 1, 1 })
|
||||
end
|
||||
|
||||
T['move_line()']['works in small buffers'] = function()
|
||||
local validate = function(line_before, direction, line_after)
|
||||
set_lines({ line_before })
|
||||
set_cursor(1, 0)
|
||||
move_line(direction)
|
||||
eq(get_lines(), { line_after or line_before })
|
||||
end
|
||||
|
||||
-- Should do nothing in empty buffer
|
||||
validate('', 'up', '')
|
||||
validate('', 'down', '')
|
||||
validate('', 'left', '')
|
||||
validate('', 'right', '')
|
||||
|
||||
-- Should work only horizontally in single line buffer
|
||||
validate('abc', 'up', 'abc')
|
||||
validate('abc', 'down', 'abc')
|
||||
validate('\tabc', 'left', 'abc')
|
||||
validate('abc', 'right', '\tabc')
|
||||
end
|
||||
|
||||
T['move_line()']['has no side effects'] = function()
|
||||
set_lines({ 'aaa', 'bbb' })
|
||||
|
||||
-- Shouldn't modify used `z` and unnamed registers
|
||||
set_cursor(1, 0)
|
||||
type_keys('"zyl')
|
||||
eq(child.fn.getreg('z'), 'a')
|
||||
|
||||
set_cursor(2, 0)
|
||||
type_keys('yl')
|
||||
eq(child.fn.getreg('"'), 'b')
|
||||
-- Shouldn't modify any possibly affected registers
|
||||
local reginfo_ref = setup_registers()
|
||||
|
||||
-- Shouldn't affect yank history from 'mini.bracketed'
|
||||
child.cmd('au TextYankPost * lua if not vim.b.minibracketed_disable then _G.been_here = true end')
|
||||
@ -1082,8 +1156,9 @@ T['move_line()']['has no side effects'] = function()
|
||||
validate_line_state({ 'bbb', 'aaa' }, { 2, 0 })
|
||||
|
||||
-- Check
|
||||
eq(child.fn.getreg('z'), 'a')
|
||||
eq(child.fn.getreg('"'), 'b')
|
||||
for reg, info in pairs(reginfo_ref) do
|
||||
eq(child.fn.getreginfo(reg), info)
|
||||
end
|
||||
eq(child.lua_get('_G.been_here'), vim.NIL)
|
||||
eq(child.lua_get('vim.b.minibracketed_disable'), vim.NIL)
|
||||
end
|
||||
|
||||
@ -8,8 +8,7 @@ local new_set = MiniTest.new_set
|
||||
--stylua: ignore start
|
||||
local load_module = function(config) child.mini_load('notify', config) end
|
||||
local unload_module = function() child.mini_unload('notify') end
|
||||
local poke_eventloop = function() child.api.nvim_eval('1') end
|
||||
local sleep = function(ms) vim.loop.sleep(ms); poke_eventloop() end
|
||||
local sleep = function(ms) helpers.sleep(ms, child) end
|
||||
--stylua: ignore end
|
||||
|
||||
-- Common test helpers
|
||||
@ -35,13 +34,13 @@ local get = forward_lua('MiniNotify.get')
|
||||
local get_all = forward_lua('MiniNotify.get_all')
|
||||
|
||||
-- Common mocks
|
||||
local ref_seconds, ref_microseconds = 1703673296, 0.123456
|
||||
local ref_seconds, ref_microseconds = 1703680496, 0.123456
|
||||
local mock_gettimeofday = function()
|
||||
-- Ensure reproducibility of `vim.fn.strftime`
|
||||
child.lua([[
|
||||
vim.loop.os_setenv('TZ', 'Europe/Kiev')
|
||||
vim.cmd('language time en_US.utf8')
|
||||
]])
|
||||
child.loop.os_setenv('TZ', 'Etc/UTC')
|
||||
child.loop.os_setenv('_TZ', 'Etc/UTC')
|
||||
child.cmd('language time en_US.UTF-8')
|
||||
|
||||
local lua_cmd = string.format(
|
||||
[[local start, n = %d, -1
|
||||
vim.loop.gettimeofday = function()
|
||||
@ -54,6 +53,10 @@ local mock_gettimeofday = function()
|
||||
child.lua(lua_cmd)
|
||||
end
|
||||
|
||||
-- Time constants
|
||||
local default_duration_last = 1000
|
||||
local small_time = helpers.get_time_const(10)
|
||||
|
||||
-- Output test set ============================================================
|
||||
local T = new_set({
|
||||
hooks = {
|
||||
@ -137,6 +140,11 @@ T['setup()']['validates `config` argument'] = function()
|
||||
expect_config_error({ window = { winblend = 'a' } }, 'window.winblend', 'number')
|
||||
end
|
||||
|
||||
T['setup()']['ensures colors'] = function()
|
||||
child.cmd('colorscheme default')
|
||||
expect.match(child.cmd_capture('hi MiniNotifyBorder'), 'links to FloatBorder')
|
||||
end
|
||||
|
||||
T['make_notify()'] = new_set()
|
||||
|
||||
local notify = forward_lua('vim.notify')
|
||||
@ -145,14 +153,16 @@ T['make_notify()']['works'] = function()
|
||||
child.set_size(10, 45)
|
||||
mock_gettimeofday()
|
||||
|
||||
local test_duration = 5 * small_time
|
||||
child.lua('_G.dur = ' .. test_duration)
|
||||
child.lua([[
|
||||
local level_opts = {
|
||||
ERROR = { duration = 300 },
|
||||
WARN = { duration = 250 },
|
||||
INFO = { duration = 200 },
|
||||
DEBUG = { duration = 150 },
|
||||
TRACE = { duration = 100 },
|
||||
OFF = { duration = 50 },
|
||||
ERROR = { duration = 6 * _G.dur },
|
||||
WARN = { duration = 5 * _G.dur },
|
||||
INFO = { duration = 4 * _G.dur },
|
||||
DEBUG = { duration = 3 * _G.dur },
|
||||
TRACE = { duration = 2 * _G.dur },
|
||||
OFF = { duration = 1 * _G.dur },
|
||||
}
|
||||
vim.notify = MiniNotify.make_notify(level_opts)
|
||||
]])
|
||||
@ -190,17 +200,17 @@ T['make_notify()']['works'] = function()
|
||||
|
||||
-- Should make notifications disappear after configured duration
|
||||
validate_active({ 'error', 'warn', 'info', 'debug', 'trace', 'off' })
|
||||
sleep(50 + 10)
|
||||
sleep(test_duration + small_time)
|
||||
validate_active({ 'error', 'warn', 'info', 'debug', 'trace' })
|
||||
sleep(50)
|
||||
sleep(test_duration)
|
||||
validate_active({ 'error', 'warn', 'info', 'debug' })
|
||||
sleep(50)
|
||||
sleep(test_duration)
|
||||
validate_active({ 'error', 'warn', 'info' })
|
||||
sleep(50)
|
||||
sleep(test_duration)
|
||||
validate_active({ 'error', 'warn' })
|
||||
sleep(50)
|
||||
sleep(test_duration)
|
||||
validate_active({ 'error' })
|
||||
sleep(50)
|
||||
sleep(test_duration)
|
||||
validate_active({})
|
||||
end
|
||||
|
||||
@ -248,12 +258,13 @@ T['make_notify()']['validates arguments'] = function()
|
||||
end
|
||||
|
||||
T['make_notify()']['has output working in `libuv` callbacks'] = function()
|
||||
child.lua('_G.dur = ' .. small_time)
|
||||
child.lua([[
|
||||
vim.notify = MiniNotify.make_notify()
|
||||
local timer = vim.loop.new_timer()
|
||||
timer:start(1, 0, function() vim.notify('Hello', vim.log.levels.INFO) end)
|
||||
timer:start(_G.dur, 0, function() vim.notify('Hello', vim.log.levels.INFO) end)
|
||||
]])
|
||||
sleep(1 + 1)
|
||||
sleep(small_time + small_time)
|
||||
eq(child.cmd_capture('messages'), '')
|
||||
eq(get_all()[1].msg, 'Hello')
|
||||
end
|
||||
@ -474,6 +485,7 @@ T['clear()']['affects only active notifications'] = function()
|
||||
eq(type(ts_remove_1), 'number')
|
||||
eq(get(id_2).ts_remove, nil)
|
||||
|
||||
sleep(small_time)
|
||||
clear()
|
||||
eq(get(id_1).ts_remove, ts_remove_1)
|
||||
local ts_remove_2 = get(id_2).ts_remove
|
||||
@ -971,9 +983,9 @@ T['LSP progress']['works'] = function()
|
||||
child.expect_screenshot()
|
||||
|
||||
-- Should wait some time and then hide notifications
|
||||
sleep(child.lua_get('MiniNotify.config.lsp_progress.duration_last') - 10)
|
||||
sleep(default_duration_last - small_time)
|
||||
child.expect_screenshot()
|
||||
sleep(10 + 10)
|
||||
sleep(small_time + small_time)
|
||||
child.expect_screenshot()
|
||||
|
||||
-- Should update single notification (and not remove/add new ones)
|
||||
@ -1033,12 +1045,13 @@ T['LSP progress']['respects `lsp_progress.duration_last`'] = function()
|
||||
result.value.kind, result.value.message, result.value.percentage = 'report', '1/1', 100
|
||||
call_handler(result, ctx)
|
||||
|
||||
child.lua('MiniNotify.config.lsp_progress.duration_last = 50')
|
||||
local new_duration_last = 6 * small_time
|
||||
child.lua('MiniNotify.config.lsp_progress.duration_last = ' .. new_duration_last)
|
||||
result.value.kind, result.value.message, result.value.percentage = 'end', 'done', nil
|
||||
call_handler(result, ctx)
|
||||
sleep(50 - 10)
|
||||
sleep(new_duration_last - 2 * small_time)
|
||||
child.expect_screenshot()
|
||||
sleep(10 + 10)
|
||||
sleep(2 * small_time + small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
|
||||
@ -57,6 +57,9 @@ T['setup()']['creates side effects'] = function()
|
||||
-- Global variable
|
||||
eq(child.lua_get('type(_G.MiniOperators)'), 'table')
|
||||
|
||||
-- Autocommand group
|
||||
eq(child.fn.exists('#MiniOperators'), 1)
|
||||
|
||||
-- Highlight groups
|
||||
child.cmd('hi clear')
|
||||
load_module()
|
||||
@ -121,6 +124,11 @@ T['setup()']['validates `config` argument'] = function()
|
||||
expect_config_error({ sort = { func = 'a' } }, 'sort.func', 'function')
|
||||
end
|
||||
|
||||
T['setup()']['ensures colors'] = function()
|
||||
child.cmd('colorscheme default')
|
||||
expect.match(child.cmd_capture('hi MiniOperatorsExchangeFrom'), 'links to IncSearch')
|
||||
end
|
||||
|
||||
T['setup()']['removes built-in LSP mappings'] = function()
|
||||
eq(child.fn.maparg('gra'), '')
|
||||
eq(child.fn.maparg('grn'), '')
|
||||
@ -441,9 +449,43 @@ T['Evaluate']['works in Visual mode'] = function()
|
||||
validate_edit({ '1 + 1', '1 + 2' }, { 1, 0 }, { '<C-v>j$', 'g=' }, { '2', '3' }, { 1, 0 })
|
||||
end
|
||||
|
||||
T['Evaluate']['works blockwise in Visual mode with `virtualedit=block`'] = function()
|
||||
T['Evaluate']['works with different `virtualedit`'] = function()
|
||||
local validate = function()
|
||||
-- Charwise
|
||||
validate_edit1d('1+1=x', 0, { 'g=', '3l' }, '2=x', 0)
|
||||
validate_edit1d('x=1+1=x', 2, { 'g=', '3l' }, 'x=2=x', 2)
|
||||
validate_edit1d('x=1+1', 2, { 'g=', '3l' }, 'x=2', 2)
|
||||
|
||||
validate_edit1d('1+1=x', 0, { 'v2l', 'g=' }, '2=x', 0)
|
||||
validate_edit1d('x=1+1=x', 2, { 'v2l', 'g=' }, 'x=2=x', 2)
|
||||
validate_edit1d('x=1+1', 2, { 'v2l', 'g=' }, 'x=2', 2)
|
||||
|
||||
-- Linewise
|
||||
validate_edit({ '0+1', '0+2', '0+3' }, { 1, 0 }, { 'g==' }, { '1', '0+2', '0+3' }, { 1, 0 })
|
||||
validate_edit({ '0+1', '0+2', '0+3' }, { 2, 0 }, { 'g==' }, { '0+1', '2', '0+3' }, { 2, 0 })
|
||||
validate_edit({ '0+1', '0+2', '0+3' }, { 3, 0 }, { 'g==' }, { '0+1', '0+2', '3' }, { 3, 0 })
|
||||
|
||||
validate_edit({ '0+1', '0+2', '0+3' }, { 1, 0 }, { 'V', 'g=' }, { '1', '0+2', '0+3' }, { 1, 0 })
|
||||
validate_edit({ '0+1', '0+2', '0+3' }, { 2, 0 }, { 'V', 'g=' }, { '0+1', '2', '0+3' }, { 2, 0 })
|
||||
validate_edit({ '0+1', '0+2', '0+3' }, { 3, 0 }, { 'V', 'g=' }, { '0+1', '0+2', '3' }, { 3, 0 })
|
||||
|
||||
-- Blockwise
|
||||
child.lua([[vim.keymap.set('o', 'iL', function() vim.cmd('normal! \22jll') end)]])
|
||||
validate_edit({ '1+1=x', '1+2=y' }, { 1, 0 }, { 'g=', 'iL' }, { '2 =x', '3 =y' }, { 1, 0 })
|
||||
validate_edit({ 'x=1+1=x', 'y=1+2=y' }, { 1, 2 }, { 'g=', 'iL' }, { 'x=2 =x', 'y=3 =y' }, { 1, 2 })
|
||||
validate_edit({ 'x=1+1', 'y=1+2' }, { 1, 2 }, { 'g=', 'iL' }, { 'x=2', 'y=3' }, { 1, 2 })
|
||||
|
||||
validate_edit({ '1+1=x', '1+2=y' }, { 1, 0 }, { '<C-v>jll', 'g=' }, { '2 =x', '3 =y' }, { 1, 0 })
|
||||
validate_edit({ 'x=1+1=x', 'y=1+2=y' }, { 1, 2 }, { '<C-v>jll', 'g=' }, { 'x=2 =x', 'y=3 =y' }, { 1, 2 })
|
||||
validate_edit({ 'x=1+1', 'y=1+2' }, { 1, 2 }, { '<C-v>jll', 'g=' }, { 'x=2', 'y=3' }, { 1, 2 })
|
||||
end
|
||||
|
||||
child.o.virtualedit = 'all'
|
||||
validate()
|
||||
child.o.virtualedit = 'onemore'
|
||||
validate()
|
||||
child.o.virtualedit = 'block'
|
||||
validate_edit({ 'x=1+1=x', 'y=1+2=y' }, { 1, 2 }, { '<C-v>j2l', 'g=' }, { 'x=2 =x', 'y=3 =y' }, { 1, 2 })
|
||||
validate()
|
||||
end
|
||||
|
||||
T['Evaluate']['respects `config.evaluate.func`'] = function()
|
||||
@ -765,9 +807,44 @@ T['Exchange']['works in Visual mode'] = function()
|
||||
validate_edit({ 'ab', 'cd' }, { 1, 1 }, { '<C-v>jgx', 'h', '<C-v>jgx' }, { 'ba', 'dc' }, { 1, 0 })
|
||||
end
|
||||
|
||||
T['Exchange']['works blockwise in Visual mode with `virtualedit=block`'] = function()
|
||||
T['Exchange']['works with different `virtualedit`'] = function()
|
||||
local validate = function()
|
||||
-- Charwise
|
||||
validate_edit1d('aa bb cc', 3, { 'gx', 'iw', 'b', 'gx', 'iw' }, 'bb aa cc', 0)
|
||||
validate_edit1d('aa bb cc', 0, { 'gx', 'iw', 'w', 'gx', 'iw' }, 'bb aa cc', 3)
|
||||
validate_edit1d('aa bb cc', 0, { 'gx', 'iw', '2w', 'gx', 'iw' }, 'cc bb aa', 6)
|
||||
|
||||
validate_edit1d('aa bb cc', 3, { 'viw', 'gx', '2b', 'viw', 'gx' }, 'bb aa cc', 0)
|
||||
validate_edit1d('aa bb cc', 0, { 'viw', 'gx', 'w', 'viw', 'gx' }, 'bb aa cc', 3)
|
||||
validate_edit1d('aa bb cc', 0, { 'viw', 'gx', '2w', 'viw', 'gx' }, 'cc bb aa', 6)
|
||||
|
||||
-- Linewise
|
||||
validate_edit({ 'aa', 'bb', 'cc' }, { 1, 0 }, { 'gxx', 'j', 'gxx' }, { 'bb', 'aa', 'cc' }, { 2, 0 })
|
||||
validate_edit({ 'aa', 'bb', 'cc' }, { 2, 0 }, { 'gxx', 'j', 'gxx' }, { 'aa', 'cc', 'bb' }, { 3, 0 })
|
||||
validate_edit({ 'aa', 'bb', 'cc' }, { 3, 0 }, { 'gxx', 'k', 'gxx' }, { 'aa', 'cc', 'bb' }, { 2, 0 })
|
||||
|
||||
validate_edit({ 'aa', 'bb', 'cc' }, { 1, 0 }, { 'V', 'gx', 'j', 'V', 'gx' }, { 'bb', 'aa', 'cc' }, { 2, 0 })
|
||||
validate_edit({ 'aa', 'bb', 'cc' }, { 2, 0 }, { 'V', 'gx', 'j', 'V', 'gx' }, { 'aa', 'cc', 'bb' }, { 3, 0 })
|
||||
validate_edit({ 'aa', 'bb', 'cc' }, { 3, 0 }, { 'V', 'gx', 'k', 'V', 'gx' }, { 'aa', 'cc', 'bb' }, { 2, 0 })
|
||||
|
||||
-- Blockwise
|
||||
if child.fn.has('nvim-0.9') == 0 then MiniTest.skip('Blockwise selection has core issues on Neovim<0.9.') end
|
||||
child.lua([[vim.keymap.set('o', 'ie', function() vim.cmd('normal! \22j') end)]])
|
||||
validate_edit({ 'abc', 'def' }, { 1, 0 }, { 'gx', 'ie', 'l', 'gx', 'ie' }, { 'bac', 'edf' }, { 1, 1 })
|
||||
validate_edit({ 'abc', 'def' }, { 1, 1 }, { 'gx', 'ie', 'l', 'gx', 'ie' }, { 'acb', 'dfe' }, { 1, 2 })
|
||||
validate_edit({ 'abc', 'def' }, { 1, 2 }, { 'gx', 'ie', 'h', 'gx', 'ie' }, { 'acb', 'dfe' }, { 1, 1 })
|
||||
|
||||
validate_edit({ 'abc', 'def' }, { 1, 0 }, { '<C-v>jgx', 'l', '<C-v>jgx' }, { 'bac', 'edf' }, { 1, 1 })
|
||||
validate_edit({ 'abc', 'def' }, { 1, 1 }, { '<C-v>jgx', 'l', '<C-v>jgx' }, { 'acb', 'dfe' }, { 1, 2 })
|
||||
validate_edit({ 'abc', 'def' }, { 1, 2 }, { '<C-v>jgx', 'h', '<C-v>jgx' }, { 'acb', 'dfe' }, { 1, 1 })
|
||||
end
|
||||
|
||||
child.o.virtualedit = 'all'
|
||||
validate()
|
||||
child.o.virtualedit = 'onemore'
|
||||
validate()
|
||||
child.o.virtualedit = 'block'
|
||||
validate_edit({ 'ab', 'cd' }, { 1, 0 }, { '<C-v>jgx', 'l', '<C-v>jgx' }, { 'ba', 'dc' }, { 1, 1 })
|
||||
validate()
|
||||
end
|
||||
|
||||
T['Exchange']['works when regions are made in different modes'] = function()
|
||||
@ -1270,10 +1347,44 @@ T['Multiply']['works with `[count]` in Visual mode'] = function()
|
||||
validate_edit(lines, { 2, 1 }, { '<C-v>kh', '2gm' }, ref_lines, ref_cursor)
|
||||
end
|
||||
|
||||
T['Multiply']['works blockwise in Visual mode with `virtualedit=block`'] = function()
|
||||
if child.fn.has('nvim-0.9') == 0 then MiniTest.skip('Blockwise selection has core issues on Neovim<0.9.') end
|
||||
T['Multiply']['works with different `virtualedit`'] = function()
|
||||
local validate = function()
|
||||
-- Charwise
|
||||
validate_edit1d('aa bb cc', 0, { 'gm', 'iw' }, 'aaaa bb cc', 2)
|
||||
validate_edit1d('aa bb cc', 3, { 'gm', 'iw' }, 'aa bbbb cc', 5)
|
||||
validate_edit1d('aa bb cc', 6, { 'gm', 'iw' }, 'aa bb cccc', 8)
|
||||
|
||||
validate_edit1d('aa bb cc', 0, { 'viw', 'gm' }, 'aaaa bb cc', 2)
|
||||
validate_edit1d('aa bb cc', 3, { 'viw', 'gm' }, 'aa bbbb cc', 5)
|
||||
validate_edit1d('aa bb cc', 6, { 'viw', 'gm' }, 'aa bb cccc', 8)
|
||||
|
||||
-- Linewise
|
||||
validate_edit({ 'aa', 'bb', 'cc' }, { 1, 0 }, { 'gmm' }, { 'aa', 'aa', 'bb', 'cc' }, { 2, 0 })
|
||||
validate_edit({ 'aa', 'bb', 'cc' }, { 2, 0 }, { 'gmm' }, { 'aa', 'bb', 'bb', 'cc' }, { 3, 0 })
|
||||
validate_edit({ 'aa', 'bb', 'cc' }, { 3, 0 }, { 'gmm' }, { 'aa', 'bb', 'cc', 'cc' }, { 4, 0 })
|
||||
|
||||
validate_edit({ 'aa', 'bb', 'cc' }, { 1, 0 }, { 'V', 'gm' }, { 'aa', 'aa', 'bb', 'cc' }, { 2, 0 })
|
||||
validate_edit({ 'aa', 'bb', 'cc' }, { 2, 0 }, { 'V', 'gm' }, { 'aa', 'bb', 'bb', 'cc' }, { 3, 0 })
|
||||
validate_edit({ 'aa', 'bb', 'cc' }, { 3, 0 }, { 'V', 'gm' }, { 'aa', 'bb', 'cc', 'cc' }, { 4, 0 })
|
||||
|
||||
-- Blockwise
|
||||
if child.fn.has('nvim-0.9') == 0 then MiniTest.skip('Blockwise selection has core issues on Neovim<0.9.') end
|
||||
child.lua([[vim.keymap.set('o', 'ie', function() vim.cmd('normal! \22j') end)]])
|
||||
validate_edit({ 'abc', 'def' }, { 1, 0 }, { 'gm', 'ie' }, { 'aabc', 'ddef' }, { 1, 1 })
|
||||
validate_edit({ 'abc', 'def' }, { 1, 1 }, { 'gm', 'ie' }, { 'abbc', 'deef' }, { 1, 2 })
|
||||
validate_edit({ 'abc', 'def' }, { 1, 2 }, { 'gm', 'ie' }, { 'abcc', 'deff' }, { 1, 3 })
|
||||
|
||||
validate_edit({ 'abc', 'def' }, { 1, 0 }, { '<C-v>j', 'gm' }, { 'aabc', 'ddef' }, { 1, 1 })
|
||||
validate_edit({ 'abc', 'def' }, { 1, 1 }, { '<C-v>j', 'gm' }, { 'abbc', 'deef' }, { 1, 2 })
|
||||
validate_edit({ 'abc', 'def' }, { 1, 2 }, { '<C-v>j', 'gm' }, { 'abcc', 'deff' }, { 1, 3 })
|
||||
end
|
||||
|
||||
child.o.virtualedit = 'all'
|
||||
validate()
|
||||
child.o.virtualedit = 'onemore'
|
||||
validate()
|
||||
child.o.virtualedit = 'block'
|
||||
validate_edit({ 'xab rs', 'xcd uv' }, { 1, 1 }, { '<C-v>jl', 'gm' }, { 'xabab rs', 'xcdcd uv' }, { 1, 3 })
|
||||
validate()
|
||||
end
|
||||
|
||||
T['Multiply']['works with multibyte characters'] = function()
|
||||
@ -1629,9 +1740,43 @@ T['Replace']['works in Visual mode'] = function()
|
||||
validate_edit({ 'a b', 'a b' }, { 1, 0 }, { 'y<C-v>j', 'w', '<C-v>j', 'gr' }, { 'a a', 'a a' }, { 1, 2 })
|
||||
end
|
||||
|
||||
T['Replace']['works blockwise in Visual mode with `virtualedit=block`'] = function()
|
||||
T['Replace']['works with different `virtualedit`'] = function()
|
||||
local validate = function()
|
||||
-- Charwise
|
||||
validate_edit1d('aa bb cc', 3, { 'yiw', 'b', 'gr', 'iw' }, 'bb bb cc', 0)
|
||||
validate_edit1d('aa bb cc', 0, { 'yiw', 'w', 'gr', 'iw' }, 'aa aa cc', 3)
|
||||
validate_edit1d('aa bb cc', 0, { 'yiw', '2w', 'gr', 'iw' }, 'aa bb aa', 6)
|
||||
|
||||
validate_edit1d('aa bb cc', 3, { 'yiw', 'b', 'viw', 'gr' }, 'bb bb cc', 0)
|
||||
validate_edit1d('aa bb cc', 0, { 'yiw', 'w', 'viw', 'gr' }, 'aa aa cc', 3)
|
||||
validate_edit1d('aa bb cc', 0, { 'yiw', '2w', 'viw', 'gr' }, 'aa bb aa', 6)
|
||||
|
||||
-- Linewise
|
||||
validate_edit({ 'aa', 'bb', 'cc' }, { 1, 0 }, { 'yy', 'j', 'grr' }, { 'aa', 'aa', 'cc' }, { 2, 0 })
|
||||
validate_edit({ 'aa', 'bb', 'cc' }, { 2, 0 }, { 'yy', 'j', 'grr' }, { 'aa', 'bb', 'bb' }, { 3, 0 })
|
||||
validate_edit({ 'aa', 'bb', 'cc' }, { 3, 0 }, { 'yy', 'k', 'grr' }, { 'aa', 'cc', 'cc' }, { 2, 0 })
|
||||
|
||||
validate_edit({ 'aa', 'bb', 'cc' }, { 1, 0 }, { 'yy', 'j', 'V', 'gr' }, { 'aa', 'aa', 'cc' }, { 2, 0 })
|
||||
validate_edit({ 'aa', 'bb', 'cc' }, { 2, 0 }, { 'yy', 'j', 'V', 'gr' }, { 'aa', 'bb', 'bb' }, { 3, 0 })
|
||||
validate_edit({ 'aa', 'bb', 'cc' }, { 3, 0 }, { 'yy', 'k', 'V', 'gr' }, { 'aa', 'cc', 'cc' }, { 2, 0 })
|
||||
|
||||
-- Blockwise
|
||||
child.lua([[vim.keymap.set('o', 'ie', function() vim.cmd('normal! \22j') end)]])
|
||||
validate_edit({ 'abc', 'def' }, { 1, 0 }, { 'y', 'ie', 'l', 'gr', 'ie' }, { 'aac', 'ddf' }, { 1, 1 })
|
||||
validate_edit({ 'abc', 'def' }, { 1, 1 }, { 'y', 'ie', 'l', 'gr', 'ie' }, { 'abb', 'dee' }, { 1, 2 })
|
||||
validate_edit({ 'abc', 'def' }, { 1, 2 }, { 'y', 'ie', 'h', 'gr', 'ie' }, { 'acc', 'dff' }, { 1, 1 })
|
||||
|
||||
validate_edit({ 'abc', 'def' }, { 1, 0 }, { 'y', 'ie', 'l', '<C-v>j', 'gr' }, { 'aac', 'ddf' }, { 1, 1 })
|
||||
validate_edit({ 'abc', 'def' }, { 1, 1 }, { 'y', 'ie', 'l', '<C-v>j', 'gr' }, { 'abb', 'dee' }, { 1, 2 })
|
||||
validate_edit({ 'abc', 'def' }, { 1, 2 }, { 'y', 'ie', 'h', '<C-v>j', 'gr' }, { 'acc', 'dff' }, { 1, 1 })
|
||||
end
|
||||
|
||||
child.o.virtualedit = 'all'
|
||||
validate()
|
||||
child.o.virtualedit = 'onemore'
|
||||
validate()
|
||||
child.o.virtualedit = 'block'
|
||||
validate_edit({ 'xab', 'xcd' }, { 1, 0 }, { 'y<C-v>j', 'l', '<C-v>j', 'gr' }, { 'xxb', 'xxd' }, { 1, 1 })
|
||||
validate()
|
||||
end
|
||||
|
||||
T['Replace']['correctly reindents linewise in Visual mode'] = function()
|
||||
@ -1924,9 +2069,44 @@ T['Sort']['works in Visual mode'] = function()
|
||||
validate_edit({ 'cxb', 'bxa', 'axc' }, { 1, 1 }, { '<C-v>jl', 'gs' }, { 'cxa', 'bxb', 'axc' }, { 1, 1 })
|
||||
end
|
||||
|
||||
T['Sort']['works blockwise in Visual mode with `virtualedit=block`'] = function()
|
||||
T['Sort']['works with different `virtualedit`'] = function()
|
||||
local validate = function()
|
||||
-- Charwise
|
||||
validate_edit1d('cc bb aa', 0, { 'gs', '2e' }, 'bb cc aa', 0)
|
||||
validate_edit1d('cc bb aa', 3, { 'gs', '2e' }, 'cc aa bb', 3)
|
||||
validate_edit1d('cc bb aa', 0, { 'gs', '3e' }, 'aa bb cc', 0)
|
||||
|
||||
validate_edit1d('cc bb aa', 0, { 'v2e', 'gs' }, 'bb cc aa', 0)
|
||||
validate_edit1d('cc bb aa', 3, { 'v2e', 'gs' }, 'cc aa bb', 3)
|
||||
validate_edit1d('cc bb aa', 0, { 'v3e', 'gs' }, 'aa bb cc', 0)
|
||||
|
||||
-- Linewise
|
||||
validate_edit({ 'cc', 'bb', 'aa' }, { 1, 0 }, { 'gs', 'j' }, { 'bb', 'cc', 'aa' }, { 1, 0 })
|
||||
validate_edit({ 'cc', 'bb', 'aa' }, { 2, 0 }, { 'gs', 'j' }, { 'cc', 'aa', 'bb' }, { 2, 0 })
|
||||
validate_edit({ 'cc', 'bb', 'aa' }, { 1, 0 }, { 'gs', '2j' }, { 'aa', 'bb', 'cc' }, { 1, 0 })
|
||||
|
||||
validate_edit({ 'cc', 'bb', 'aa' }, { 1, 0 }, { 'Vj', 'gs' }, { 'bb', 'cc', 'aa' }, { 1, 0 })
|
||||
validate_edit({ 'cc', 'bb', 'aa' }, { 2, 0 }, { 'Vj', 'gs' }, { 'cc', 'aa', 'bb' }, { 2, 0 })
|
||||
validate_edit({ 'cc', 'bb', 'aa' }, { 1, 0 }, { 'V2j', 'gs' }, { 'aa', 'bb', 'cc' }, { 1, 0 })
|
||||
|
||||
-- Blockwise
|
||||
if child.fn.has('nvim-0.9') == 0 then MiniTest.skip('Blockwise selection has core issues on Neovim<0.9.') end
|
||||
child.lua([[vim.keymap.set('o', 'iE', function() vim.cmd('normal! \22jj') end)]])
|
||||
validate_edit({ 'cba', 'bac', 'acb' }, { 1, 0 }, { 'gs', 'iE' }, { 'aba', 'bac', 'ccb' }, { 1, 0 })
|
||||
validate_edit({ 'cba', 'bac', 'acb' }, { 1, 1 }, { 'gs', 'iE' }, { 'caa', 'bbc', 'acb' }, { 1, 1 })
|
||||
validate_edit({ 'cba', 'bac', 'acb' }, { 1, 2 }, { 'gs', 'iE' }, { 'cba', 'bab', 'acc' }, { 1, 2 })
|
||||
|
||||
validate_edit({ 'cba', 'bac', 'acb' }, { 1, 0 }, { '<C-v>jj', 'gs' }, { 'aba', 'bac', 'ccb' }, { 1, 0 })
|
||||
validate_edit({ 'cba', 'bac', 'acb' }, { 1, 1 }, { '<C-v>jj', 'gs' }, { 'caa', 'bbc', 'acb' }, { 1, 1 })
|
||||
validate_edit({ 'cba', 'bac', 'acb' }, { 1, 2 }, { '<C-v>jj', 'gs' }, { 'cba', 'bab', 'acc' }, { 1, 2 })
|
||||
end
|
||||
|
||||
child.o.virtualedit = 'all'
|
||||
validate()
|
||||
child.o.virtualedit = 'onemore'
|
||||
validate()
|
||||
child.o.virtualedit = 'block'
|
||||
validate_edit({ 'cbx', 'bax', 'acx' }, { 1, 1 }, { '<C-v>2j', 'gs' }, { 'cax', 'bbx', 'acx' }, { 1, 1 })
|
||||
validate()
|
||||
end
|
||||
|
||||
T['Sort']['respects `config.sort.func`'] = function()
|
||||
|
||||
@ -14,8 +14,7 @@ local get_cursor = function(...) return child.get_cursor(...) end
|
||||
local set_lines = function(...) return child.set_lines(...) end
|
||||
local get_lines = function(...) return child.get_lines(...) end
|
||||
local type_keys = function(...) return child.type_keys(...) end
|
||||
local poke_eventloop = function() child.api.nvim_eval('1') end
|
||||
local sleep = function(ms) vim.loop.sleep(ms); poke_eventloop() end
|
||||
local sleep = function(ms) helpers.sleep(ms, child) end
|
||||
--stylua: ignore end
|
||||
|
||||
-- Make helpers
|
||||
@ -24,6 +23,9 @@ local get_term_channel = function()
|
||||
return term_chans[1]['id']
|
||||
end
|
||||
|
||||
-- Time constants
|
||||
local term_mode_wait = helpers.get_time_const(50)
|
||||
|
||||
--- Make simple test on empty entity
|
||||
---@private
|
||||
local validate_action = function(mode, test)
|
||||
@ -53,10 +55,13 @@ local validate_action = function(mode, test)
|
||||
-- Cleanup
|
||||
type_keys('<Esc>')
|
||||
elseif mode == 't' then
|
||||
helpers.skip_on_windows('Terminal emulator testing is not robust/easy on Windows')
|
||||
helpers.skip_on_macos('Terminal emulator testing is not robust/easy on MacOS')
|
||||
|
||||
-- Setup
|
||||
child.cmd('terminal! bash --noprofile --norc')
|
||||
-- Wait for terminal to get active
|
||||
sleep(50)
|
||||
sleep(term_mode_wait)
|
||||
child.cmd('startinsert')
|
||||
|
||||
-- Test
|
||||
@ -114,15 +119,14 @@ local validate_close = function(mode, key, pair)
|
||||
eq(child.fn.getcmdpos(), 3)
|
||||
end,
|
||||
t = function()
|
||||
-- Need to wait after each keystroke to allow shell to process it
|
||||
local wait = 50
|
||||
local term_channel = get_term_channel()
|
||||
|
||||
-- Jumps over right hand side of `pair` if it is next
|
||||
child.fn.chansend(term_channel, pair)
|
||||
sleep(wait)
|
||||
type_keys(wait, '<Left>')
|
||||
type_keys(wait, key)
|
||||
-- Need to wait after each keystroke to allow shell to process it
|
||||
sleep(term_mode_wait)
|
||||
type_keys(term_mode_wait, '<Left>')
|
||||
type_keys(term_mode_wait, key)
|
||||
|
||||
local pair_pattern = vim.pesc(pair) .. '$'
|
||||
expect.match(get_lines()[1], pair_pattern)
|
||||
@ -149,14 +153,13 @@ local validate_bs = function(mode, pair)
|
||||
eq(child.fn.getcmdpos(), 1)
|
||||
end,
|
||||
t = function()
|
||||
-- Need to wait after each keystroke to allow shell to process it
|
||||
local wait = 50
|
||||
local term_channel = get_term_channel()
|
||||
|
||||
child.fn.chansend(term_channel, pair)
|
||||
sleep(wait)
|
||||
type_keys(wait, '<Left>')
|
||||
type_keys(wait, '<BS>')
|
||||
-- Need to wait after each keystroke to allow shell to process it
|
||||
sleep(term_mode_wait)
|
||||
type_keys(term_mode_wait, '<Left>')
|
||||
type_keys(term_mode_wait, '<BS>')
|
||||
|
||||
local pair_pattern = vim.pesc(pair) .. '$'
|
||||
expect.no_match(get_lines()[1], pair_pattern)
|
||||
|
||||
@ -11,8 +11,7 @@ local unload_module = function() child.mini_unload('pick') end
|
||||
local set_cursor = function(...) return child.set_cursor(...) end
|
||||
local get_cursor = function(...) return child.get_cursor(...) end
|
||||
local type_keys = function(...) return child.type_keys(...) end
|
||||
local poke_eventloop = function() child.api.nvim_eval('1') end
|
||||
local sleep = function(ms) vim.loop.sleep(ms); poke_eventloop() end
|
||||
local sleep = function(ms) helpers.sleep(ms, child) end
|
||||
--stylua: ignore end
|
||||
|
||||
-- Tweak `expect_screenshot()` to test only on Neovim>=0.10 (as it has floating
|
||||
@ -34,10 +33,7 @@ local real_files_dir = 'tests/dir-pick/real-files'
|
||||
|
||||
local join_path = function(...) return table.concat({ ... }, '/') end
|
||||
|
||||
local full_path = function(x)
|
||||
local res = vim.fn.fnamemodify(x, ':p'):gsub('/$', '')
|
||||
return res
|
||||
end
|
||||
local full_path = function(x) return (vim.fn.fnamemodify(x, ':p'):gsub('[\\/]$', '')) end
|
||||
|
||||
local real_file = function(basename) return join_path(real_files_dir, basename) end
|
||||
|
||||
@ -90,7 +86,7 @@ end
|
||||
local validate_buf_name = function(buf_id, name)
|
||||
buf_id = buf_id or child.api.nvim_get_current_buf()
|
||||
name = name ~= '' and full_path(name) or ''
|
||||
name = name:gsub('/+$', '')
|
||||
name = name:gsub('[\\/]+$', '')
|
||||
eq(child.api.nvim_buf_get_name(buf_id), name)
|
||||
end
|
||||
|
||||
@ -205,6 +201,12 @@ for i = 1, 1000000 do
|
||||
many_items[3 * i] = 'bb'
|
||||
end
|
||||
|
||||
-- Time constants
|
||||
local default_busy_delay = 50
|
||||
local track_lost_focus_delay = 1000
|
||||
local small_time = helpers.get_time_const(10)
|
||||
local micro_time = 1
|
||||
|
||||
-- Output test set ============================================================
|
||||
local T = new_set({
|
||||
hooks = {
|
||||
@ -212,9 +214,9 @@ local T = new_set({
|
||||
child.setup()
|
||||
|
||||
-- Make more comfortable screenshots
|
||||
child.set_size(15, 40)
|
||||
child.o.laststatus = 0
|
||||
child.o.ruler = false
|
||||
child.set_size(15, 40)
|
||||
|
||||
load_module()
|
||||
|
||||
@ -247,6 +249,7 @@ T['setup()']['creates side effects'] = function()
|
||||
validate_hl_group('MiniPickBorder', 'links to FloatBorder')
|
||||
validate_hl_group('MiniPickBorderBusy', 'links to DiagnosticFloatingWarn')
|
||||
validate_hl_group('MiniPickBorderText', 'links to FloatTitle')
|
||||
validate_hl_group('MiniPickCursor', 'nocombine.*blend=100')
|
||||
validate_hl_group('MiniPickIconDirectory', 'links to Directory')
|
||||
validate_hl_group('MiniPickIconFile', 'links to MiniPickNormal')
|
||||
validate_hl_group('MiniPickHeader', 'links to DiagnosticFloatingHint')
|
||||
@ -378,6 +381,11 @@ T['setup()']['validates `config` argument'] = function()
|
||||
expect_config_error({ window = { prompt_prefix = 1 } }, 'window.prompt_prefix', 'string')
|
||||
end
|
||||
|
||||
T['setup()']['ensures colors'] = function()
|
||||
child.cmd('colorscheme default')
|
||||
expect.match(child.cmd_capture('hi MiniPickBorder'), 'links to FloatBorder')
|
||||
end
|
||||
|
||||
-- This set mostly contains general function testing which doesn't fit into
|
||||
-- more specialized integration tests later
|
||||
T['start()'] = new_set()
|
||||
@ -472,7 +480,7 @@ T['start()']['tracks lost focus'] = function()
|
||||
child.expect_screenshot()
|
||||
type_keys('e')
|
||||
-- By default it checks inside a timer with 1 second period
|
||||
sleep(1000 + 50)
|
||||
sleep(track_lost_focus_delay + small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
@ -529,7 +537,7 @@ T['start()']['respects `source.items`'] = function()
|
||||
-- Callable setting items manually
|
||||
child.lua([[_G.items_callable_later = function() MiniPick.set_picker_items({ 'e', 'f' }) end]])
|
||||
child.lua_notify('MiniPick.start({ source = { items = _G.items_callable_later } })')
|
||||
poke_eventloop()
|
||||
child.poke_eventloop()
|
||||
child.expect_screenshot()
|
||||
stop()
|
||||
|
||||
@ -538,7 +546,7 @@ T['start()']['respects `source.items`'] = function()
|
||||
vim.schedule(function() MiniPick.set_picker_items({ 'g', 'h' }) end)
|
||||
end]])
|
||||
child.lua_notify('MiniPick.start({ source = { items = _G.items_callable_later } })')
|
||||
poke_eventloop()
|
||||
child.poke_eventloop()
|
||||
child.expect_screenshot()
|
||||
stop()
|
||||
end
|
||||
@ -680,7 +688,10 @@ T['start()']['respects `source.choose_marked`'] = function()
|
||||
end
|
||||
|
||||
T['start()']['respects `delay.async`'] = function()
|
||||
helpers.skip_if_slow()
|
||||
|
||||
child.set_size(15, 15)
|
||||
child.lua('_G.small_time = ' .. small_time)
|
||||
child.lua_notify([[
|
||||
_G.buf_id, _G.n = vim.api.nvim_get_current_buf(), 0
|
||||
local timer = vim.loop.new_timer()
|
||||
@ -688,7 +699,7 @@ T['start()']['respects `delay.async`'] = function()
|
||||
_G.n = _G.n + 1
|
||||
vim.fn.appendbufline(_G.buf_id, '$', { 'Line ' .. _G.n })
|
||||
end)
|
||||
timer:start(50, 50, f)
|
||||
timer:start(5 * _G.small_time, 5 * _G.small_time, f)
|
||||
]])
|
||||
local validate = function(n, lines)
|
||||
eq(child.lua_get('_G.n'), n)
|
||||
@ -696,19 +707,19 @@ T['start()']['respects `delay.async`'] = function()
|
||||
child.expect_screenshot({ redraw = false })
|
||||
end
|
||||
|
||||
child.lua_notify([[MiniPick.start({ source = { items = { 'a' } }, delay = { async = 80 } })]])
|
||||
child.lua_notify([[MiniPick.start({ source = { items = { 'a' } }, delay = { async = 8 * _G.small_time } })]])
|
||||
validate(0, { '' })
|
||||
|
||||
-- Callback should have already been executed, but not redraw
|
||||
sleep(50 + 5)
|
||||
sleep(5 * small_time + small_time)
|
||||
validate(1, { '', 'Line 1' })
|
||||
|
||||
-- No new callback should have been executed, but redraw should
|
||||
sleep(30)
|
||||
sleep(3 * small_time)
|
||||
validate(1, { '', 'Line 1' })
|
||||
|
||||
-- Test that redraw is done repeatedly
|
||||
sleep(80)
|
||||
sleep(8 * small_time)
|
||||
validate(3, { '', 'Line 1', 'Line 2', 'Line 3' })
|
||||
end
|
||||
|
||||
@ -719,11 +730,10 @@ T['start()']['respects `delay.busy`'] = function()
|
||||
expect.match(child.api.nvim_win_get_option(win_id, 'winhighlight'), ref_winhl)
|
||||
end
|
||||
|
||||
local new_busy_delay = math.floor(0.5 * child.lua_get('MiniPick.config.delay.busy'))
|
||||
child.lua_notify(string.format('MiniPick.start({ delay = { busy = %d } })', new_busy_delay))
|
||||
child.lua_notify(string.format('MiniPick.start({ delay = { busy = %d } })', 0.5 * default_busy_delay))
|
||||
|
||||
validate(false)
|
||||
sleep(new_busy_delay + 10)
|
||||
sleep(0.5 * default_busy_delay + small_time)
|
||||
validate(true)
|
||||
end
|
||||
|
||||
@ -842,7 +852,7 @@ T['start()']['stops currently active picker'] = function()
|
||||
start_with_items({ 'a', 'b', 'c' })
|
||||
eq(is_picker_active(), true)
|
||||
start_with_items({ 'd', 'e', 'f' })
|
||||
sleep(2)
|
||||
sleep(small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
@ -989,6 +999,8 @@ T['default_match()']['works with active picker'] = function()
|
||||
end
|
||||
|
||||
T['default_match()']['does not block query update'] = function()
|
||||
helpers.skip_if_slow()
|
||||
|
||||
child.lua([[
|
||||
_G.log = {}
|
||||
_G.default_match_wrapper = function(stritems, inds, query)
|
||||
@ -1000,8 +1012,8 @@ T['default_match()']['does not block query update'] = function()
|
||||
|
||||
-- Set many items and wait until it completely sets
|
||||
set_picker_items(many_items)
|
||||
for i = 1, 50 do
|
||||
sleep(100)
|
||||
for _ = 1, 500 do
|
||||
sleep(small_time)
|
||||
if child.lua_get([[type(MiniPick.get_picker_items()) == 'table']]) then break end
|
||||
end
|
||||
|
||||
@ -1012,12 +1024,13 @@ T['default_match()']['does not block query update'] = function()
|
||||
-- set of `match_inds` (which should be all inds as match is, hopefully,
|
||||
-- never finishes).
|
||||
type_keys('a')
|
||||
sleep(1)
|
||||
sleep(micro_time)
|
||||
type_keys('b')
|
||||
sleep(1)
|
||||
sleep(micro_time)
|
||||
type_keys('c')
|
||||
sleep(1)
|
||||
child.expect_screenshot()
|
||||
sleep(micro_time)
|
||||
eq(child.lua_get('#MiniPick.get_picker_matches()'), 0)
|
||||
eq(get_picker_state().is_busy, true)
|
||||
eq(child.lua_get('_G.log'), {
|
||||
{ n_match_inds = #many_items, query = {} },
|
||||
{ n_match_inds = #many_items, query = { 'a' } },
|
||||
@ -1274,13 +1287,27 @@ T['default_match()']['respects case'] = function()
|
||||
validate_match({ 'ab', 'aB', 'Ba', 'AB' }, { 'a', 'B' }, { 2 })
|
||||
end
|
||||
|
||||
T['default_match()']['respects `do_sync` argument'] = function()
|
||||
T['default_match()']['respects `opts.sync`'] = function()
|
||||
start_with_items({ 'aa', 'ab', 'bb' })
|
||||
-- Should process synchronously and return output even if picker is active
|
||||
eq(child.lua_get([[MiniPick.default_match({'xx', 'xy', 'yy'}, { 1, 2, 3 }, { 'y' }, true)]]), { 3, 2 })
|
||||
eq(child.lua_get([[MiniPick.default_match({'xx', 'xy', 'yy'}, { 1, 2, 3 }, { 'y' }, { sync = true })]]), { 3, 2 })
|
||||
eq(get_picker_matches().all, { 'aa', 'ab', 'bb' })
|
||||
end
|
||||
|
||||
T['default_match()']['respects `opts.preserve_order`'] = function()
|
||||
child.lua_notify([[
|
||||
local opts = { preserve_order = true }
|
||||
local match_nosort = function(stritems, inds, query)
|
||||
MiniPick.default_match(stritems, inds, query, opts)
|
||||
end
|
||||
MiniPick.start({ source = { items = { 'axay', 'b', 'aaxy', 'ccc', 'xaa' }, match = match_nosort } })
|
||||
]])
|
||||
type_keys('x')
|
||||
eq(get_picker_matches().all_inds, { 1, 3, 5 })
|
||||
type_keys('y')
|
||||
eq(get_picker_matches().all_inds, { 1, 3 })
|
||||
end
|
||||
|
||||
T['default_show()'] = new_set({ hooks = { pre_case = function() child.set_size(10, 20) end } })
|
||||
|
||||
local default_show = forward_lua('MiniPick.default_show')
|
||||
@ -1496,11 +1523,18 @@ T['default_preview()']['works for file path'] = function()
|
||||
real_file('c.gif'),
|
||||
}
|
||||
validate_preview(items)
|
||||
stop()
|
||||
|
||||
-- Should work for failed to read files
|
||||
child.lua('vim.loop.fs_open = function() return nil end')
|
||||
validate_preview({ real_file('Makefile') })
|
||||
end
|
||||
|
||||
T['default_preview()']['works for relative file path'] = function()
|
||||
local lua_cmd =
|
||||
string.format([[MiniPick.start({ source = { items = { 'a.lua' }, cwd = '%s' } })]], full_path(real_files_dir))
|
||||
local lua_cmd = string.format(
|
||||
[[MiniPick.start({ source = { items = { 'a.lua' }, cwd = %s } })]],
|
||||
vim.inspect(full_path(real_files_dir))
|
||||
)
|
||||
child.lua_notify(lua_cmd)
|
||||
type_keys('<Tab>')
|
||||
child.expect_screenshot()
|
||||
@ -1516,7 +1550,7 @@ T['default_preview()']['works for file path with tilde'] = function()
|
||||
end
|
||||
|
||||
T['default_preview()']['works for URI path'] = function()
|
||||
local items = { { text = real_file('LICENSE'), path = 'file:' .. full_path(real_file('LICENSE')) } }
|
||||
local items = { { text = real_file('LICENSE'), path = 'file:/' .. full_path(real_file('LICENSE')) } }
|
||||
validate_preview(items)
|
||||
end
|
||||
|
||||
@ -1723,7 +1757,8 @@ T['default_preview()']['respects `opts.line_position`'] = new_set({
|
||||
})
|
||||
|
||||
T['default_preview()']['respects `source.cwd`'] = function()
|
||||
local lua_cmd = string.format([[MiniPick.start({ source = { items = { 'b.txt' }, cwd = '%s' } })]], real_files_dir)
|
||||
local lua_cmd =
|
||||
string.format([[MiniPick.start({ source = { items = { 'b.txt' }, cwd = %s } })]], vim.inspect(real_files_dir))
|
||||
child.lua_notify(lua_cmd)
|
||||
type_keys('<Tab>')
|
||||
child.expect_screenshot()
|
||||
@ -1806,18 +1841,18 @@ end
|
||||
|
||||
T['default_choose()']['works for relative file path'] = function()
|
||||
local lua_cmd =
|
||||
string.format([[MiniPick.start({ source = { items = { 'a.lua' }, cwd = '%s' } })]], full_path(real_files_dir))
|
||||
string.format([[MiniPick.start({ source = { items = { 'a.lua' }, cwd = %s } })]], vim.inspect(real_files_dir))
|
||||
child.lua_notify(lua_cmd)
|
||||
type_keys('<CR>')
|
||||
validate_buf_name(0, real_file('a.lua'))
|
||||
|
||||
-- Should open with relative path to have better view in `:buffers`
|
||||
expect.match(child.cmd_capture('buffers'), '"' .. vim.pesc(real_files_dir))
|
||||
expect.match(child.cmd_capture('buffers'), '"tests[\\/]dir%-pick')
|
||||
end
|
||||
|
||||
T['default_choose()']['works for URI path'] = function()
|
||||
local path = full_path(real_file('LICENSE'))
|
||||
local item = { path = 'file:' .. path }
|
||||
local item = { path = 'file:/' .. path }
|
||||
local win_id = child.api.nvim_get_current_win()
|
||||
default_choose(item)
|
||||
|
||||
@ -2026,7 +2061,7 @@ end
|
||||
|
||||
T['default_choose()']['has print fallback'] = function()
|
||||
choose_item({ text = 'regular-table' })
|
||||
eq(child.cmd_capture('messages'), '\n{\n text = "regular-table"\n}')
|
||||
eq(child.cmd_capture('messages'), '{\n text = "regular-table"\n}')
|
||||
end
|
||||
|
||||
T['default_choose()']['does nothing for `nil` input'] = function()
|
||||
@ -2144,7 +2179,7 @@ T['default_choose_marked()']['creates quickfix list from file/buffer positions']
|
||||
{ text = 'buffer', bufnr = buf_id, lnum = 7, col = 8, end_lnum = 8 },
|
||||
|
||||
-- URI
|
||||
{ path = 'file:' .. full_path(path) },
|
||||
{ path = 'file:/' .. full_path(path) },
|
||||
}
|
||||
|
||||
start_with_items(items)
|
||||
@ -2425,7 +2460,7 @@ T['builtin.files()']['has fallback tool'] = function()
|
||||
validate_picker_option('source.cwd', full_path(cwd))
|
||||
|
||||
-- Sleep because fallback is async
|
||||
sleep(5)
|
||||
sleep(small_time)
|
||||
eq(get_picker_items(), { 'file', 'dir1/file1-1', 'dir1/file1-2', 'dir2/file2-1' })
|
||||
end
|
||||
|
||||
@ -2552,7 +2587,7 @@ T['builtin.grep()']['has fallback tool'] = new_set({ parametrize = { { 'default'
|
||||
validate_picker_option('source.cwd', full_path(cwd))
|
||||
|
||||
-- Sleep because fallback is async
|
||||
sleep(5)
|
||||
sleep(small_time)
|
||||
local ref_items = {
|
||||
'file\0003\0001\000aaa',
|
||||
'dir1/file1-1\0003\0001\000aaa',
|
||||
@ -2804,7 +2839,7 @@ T['builtin.help()']['has proper preview'] = function()
|
||||
|
||||
-- Shouldn't have side effects for search pattern and `v:hlsearch`
|
||||
child.api.nvim_buf_set_lines(0, 0, -1, false, { 'aa', 'bb', 'aa' })
|
||||
type_keys('/', 'aa', '<CR>')
|
||||
type_keys('/', 'aa', '<CR>', ':<Esc>')
|
||||
child.cmd('let v:hlsearch=0')
|
||||
|
||||
builtin_help()
|
||||
@ -2883,7 +2918,7 @@ T['builtin.help()']['works with `builtin.resume()`'] = function()
|
||||
builtin_help()
|
||||
set_picker_query({ ':help' })
|
||||
type_keys('<CR>')
|
||||
sleep(2)
|
||||
sleep(small_time)
|
||||
child.expect_screenshot()
|
||||
|
||||
child.cmd('close')
|
||||
@ -2891,7 +2926,7 @@ T['builtin.help()']['works with `builtin.resume()`'] = function()
|
||||
|
||||
child.lua_notify('MiniPick.builtin.resume()')
|
||||
type_keys('<CR>')
|
||||
sleep(2)
|
||||
sleep(small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
@ -2961,7 +2996,7 @@ T['builtin.cli()']['works'] = function()
|
||||
child.lua_notify([[_G.cli_item = MiniPick.builtin.cli({ command = { 'echo', 'xx\nyy' } })]])
|
||||
|
||||
-- - Sleep as items are set inside `schedule_wrap`ed function
|
||||
sleep(1)
|
||||
sleep(small_time)
|
||||
eq(get_picker_items(), { 'aa', 'bb' })
|
||||
|
||||
-- Should set correct name
|
||||
@ -2976,7 +3011,7 @@ T['builtin.cli()']['respects `local_opts.postprocess`'] = function()
|
||||
mock_cli_return({ 'aa', 'bb' })
|
||||
child.lua([[_G.postprocess = function(...) _G.args = { ... }; return { 'x', 'y', 'z' } end]])
|
||||
child.lua_notify([[MiniPick.builtin.cli({ command = { 'echo', 'xx\nyy' }, postprocess = postprocess })]])
|
||||
sleep(1)
|
||||
sleep(small_time)
|
||||
eq(child.lua_get('_G.args'), { { 'aa', 'bb' } })
|
||||
eq(get_picker_items(), { 'x', 'y', 'z' })
|
||||
end
|
||||
@ -3026,6 +3061,10 @@ T['builtin.resume()']['works'] = function()
|
||||
eq(get_picker_matches().all, { 'b', 'bb' })
|
||||
type_keys('<CR>')
|
||||
|
||||
-- Default choose prints item
|
||||
eq(child.cmd_capture('messages'), '"b"')
|
||||
type_keys(':<Esc>')
|
||||
|
||||
make_event_log()
|
||||
child.cmd('au User MiniPickStart lua _G.track_event()')
|
||||
|
||||
@ -3158,22 +3197,16 @@ T['builtin.resume()']['can be called consecutively'] = function()
|
||||
type_keys('<C-c>')
|
||||
end
|
||||
|
||||
T['builtin.resume()']["restores 'cmdheight'"] = function()
|
||||
T['builtin.resume()']["restores 'guicursor'"] = function()
|
||||
start_with_items({ 'a' }, 'My name')
|
||||
type_keys('<C-c>')
|
||||
|
||||
local validate = function(cmdheight)
|
||||
child.o.cmdheight = cmdheight
|
||||
builtin_resume()
|
||||
-- Should *temporarily* force 'cmdheight=1' to both have place where to hide
|
||||
-- cursor (in case of `cmdheight=0`) and increase available space for picker
|
||||
eq(child.o.cmdheight, 1)
|
||||
type_keys('<C-c>')
|
||||
eq(child.o.cmdheight, cmdheight)
|
||||
end
|
||||
|
||||
validate(3)
|
||||
validate(0)
|
||||
child.o.guicursor = 'n-v-c:block'
|
||||
builtin_resume()
|
||||
-- Should *temporarily* force custom 'guicursor' to hide cursor
|
||||
eq(child.o.guicursor, 'a:MiniPickCursor')
|
||||
type_keys('<C-c>')
|
||||
eq(child.o.guicursor, 'n-v-c:block')
|
||||
end
|
||||
|
||||
T['builtin.resume()']['validates if no picker was previously called'] = function()
|
||||
@ -3491,7 +3524,7 @@ T['get_picker_state()']['properly detects when picker is busy'] = function()
|
||||
-- Between starting match and displaying its results
|
||||
type_keys('a')
|
||||
eq(get_picker_state().is_busy, true)
|
||||
sleep(10 + 10)
|
||||
sleep(small_time)
|
||||
eq(get_picker_state().is_busy, false)
|
||||
end
|
||||
|
||||
@ -3610,7 +3643,7 @@ end
|
||||
T['set_picker_items()']['respects `opts.querytick`'] = function()
|
||||
-- Should check every `delay.async` milliseconds if global querytick is the
|
||||
-- same as supplied. If not - abort without setting items.
|
||||
child.lua('MiniPick.config.delay.async = 1')
|
||||
child.lua('MiniPick.config.delay.async = ' .. micro_time)
|
||||
|
||||
start_with_items()
|
||||
set_picker_items(many_items, { querytick = -1 })
|
||||
@ -3618,6 +3651,8 @@ T['set_picker_items()']['respects `opts.querytick`'] = function()
|
||||
end
|
||||
|
||||
T['set_picker_items()']['does not block picker'] = function()
|
||||
helpers.skip_if_slow()
|
||||
|
||||
child.lua([[
|
||||
_G.log = {}
|
||||
_G.log_func = function()
|
||||
@ -3632,7 +3667,7 @@ T['set_picker_items()']['does not block picker'] = function()
|
||||
-- processed right away even though there is an items preprocessing is going.
|
||||
set_picker_items(many_items)
|
||||
type_keys('l')
|
||||
sleep(1)
|
||||
sleep(small_time)
|
||||
stop()
|
||||
eq(child.lua_get('_G.log'), { { is_busy = true, items_type = 'nil' } })
|
||||
end
|
||||
@ -3648,7 +3683,7 @@ local set_picker_items_from_cli = function(...)
|
||||
-- Work around tuples and callables being not transferrable through RPC
|
||||
local tuple = child.lua(
|
||||
[[local process, pid = MiniPick.set_picker_items_from_cli(...)
|
||||
local process_keys = vim.tbl_keys(process)
|
||||
local process_keys = vim.tbl_filter(function(x) return x:sub(1, 1) ~= '_' end, vim.tbl_keys(process))
|
||||
table.sort(process_keys)
|
||||
return { process_keys, pid }]],
|
||||
{ ... }
|
||||
@ -3673,7 +3708,7 @@ T['set_picker_items_from_cli()']['works'] = function()
|
||||
eq(get_process_log(), { 'Stdout Stdout_1 was closed.', 'Process Pid_1 was closed.' })
|
||||
|
||||
-- Should return proper data
|
||||
eq(process_keys, { 'close', 'pid' })
|
||||
eq(process_keys, { 'close', 'is_active', 'pid' })
|
||||
eq(pid, 'Pid_1')
|
||||
end
|
||||
|
||||
@ -3705,6 +3740,40 @@ T['set_picker_items_from_cli()']['correctly detects error in stdout feed'] = fun
|
||||
expect.error(function() set_picker_items_from_cli(test_command) end, 'Test stdout error')
|
||||
end
|
||||
|
||||
T['set_picker_items_from_cli()']['stops process if picker is stopped'] = function()
|
||||
local delay = 3 * small_time
|
||||
child.lua('_G.delay = ' .. delay)
|
||||
child.lua([[
|
||||
local is_active_indicator = true
|
||||
vim.loop.spawn = function(path, options, on_exit)
|
||||
vim.defer_fn(on_exit, _G.delay)
|
||||
|
||||
local process = {
|
||||
pid = 'Pid_1',
|
||||
is_active = function() return is_active_indicator end,
|
||||
close = function(_) table.insert(_G.process_log, 'Process Pid_1 was closed.') end,
|
||||
}
|
||||
return process, pid
|
||||
end
|
||||
vim.loop.process_kill = function(process)
|
||||
-- Killing process also means it stops being active
|
||||
is_active_indicator = false
|
||||
table.insert(_G.process_log, 'Process Pid_1 was killed.')
|
||||
end
|
||||
]])
|
||||
|
||||
start_with_items()
|
||||
set_picker_items_from_cli({ 'sleep', '10' })
|
||||
sleep(small_time)
|
||||
type_keys('<Esc>')
|
||||
sleep(delay)
|
||||
-- Should kill the process without later calling `process:close()`
|
||||
eq(get_process_log(), { 'Stdout Stdout_1 was closed.', 'Process Pid_1 was killed.' })
|
||||
|
||||
-- Should clean possible helper autocommands
|
||||
eq(child.cmd_capture('au User'), '--- Autocommands ---')
|
||||
end
|
||||
|
||||
T['set_picker_items_from_cli()']['has default postprocess'] = function()
|
||||
-- Should remove all trailing empty lines
|
||||
start_with_items()
|
||||
@ -4222,19 +4291,30 @@ T['Overall view']["respects tabline, statusline, 'cmdheight'"] = function()
|
||||
validate()
|
||||
end
|
||||
|
||||
T['Overall view']["respects 'cmdheight'"] = function()
|
||||
local validate = function(cmdheight)
|
||||
child.o.cmdheight = cmdheight
|
||||
T['Overall view']["respects 'guicursor'"] = function()
|
||||
local validate = function(keys, init_guicursor)
|
||||
init_guicursor = init_guicursor or 'n-v-c:block'
|
||||
child.o.guicursor = init_guicursor
|
||||
type_keys(keys)
|
||||
start_with_items({ 'a' }, 'My name')
|
||||
-- Should *temporarily* force 'cmdheight=1' to both have place where to hide
|
||||
-- cursor (in case of `cmdheight=0`) and increase available space for picker
|
||||
eq(child.o.cmdheight, 1)
|
||||
-- Should *temporarily* force custom 'guicursor' to hide cursor
|
||||
eq(child.o.guicursor, 'a:MiniPickCursor')
|
||||
type_keys('<C-c>')
|
||||
eq(child.o.cmdheight, cmdheight)
|
||||
eq(child.o.guicursor, init_guicursor)
|
||||
child.ensure_normal_mode()
|
||||
end
|
||||
|
||||
validate(3)
|
||||
validate(0)
|
||||
-- Should work in all modes
|
||||
validate('')
|
||||
validate('i')
|
||||
validate('v')
|
||||
validate(':')
|
||||
|
||||
-- Should work with empty guicursor. Should also work around empty string
|
||||
-- 'guicursor' by first setting to some other "neutral" value and redrawing.
|
||||
child.cmd('au OptionSet guicursor lua _G.n = (_G.n or 0) + 1')
|
||||
validate('', '')
|
||||
eq(child.lua_get('_G.n'), 4)
|
||||
end
|
||||
|
||||
T['Overall view']['allows very large dimensions'] = function()
|
||||
@ -4246,7 +4326,7 @@ end
|
||||
T['Overall view']['uses dedicated highlight groups'] = function()
|
||||
start_with_items(nil, 'My name')
|
||||
local win_id = get_picker_state().windows.main
|
||||
sleep(child.lua_get('MiniPick.config.delay.busy') + 5)
|
||||
sleep(default_busy_delay + small_time)
|
||||
|
||||
-- Busy picker
|
||||
eq(get_picker_state().is_busy, true)
|
||||
@ -4883,9 +4963,9 @@ T['Key query process']['respects mouse click'] = function()
|
||||
-- Should stop picker if outside of main window
|
||||
local validate_press_outside = function(button, row, col)
|
||||
start_with_items({ 'a' })
|
||||
sleep(10)
|
||||
sleep(small_time)
|
||||
child.api.nvim_input_mouse(button, 'press', '', 0, row, col)
|
||||
sleep(10)
|
||||
sleep(small_time)
|
||||
eq(is_picker_active(), false)
|
||||
end
|
||||
|
||||
@ -5227,7 +5307,10 @@ T['Paste']['does not error on non-existing register label'] = function()
|
||||
end
|
||||
|
||||
T['Paste']['respects `delay.async` when waiting for register label'] = function()
|
||||
helpers.skip_if_slow()
|
||||
|
||||
child.set_size(15, 15)
|
||||
child.lua('_G.small_time = ' .. small_time)
|
||||
child.lua_notify([[
|
||||
_G.buf_id, _G.n = vim.api.nvim_get_current_buf(), 0
|
||||
local timer = vim.loop.new_timer()
|
||||
@ -5235,7 +5318,7 @@ T['Paste']['respects `delay.async` when waiting for register label'] = function(
|
||||
_G.n = _G.n + 1
|
||||
vim.fn.appendbufline(_G.buf_id, '$', { 'Line ' .. _G.n })
|
||||
end)
|
||||
timer:start(50, 50, f)
|
||||
timer:start(5 * _G.small_time, 5 * _G.small_time, f)
|
||||
]])
|
||||
local validate = function(n, lines)
|
||||
eq(child.lua_get('_G.n'), n)
|
||||
@ -5243,20 +5326,20 @@ T['Paste']['respects `delay.async` when waiting for register label'] = function(
|
||||
child.expect_screenshot({ redraw = false })
|
||||
end
|
||||
|
||||
child.lua_notify([[MiniPick.start({ source = { items = { 'a' } }, delay = { async = 80 } })]])
|
||||
child.lua_notify([[MiniPick.start({ source = { items = { 'a' } }, delay = { async = 8 * _G.small_time } })]])
|
||||
validate(0, { '' })
|
||||
type_keys('<C-r>')
|
||||
|
||||
-- Callback should have already been executed, but not redraw
|
||||
sleep(50 + 5)
|
||||
sleep(5 * small_time + small_time)
|
||||
validate(1, { '', 'Line 1' })
|
||||
|
||||
-- No new callback should have been executed, but redraw should
|
||||
sleep(30)
|
||||
sleep(3 * small_time)
|
||||
validate(1, { '', 'Line 1' })
|
||||
|
||||
-- Test that redraw is done repeatedly
|
||||
sleep(80)
|
||||
sleep(8 * small_time)
|
||||
validate(3, { '', 'Line 1', 'Line 2', 'Line 3' })
|
||||
end
|
||||
|
||||
|
||||
@ -10,10 +10,14 @@ local child = helpers.new_child_neovim()
|
||||
local expect, eq = helpers.expect, helpers.expect.equality
|
||||
local new_set = MiniTest.new_set
|
||||
|
||||
local path_sep = package.config:sub(1, 1)
|
||||
local project_root = vim.fn.getcwd()
|
||||
local fs_normalize = vim.fs.normalize
|
||||
if vim.fn.has('nvim-0.9') == 0 then
|
||||
fs_normalize = function(...) return vim.fs.normalize(...):gsub('(.)/+$', '%1') end
|
||||
end
|
||||
|
||||
local project_root = fs_normalize(vim.fn.getcwd())
|
||||
local empty_dir_relpath = 'tests/dir-sessions/empty'
|
||||
local empty_dir_path = vim.fn.fnamemodify(empty_dir_relpath, ':p')
|
||||
local empty_dir_path = project_root .. '/' .. empty_dir_relpath
|
||||
|
||||
-- Helpers with child processes
|
||||
--stylua: ignore start
|
||||
@ -22,10 +26,9 @@ local unload_module = function() child.mini_unload('sessions') end
|
||||
local reload_module = function(config) unload_module(); load_module(config) end
|
||||
local reload_from_strconfig = function(strconfig) unload_module(); child.mini_load_strconfig('sessions', strconfig) end
|
||||
local set_lines = function(...) return child.set_lines(...) end
|
||||
local make_path = function(...) local res = table.concat({...}, path_sep):gsub(path_sep .. path_sep, path_sep); return res end
|
||||
local make_path = function(...) return fs_normalize(table.concat({...}, '/')) end
|
||||
local cd = function(...) child.cmd('cd ' .. make_path(...)) end
|
||||
local poke_eventloop = function() child.api.nvim_eval('1') end
|
||||
local sleep = function(ms) vim.loop.sleep(ms); poke_eventloop() end
|
||||
local sleep = function(ms) helpers.sleep(ms, child) end
|
||||
--stylua: ignore end
|
||||
|
||||
-- Make helpers
|
||||
@ -129,6 +132,10 @@ local validate_executed_hook = function(pre_post, action, value)
|
||||
eq(vim.tbl_map(function(x) return type(data[x]) end, keys), { 'number', 'string', 'string', 'string' })
|
||||
end
|
||||
|
||||
-- Time constants
|
||||
local one_second_delay = 1000
|
||||
local small_time = helpers.get_time_const(10)
|
||||
|
||||
-- Output test set ============================================================
|
||||
local T = new_set({
|
||||
hooks = {
|
||||
@ -180,7 +187,7 @@ T['setup()']['creates `config` field'] = function()
|
||||
|
||||
expect_config('autoread', false)
|
||||
expect_config('autowrite', true)
|
||||
expect_config('directory', ('%s%ssession'):format(child.fn.stdpath('data'), path_sep))
|
||||
expect_config('directory', child.fn.stdpath('data') .. '/session')
|
||||
expect_config('file', 'Session.vim')
|
||||
expect_config('force', { read = false, write = true, delete = false })
|
||||
expect_config('hooks.pre', { read = nil, write = nil, delete = nil })
|
||||
@ -262,7 +269,7 @@ T['setup()']['prefers local session file over global'] = function()
|
||||
|
||||
reload_module({ directory = 'global' })
|
||||
local detected = child.lua_get('MiniSessions.detected')
|
||||
local expected_path = vim.fn.fnamemodify('.', ':p') .. 'tests/dir-sessions/Session.vim'
|
||||
local expected_path = project_root .. '/tests/dir-sessions/Session.vim'
|
||||
|
||||
eq(detected['Session.vim'].path, expected_path)
|
||||
end
|
||||
@ -402,7 +409,7 @@ T['read()']['uses by default local session'] = function()
|
||||
end
|
||||
|
||||
T['read()']['uses by default latest global session'] = function()
|
||||
local session_dir = populate_sessions(1000)
|
||||
local session_dir = populate_sessions(one_second_delay + small_time)
|
||||
|
||||
reload_module({ autowrite = false, directory = session_dir })
|
||||
child.lua('MiniSessions.read()')
|
||||
@ -473,11 +480,13 @@ T['read()']['does not stop on source error'] = function()
|
||||
eq(#buffers, 2)
|
||||
|
||||
child.api.nvim_set_current_buf(buffers[1])
|
||||
expect.match(child.api.nvim_buf_get_name(0), vim.pesc(folded_file))
|
||||
local buf_name_1 = fs_normalize(child.api.nvim_buf_get_name(0))
|
||||
eq(vim.endswith(buf_name_1, '/' .. folded_file), true)
|
||||
eq(child.api.nvim_buf_get_lines(0, 0, -1, true), { 'No folds in this file' })
|
||||
|
||||
child.api.nvim_set_current_buf(buffers[2])
|
||||
expect.match(child.api.nvim_buf_get_name(0), vim.pesc(extra_file))
|
||||
local buf_name_2 = fs_normalize(child.api.nvim_buf_get_name(0))
|
||||
eq(vim.endswith(buf_name_2, '/' .. extra_file), true)
|
||||
eq(child.api.nvim_buf_get_lines(0, 0, -1, true), { 'This should be preserved in session' })
|
||||
end
|
||||
|
||||
@ -589,11 +598,11 @@ T['write()']['updates `MiniSessions.detected` with new session'] = function()
|
||||
end
|
||||
|
||||
T['write()']['updates `MiniSessions.detected` for present session'] = function()
|
||||
local session_dir = populate_sessions(1000)
|
||||
local session_dir = populate_sessions(one_second_delay + small_time)
|
||||
reload_module({ directory = session_dir })
|
||||
|
||||
child.lua([[MiniSessions.read('session_a')]])
|
||||
sleep(1000)
|
||||
sleep(one_second_delay + small_time)
|
||||
child.lua([[MiniSessions.write('session_a')]])
|
||||
|
||||
local detected = child.lua_get('MiniSessions.detected')
|
||||
@ -940,7 +949,7 @@ T['select()']['makes detected sessions up to date'] = function()
|
||||
|
||||
-- Remove 'session_a' manually which should be shown in `select()` output
|
||||
local directory = child.lua_get('MiniSessions.config.directory')
|
||||
child.fn.delete(make_path(directory, 'session_a'))
|
||||
child.fn.delete(make_path(directory, 'session_a'), 'rf')
|
||||
|
||||
child.lua('MiniSessions.select()')
|
||||
eq(child.lua_get('_G.ui_select_args[1]'), { 'Session.vim', 'session_b' })
|
||||
@ -984,7 +993,7 @@ end
|
||||
T['get_latest()'] = new_set()
|
||||
|
||||
T['get_latest()']['works'] = function()
|
||||
local dir = populate_sessions(1000)
|
||||
local dir = populate_sessions(one_second_delay + small_time)
|
||||
reload_module({ directory = dir })
|
||||
eq(child.lua_get('MiniSessions.get_latest()'), 'session_b')
|
||||
end
|
||||
|
||||
@ -19,7 +19,7 @@ local type_keys = function(...) return child.type_keys(...) end
|
||||
--stylua: ignore end
|
||||
|
||||
-- Make helpers
|
||||
local is_starter_shown = function() return child.api.nvim_buf_get_option(0, 'filetype') == 'ministarter' end
|
||||
local is_starter_shown = function() return child.bo.filetype == 'ministarter' end
|
||||
|
||||
local validate_starter_shown = function() eq(is_starter_shown(), true) end
|
||||
|
||||
@ -151,6 +151,11 @@ T['setup()']['validates `config` argument'] = function()
|
||||
expect_config_error({ silent = 1 }, 'silent', 'boolean')
|
||||
end
|
||||
|
||||
T['setup()']['ensures colors'] = function()
|
||||
child.cmd('colorscheme default')
|
||||
expect.match(child.cmd_capture('hi MiniStarterCurrent'), 'links to MiniStarterItem')
|
||||
end
|
||||
|
||||
-- Work with Starter buffer ---------------------------------------------------
|
||||
T['open()'] = new_set()
|
||||
|
||||
@ -160,7 +165,7 @@ T['open()']['works'] = function()
|
||||
child.lua('MiniStarter.open()')
|
||||
|
||||
expect.no_equality(child.api.nvim_get_current_buf(), init_buf_id)
|
||||
eq(child.api.nvim_buf_get_name(0), child.fn.getcwd() .. '/Starter')
|
||||
eq(child.api.nvim_buf_get_name(0), child.fn.getcwd() .. package.config:sub(1, 1) .. 'Starter')
|
||||
validate_starter_shown()
|
||||
|
||||
expect.match(table.concat(get_lines(), '\n'), 'Builtin actions')
|
||||
@ -910,16 +915,17 @@ T['sections']['recent_files()'] = new_set()
|
||||
|
||||
T['sections']['recent_files()']['correctly identifies files from current directory'] = function()
|
||||
local dir, dir_similar = 'tests/dir-starter/aaa', 'tests/dir-starter/aaabbb'
|
||||
local file = dir_similar .. '/file'
|
||||
child.fn.mkdir(dir)
|
||||
child.fn.mkdir(dir_similar)
|
||||
MiniTest.finally(function()
|
||||
vim.fn.delete(dir, 'rf')
|
||||
vim.fn.delete(dir_similar, 'rf')
|
||||
vim.loop.fs_rmdir(dir)
|
||||
vim.loop.fs_unlink(file)
|
||||
vim.loop.fs_rmdir(dir_similar)
|
||||
end)
|
||||
|
||||
-- Make recent file with absolute path having current directory as substring
|
||||
-- but not inside current directory
|
||||
local file = dir_similar .. '/file'
|
||||
child.fn.writefile({ '' }, file)
|
||||
child.v.oldfiles = { child.fn.fnamemodify(file, ':p') }
|
||||
child.cmd('cd ' .. dir)
|
||||
@ -933,22 +939,28 @@ end
|
||||
|
||||
T['sections']['recent_files()']['respects files in subdirectories'] = function()
|
||||
local dir = 'tests/dir-starter/aaa'
|
||||
local dir_nested = 'tests/dir-starter/aaa/bbb'
|
||||
child.fn.mkdir(dir)
|
||||
child.fn.mkdir(dir_nested)
|
||||
local dir_nested = dir .. '/bbb'
|
||||
local file, file_nested = dir .. '/file1', dir_nested .. '/file2'
|
||||
|
||||
child.fn.mkdir(dir_nested, 'p')
|
||||
child.fn.writefile({ '' }, file)
|
||||
child.fn.writefile({ '' }, file_nested)
|
||||
MiniTest.finally(function()
|
||||
vim.fn.delete(dir, 'rf')
|
||||
vim.fn.delete(dir_nested, 'rf')
|
||||
vim.loop.fs_unlink(file_nested)
|
||||
vim.loop.fs_rmdir(dir_nested)
|
||||
vim.loop.fs_unlink(file)
|
||||
vim.loop.fs_rmdir(dir)
|
||||
end)
|
||||
|
||||
local file1 = dir .. '/file1'
|
||||
child.fn.writefile({ '' }, file1)
|
||||
local file2 = dir_nested .. '/file2'
|
||||
child.fn.writefile({ '' }, file2)
|
||||
|
||||
child.v.oldfiles = { child.fn.fnamemodify(file1, ':p'), child.fn.fnamemodify(file2, ':p') }
|
||||
child.v.oldfiles = { child.fn.fnamemodify(file, ':p'), child.fn.fnamemodify(file_nested, ':p') }
|
||||
child.cmd('cd ' .. dir)
|
||||
|
||||
-- Mock forward slash for more robust screenshot testing
|
||||
child.lua([[
|
||||
local fnamemodify_orig = vim.fn.fnamemodify
|
||||
vim.fn.fnamemodify = function(...) return fnamemodify_orig(...):gsub('\\', '/') end
|
||||
]])
|
||||
|
||||
-- Set up to show files only in current directory
|
||||
child.lua('MiniStarter.config.items = { MiniStarter.sections.recent_files(5, true, true) }')
|
||||
child.lua('MiniStarter.open()')
|
||||
@ -959,7 +971,7 @@ end
|
||||
T['sections']['recent_files()']['respects `show_path`'] = function()
|
||||
local test_file = 'tests/dir-starter/aaa.txt'
|
||||
child.fn.writefile({ '' }, test_file)
|
||||
MiniTest.finally(function() vim.fn.delete(test_file, 'rf') end)
|
||||
MiniTest.finally(function() vim.loop.fs_unlink(test_file) end)
|
||||
|
||||
child.v.oldfiles = { child.fn.fnamemodify(test_file, ':p') }
|
||||
|
||||
|
||||
@ -59,6 +59,9 @@ end
|
||||
|
||||
local unmock_file = function() pcall(vim.fn.delete, mocked_filepath) end
|
||||
|
||||
-- Time constants
|
||||
local term_mode_wait = helpers.get_time_const(50)
|
||||
|
||||
-- Output test set ============================================================
|
||||
local T = new_set({
|
||||
hooks = {
|
||||
@ -135,6 +138,11 @@ T['setup()']['validates `config` argument'] = function()
|
||||
expect_config_error({ use_icons = 'a' }, 'use_icons', 'boolean')
|
||||
end
|
||||
|
||||
T['setup()']['ensures colors'] = function()
|
||||
child.cmd('colorscheme default')
|
||||
expect.match(child.cmd_capture('hi MiniStatuslineModeNormal'), 'links to Cursor')
|
||||
end
|
||||
|
||||
T['setup()']['sets proper autocommands'] = function()
|
||||
local validate = function(win_id, field)
|
||||
eq(child.api.nvim_win_get_option(win_id, 'statusline'), '%{%v:lua.MiniStatusline.' .. field .. '()%}')
|
||||
@ -151,8 +159,16 @@ T['setup()']['sets proper autocommands'] = function()
|
||||
end
|
||||
|
||||
T['setup()']['respects `config.set_vim_settings`'] = function()
|
||||
reload_module({ set_vim_settings = true })
|
||||
eq(child.o.laststatus, 2)
|
||||
local validate = function(init_laststatus, ref_laststatus)
|
||||
child.o.laststatus = init_laststatus
|
||||
reload_module({ set_vim_settings = true })
|
||||
eq(child.o.laststatus, ref_laststatus)
|
||||
end
|
||||
|
||||
validate(0, 2)
|
||||
validate(1, 2)
|
||||
validate(2, 2)
|
||||
validate(3, 3)
|
||||
end
|
||||
|
||||
T['setup()']['disables built-in statusline in quickfix window'] = function()
|
||||
@ -161,16 +177,18 @@ T['setup()']['disables built-in statusline in quickfix window'] = function()
|
||||
end
|
||||
|
||||
T['setup()']['ensures content when working with built-in terminal'] = function()
|
||||
helpers.skip_on_windows('Terminal emulator testing is not robust/easy on Windows')
|
||||
|
||||
local init_buf_id = child.api.nvim_get_current_buf()
|
||||
|
||||
child.cmd('terminal! bash --noprofile --norc')
|
||||
-- Wait for terminal to get active
|
||||
child.loop.sleep(50)
|
||||
vim.loop.sleep(term_mode_wait)
|
||||
expect.match(child.wo.statusline, 'MiniStatusline%.active')
|
||||
eq(child.api.nvim_get_current_buf() == init_buf_id, false)
|
||||
|
||||
type_keys('i', 'exit', '<CR>')
|
||||
child.loop.sleep(50)
|
||||
vim.loop.sleep(term_mode_wait)
|
||||
type_keys('<CR>')
|
||||
expect.match(child.wo.statusline, 'MiniStatusline%.active')
|
||||
eq(child.api.nvim_get_current_buf() == init_buf_id, true)
|
||||
@ -774,7 +792,9 @@ T['Default content']['active'] = new_set({
|
||||
parametrize = { { 120 }, { 75 }, { 40 }, { 39 } },
|
||||
}, {
|
||||
test = function(window_width)
|
||||
eq(child.api.nvim_win_get_option(0, 'statusline'), '%{%v:lua.MiniStatusline.active()%}')
|
||||
helpers.skip_on_windows('Windows has different default path separator')
|
||||
|
||||
eq(child.wo.statusline, '%{%v:lua.MiniStatusline.active()%}')
|
||||
set_width(window_width)
|
||||
child.expect_screenshot()
|
||||
end,
|
||||
|
||||
@ -14,8 +14,7 @@ local get_cursor = function(...) return child.get_cursor(...) end
|
||||
local set_lines = function(...) return child.set_lines(...) end
|
||||
local get_lines = function(...) return child.get_lines(...) end
|
||||
local type_keys = function(...) return child.type_keys(...) end
|
||||
local poke_eventloop = function() child.api.nvim_eval('1') end
|
||||
local sleep = function(ms) vim.loop.sleep(ms); poke_eventloop() end
|
||||
local sleep = function(ms) helpers.sleep(ms, child) end
|
||||
--stylua: ignore end
|
||||
|
||||
-- Make helpers
|
||||
@ -76,6 +75,11 @@ local mock_treesitter_builtin = function() child.cmd('source tests/dir-surround/
|
||||
|
||||
local mock_treesitter_plugin = function() child.cmd('set rtp+=tests/dir-surround') end
|
||||
|
||||
-- Time constants
|
||||
local default_highlight_duraion = 500
|
||||
local helper_message_delay = 1000
|
||||
local small_time = helpers.get_time_const(10)
|
||||
|
||||
-- Output test set ============================================================
|
||||
local T = new_set({
|
||||
hooks = {
|
||||
@ -97,6 +101,9 @@ T['setup()']['creates side effects'] = function()
|
||||
-- Global variable
|
||||
eq(child.lua_get('type(_G.MiniSurround)'), 'table')
|
||||
|
||||
-- Autocommand group
|
||||
eq(child.fn.exists('#MiniSurround'), 1)
|
||||
|
||||
-- Highlight groups
|
||||
child.cmd('hi clear')
|
||||
load_module()
|
||||
@ -159,6 +166,11 @@ T['setup()']['validates `config` argument'] = function()
|
||||
expect_config_error({ silent = 1 }, 'silent', 'boolean')
|
||||
end
|
||||
|
||||
T['setup()']['ensures colors'] = function()
|
||||
child.cmd('colorscheme default')
|
||||
expect.match(child.cmd_capture('hi MiniSurround'), 'links to IncSearch')
|
||||
end
|
||||
|
||||
T['setup()']['properly handles `config.mappings`'] = function()
|
||||
local has_map = function(lhs, pattern) return child.cmd_capture('nmap ' .. lhs):find(pattern) ~= nil end
|
||||
|
||||
@ -248,7 +260,7 @@ T['gen_spec']['input']['treesitter()']['works with empty region'] = function()
|
||||
set_lines(lines)
|
||||
set_cursor(1, 0)
|
||||
type_keys('sh', 'o')
|
||||
poke_eventloop()
|
||||
child.poke_eventloop()
|
||||
-- It highlights `local` differently from other places
|
||||
if child.fn.has('nvim-0.10') == 1 then child.expect_screenshot() end
|
||||
|
||||
@ -514,10 +526,10 @@ T['Add surrounding']['prompts helper message after one idle second'] = function(
|
||||
|
||||
-- Execute one time to test if 'needs help message' flag is set per call
|
||||
type_keys('sa', 'iw', ')')
|
||||
sleep(200)
|
||||
sleep(0.1 * helper_message_delay)
|
||||
|
||||
type_keys('sa', 'iw')
|
||||
sleep(1000)
|
||||
sleep(helper_message_delay + small_time)
|
||||
|
||||
-- Should show helper message without adding it to `:messages` and causing
|
||||
-- hit-enter-prompt
|
||||
@ -663,7 +675,7 @@ T['Add surrounding']['respects `config.silent`'] = function()
|
||||
|
||||
-- It should not show helper message after one idle second
|
||||
type_keys('sa', 'iw')
|
||||
sleep(1000 + 15)
|
||||
sleep(helper_message_delay + small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
@ -793,15 +805,15 @@ T['Delete surrounding']['prompts helper message after one idle second'] = functi
|
||||
|
||||
-- Mapping is applied only after `timeoutlen` milliseconds, because
|
||||
-- there are `sdn`/`sdl` mappings. Wait 1000 seconds after that.
|
||||
child.o.timeoutlen = 50
|
||||
local total_wait_time = 1000 + child.o.timeoutlen
|
||||
child.o.timeoutlen = 5 * small_time
|
||||
local total_wait_time = helper_message_delay + child.o.timeoutlen + small_time
|
||||
|
||||
set_lines({ '((aaa))' })
|
||||
set_cursor(1, 1)
|
||||
|
||||
-- Execute one time to test if 'needs help message' flag is set per call
|
||||
type_keys('sd', ')')
|
||||
sleep(200)
|
||||
sleep(0.1 * helper_message_delay)
|
||||
|
||||
type_keys('sd')
|
||||
sleep(total_wait_time)
|
||||
@ -917,15 +929,15 @@ T['Delete surrounding']['respects `config.silent`'] = function()
|
||||
child.lua('MiniSurround.config.silent = true')
|
||||
child.set_size(10, 20)
|
||||
|
||||
child.o.timeoutlen = 50
|
||||
local total_wait_time = 1000 + child.o.timeoutlen
|
||||
child.o.timeoutlen = 5 * small_time
|
||||
local total_wait_time = helper_message_delay + child.o.timeoutlen + small_time
|
||||
|
||||
set_lines({ '<aaa>' })
|
||||
set_cursor(1, 1)
|
||||
|
||||
-- It should not show helper message after one idle second
|
||||
type_keys('sd')
|
||||
sleep(total_wait_time + 15)
|
||||
sleep(total_wait_time)
|
||||
child.expect_screenshot()
|
||||
|
||||
-- It should not show message about "No surrounding found"
|
||||
@ -1024,15 +1036,15 @@ T['Replace surrounding']['prompts helper message after one idle second'] = funct
|
||||
|
||||
-- Mapping is applied only after `timeoutlen` milliseconds, because
|
||||
-- there are `srn`/`srl` mappings. Wait 1000 seconds after that.
|
||||
child.o.timeoutlen = 50
|
||||
local total_wait_time = 1000 + child.o.timeoutlen
|
||||
child.o.timeoutlen = 5 * small_time
|
||||
local total_wait_time = helper_message_delay + child.o.timeoutlen + small_time
|
||||
|
||||
set_lines({ '((aaa))' })
|
||||
set_cursor(1, 1)
|
||||
|
||||
-- Execute one time to test if 'needs help message' flag is set per call
|
||||
type_keys('sr', ')', '>')
|
||||
sleep(200)
|
||||
sleep(0.1 * helper_message_delay)
|
||||
|
||||
type_keys('sr')
|
||||
sleep(total_wait_time)
|
||||
@ -1046,7 +1058,7 @@ T['Replace surrounding']['prompts helper message after one idle second'] = funct
|
||||
type_keys(')')
|
||||
|
||||
-- Here mapping collision doesn't matter any more
|
||||
sleep(1000)
|
||||
sleep(helper_message_delay + small_time)
|
||||
eq(get_latest_message(), '')
|
||||
child.expect_screenshot()
|
||||
|
||||
@ -1170,15 +1182,15 @@ T['Replace surrounding']['respects `config.silent`'] = function()
|
||||
child.lua('MiniSurround.config.silent = true')
|
||||
child.set_size(10, 20)
|
||||
|
||||
child.o.timeoutlen = 50
|
||||
local total_wait_time = 1000 + child.o.timeoutlen
|
||||
child.o.timeoutlen = 5 * small_time
|
||||
local total_wait_time = helper_message_delay + child.o.timeoutlen + small_time
|
||||
|
||||
set_lines({ '<aaa>' })
|
||||
set_cursor(1, 1)
|
||||
|
||||
-- It should not show helper message after one idle second
|
||||
type_keys('sr')
|
||||
sleep(total_wait_time + 15)
|
||||
sleep(total_wait_time)
|
||||
child.expect_screenshot()
|
||||
|
||||
-- It should not show message about "No surrounding found"
|
||||
@ -1316,15 +1328,15 @@ T['Find surrounding']['prompts helper message after one idle second'] = function
|
||||
|
||||
-- Mapping is applied only after `timeoutlen` milliseconds, because
|
||||
-- there are `sfn`/`sfl` mappings. Wait 1000 seconds after that.
|
||||
child.o.timeoutlen = 50
|
||||
local total_wait_time = 1000 + child.o.timeoutlen
|
||||
child.o.timeoutlen = 5 * small_time
|
||||
local total_wait_time = helper_message_delay + child.o.timeoutlen + small_time
|
||||
|
||||
set_lines({ '(aaa)' })
|
||||
set_cursor(1, 2)
|
||||
|
||||
-- Execute one time to test if 'needs help message' flag is set per call
|
||||
type_keys('sf', ')')
|
||||
sleep(200)
|
||||
sleep(0.1 * helper_message_delay)
|
||||
|
||||
type_keys('sf')
|
||||
sleep(total_wait_time)
|
||||
@ -1454,7 +1466,7 @@ T['Highlight surrounding'] = new_set({
|
||||
hooks = {
|
||||
pre_case = function()
|
||||
-- Reduce default highlight duration to speed up tests execution
|
||||
child.lua('MiniSurround.config.highlight_duration = 50')
|
||||
child.lua('MiniSurround.config.highlight_duration = ' .. (5 * small_time))
|
||||
child.set_size(5, 12)
|
||||
child.o.cmdheight = 1
|
||||
end,
|
||||
@ -1463,7 +1475,7 @@ T['Highlight surrounding'] = new_set({
|
||||
|
||||
local activate_highlighting = function()
|
||||
type_keys('sh)')
|
||||
poke_eventloop()
|
||||
child.poke_eventloop()
|
||||
end
|
||||
|
||||
T['Highlight surrounding']['works with dot-repeat'] = function()
|
||||
@ -1476,11 +1488,11 @@ T['Highlight surrounding']['works with dot-repeat'] = function()
|
||||
child.expect_screenshot()
|
||||
|
||||
-- Should still highlight
|
||||
sleep(test_duration - 10)
|
||||
sleep(test_duration - 2 * small_time)
|
||||
child.expect_screenshot()
|
||||
|
||||
-- Should stop highlighting
|
||||
sleep(10)
|
||||
sleep(2 * small_time + small_time)
|
||||
child.expect_screenshot()
|
||||
|
||||
-- Should highlight with dot-repeat
|
||||
@ -1488,7 +1500,7 @@ T['Highlight surrounding']['works with dot-repeat'] = function()
|
||||
child.expect_screenshot()
|
||||
|
||||
-- Should stop highlighting
|
||||
sleep(test_duration)
|
||||
sleep(test_duration + small_time)
|
||||
child.expect_screenshot()
|
||||
|
||||
-- Should allow not immediate dot-repeat
|
||||
@ -1504,22 +1516,22 @@ T['Highlight surrounding']['works in extended mappings'] = function()
|
||||
|
||||
set_cursor(1, 1)
|
||||
type_keys('shn', ')')
|
||||
poke_eventloop()
|
||||
child.poke_eventloop()
|
||||
child.expect_screenshot()
|
||||
sleep(test_duration + 1)
|
||||
sleep(test_duration + small_time)
|
||||
|
||||
set_cursor(1, 12)
|
||||
type_keys('shl', ')')
|
||||
poke_eventloop()
|
||||
child.poke_eventloop()
|
||||
child.expect_screenshot()
|
||||
sleep(test_duration + 1)
|
||||
sleep(test_duration + small_time)
|
||||
|
||||
-- Dot-repeat
|
||||
set_cursor(1, 1)
|
||||
type_keys('shn', ')')
|
||||
sleep(test_duration + 1)
|
||||
sleep(test_duration + small_time)
|
||||
type_keys('.')
|
||||
poke_eventloop()
|
||||
child.poke_eventloop()
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
@ -1542,7 +1554,7 @@ T['Highlight surrounding']['respects `config.n_lines`'] = function()
|
||||
end
|
||||
|
||||
T['Highlight surrounding']['works with multiline input surroundings'] = function()
|
||||
child.lua('MiniSurround.config.highlight_duration = 5')
|
||||
child.lua('MiniSurround.config.highlight_duration = ' .. small_time)
|
||||
child.lua([[MiniSurround.config.custom_surroundings = {
|
||||
a = { input = { '%(\na().-()a\n%)' } },
|
||||
b = { input = { '%(\n().-()\n%)' } },
|
||||
@ -1554,15 +1566,15 @@ T['Highlight surrounding']['works with multiline input surroundings'] = function
|
||||
|
||||
type_keys('sh', 'a')
|
||||
child.expect_screenshot()
|
||||
sleep(10)
|
||||
sleep(small_time + small_time)
|
||||
|
||||
type_keys('sh', 'b')
|
||||
child.expect_screenshot()
|
||||
sleep(10)
|
||||
sleep(small_time + small_time)
|
||||
|
||||
type_keys('sh', 'c')
|
||||
child.expect_screenshot()
|
||||
sleep(10)
|
||||
sleep(small_time + small_time)
|
||||
|
||||
type_keys('sh', 'd')
|
||||
child.expect_screenshot()
|
||||
@ -1581,12 +1593,12 @@ T['Highlight surrounding']['removes highlighting in correct buffer'] = function(
|
||||
child.cmd('vsplit current')
|
||||
set_lines({ '(bbb)' })
|
||||
set_cursor(1, 2)
|
||||
sleep(0.5 * test_duration)
|
||||
sleep(0.5 * test_duration + small_time)
|
||||
activate_highlighting()
|
||||
|
||||
-- Highlighting should be removed only in previous buffer
|
||||
child.expect_screenshot()
|
||||
sleep(0.5 * test_duration + 2)
|
||||
sleep(0.5 * test_duration + small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
@ -1607,11 +1619,11 @@ T['Highlight surrounding']['removes highlighting per line'] = function()
|
||||
child.expect_screenshot()
|
||||
|
||||
-- Should highlight only in second line
|
||||
sleep(half_duration + 1)
|
||||
sleep(half_duration + small_time)
|
||||
child.expect_screenshot()
|
||||
|
||||
-- Should stop highlighting at all
|
||||
sleep(half_duration + 1)
|
||||
sleep(half_duration + small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
@ -1640,7 +1652,7 @@ T['Highlight surrounding']['respects `vim.{g,b}.minisurround_disable`'] = new_se
|
||||
set_lines({ '(aaa)', 'bbb' })
|
||||
set_cursor(1, 2)
|
||||
type_keys('sh', ')')
|
||||
poke_eventloop()
|
||||
child.poke_eventloop()
|
||||
|
||||
-- Shouldn't highlight anything (instead moves cursor with `)` motion)
|
||||
child.expect_screenshot()
|
||||
@ -1650,18 +1662,18 @@ T['Highlight surrounding']['respects `vim.{g,b}.minisurround_disable`'] = new_se
|
||||
T['Highlight surrounding']['respects `vim.b.minisurround_config`'] = function()
|
||||
child.b.minisurround_config = {
|
||||
custom_surroundings = { ['<'] = { input = { '>().-()<' } } },
|
||||
highlight_duration = 50,
|
||||
highlight_duration = 5 * small_time,
|
||||
}
|
||||
validate_edit({ '>aaa<' }, { 1, 2 }, { 'aaa' }, { 1, 0 }, type_keys, 'sd', '<')
|
||||
|
||||
set_lines({ '>aaa<', 'bbb' })
|
||||
set_cursor(1, 2)
|
||||
type_keys('sh', '<')
|
||||
poke_eventloop()
|
||||
child.poke_eventloop()
|
||||
child.expect_screenshot()
|
||||
|
||||
-- Should stop highlighting after duration from local config
|
||||
sleep(50)
|
||||
sleep(5 * small_time + small_time)
|
||||
child.expect_screenshot()
|
||||
end
|
||||
|
||||
|
||||
@ -10,7 +10,6 @@ local load_module = function(config) child.mini_load('tabline', config) end
|
||||
local unload_module = function() child.mini_unload('tabline') end
|
||||
local reload_module = function(config) unload_module(); load_module(config) end
|
||||
local set_lines = function(...) return child.set_lines(...) end
|
||||
local poke_eventloop = function() child.api.nvim_eval('1') end
|
||||
--stylua: ignore end
|
||||
|
||||
-- Make helpers
|
||||
@ -20,9 +19,14 @@ local edit = function(name) child.cmd('edit ' .. name) end
|
||||
|
||||
local edit_path = function(rel_path) child.cmd('edit tests/dir-tabline/' .. rel_path) end
|
||||
|
||||
local path_sep = package.config:sub(1, 1)
|
||||
|
||||
local eval_tabline = function(show_hl, show_action)
|
||||
local res = child.lua_get('MiniTabline.make_tabline_string()')
|
||||
|
||||
-- Unify path separator for more robust testing
|
||||
res = res:gsub(path_sep, '/')
|
||||
|
||||
if not show_hl then res = res:gsub('%%#%w+#', '') end
|
||||
|
||||
if not show_action then
|
||||
@ -51,6 +55,9 @@ T['setup()']['creates side effects'] = function()
|
||||
-- Global variable
|
||||
eq(child.lua_get('type(_G.MiniTabline)'), 'table')
|
||||
|
||||
-- Autocommand group
|
||||
eq(child.fn.exists('#MiniTabline'), 1)
|
||||
|
||||
-- Highlight groups
|
||||
child.cmd('hi clear')
|
||||
load_module()
|
||||
@ -97,6 +104,11 @@ T['setup()']['validates `config` argument'] = function()
|
||||
expect_config_error({ tabpage_section = 1 }, 'tabpage_section', 'string')
|
||||
end
|
||||
|
||||
T['setup()']['ensures colors'] = function()
|
||||
child.cmd('colorscheme default')
|
||||
expect.match(child.cmd_capture('hi MiniTablineCurrent'), 'links to TabLineSel')
|
||||
end
|
||||
|
||||
T['setup()']["sets proper 'tabline' option"] = function()
|
||||
eq(child.api.nvim_get_option('tabline'), '%!v:lua.MiniTabline.make_tabline_string()')
|
||||
child.cmd('tabedit')
|
||||
@ -189,7 +201,7 @@ T['make_tabline_string()']['respects `config.tabpage_section`'] = function()
|
||||
|
||||
-- Should also use buffer local config
|
||||
child.b.minitabline_config = { tabpage_section = 'right' }
|
||||
poke_eventloop()
|
||||
child.poke_eventloop()
|
||||
eq(
|
||||
eval_tabline(true),
|
||||
'%#MiniTablineHidden# aaa %#MiniTablineCurrent# bbb %#MiniTablineFill#%=%#MiniTablineTabpagesection# Tab 2/2 '
|
||||
@ -257,7 +269,7 @@ T['make_tabline_string()']['respects `config.show_icons`'] = function()
|
||||
|
||||
-- Should also use buffer local config
|
||||
child.b.minitabline_config = { show_icons = true }
|
||||
poke_eventloop()
|
||||
child.poke_eventloop()
|
||||
eq(eval_tabline(true), '%#MiniTablineCurrent# LICENSE %#MiniTablineHidden# init.lua %#MiniTablineFill#')
|
||||
|
||||
-- Should prefer 'mini.icons' even if 'nvim-web-devicons' is present
|
||||
@ -287,7 +299,7 @@ T['make_tabline_string()']['respects `config.format`'] = function()
|
||||
'%#MiniTablineHidden#[1] |dir1/aaa| %#MiniTablineCurrent#[2] |dir2/aaa| %#MiniTablineHidden#[3] |!(2)| %#MiniTablineFill#'
|
||||
)
|
||||
local log = child.lua_get('_G.log')
|
||||
eq({ log[1], log[2], log[3] }, { 'dir1/aaa', 'dir2/aaa', '!(2)' })
|
||||
eq({ log[1], log[2], log[3] }, { 'dir1' .. path_sep .. 'aaa', 'dir2' .. path_sep .. 'aaa', '!(2)' })
|
||||
|
||||
-- Should also use buffer local config
|
||||
child.lua([[vim.b.minitabline_config = {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user