aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/fixtures/fake-lsp-server.lua15
-rw-r--r--test/functional/helpers.lua6
-rw-r--r--test/functional/legacy/search_spec.lua32
-rw-r--r--test/functional/options/defaults_spec.lua2
-rw-r--r--test/functional/plugin/lsp_spec.lua21
-rw-r--r--test/functional/plugin/man_spec.lua14
-rw-r--r--test/functional/ui/input_spec.lua5
7 files changed, 83 insertions, 12 deletions
diff --git a/test/functional/fixtures/fake-lsp-server.lua b/test/functional/fixtures/fake-lsp-server.lua
index f589f5955f..86cdf4ef56 100644
--- a/test/functional/fixtures/fake-lsp-server.lua
+++ b/test/functional/fixtures/fake-lsp-server.lua
@@ -766,8 +766,21 @@ function tests.code_action_filter()
isPreferred = true,
command = 'preferred_command',
}
+ local quickfix_action = {
+ title = 'Action 3',
+ kind = 'quickfix',
+ command = 'quickfix_command',
+ }
+ local quickfix_foo_action = {
+ title = 'Action 4',
+ kind = 'quickfix.foo',
+ command = 'quickfix_foo_command',
+ }
+ expect_request('textDocument/codeAction', function()
+ return nil, { action, preferred_action, quickfix_action, quickfix_foo_action, }
+ end)
expect_request('textDocument/codeAction', function()
- return nil, { action, preferred_action, }
+ return nil, { action, preferred_action, quickfix_action, quickfix_foo_action, }
end)
notify('shutdown')
end;
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index e9c3d4bd92..3d64625752 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -41,10 +41,8 @@ module.nvim_set = (
module.nvim_argv = {
module.nvim_prog, '-u', 'NONE', '-i', 'NONE',
'--cmd', module.nvim_set,
- '--cmd', 'unmap Y',
- '--cmd', 'unmap <C-L>',
- '--cmd', 'iunmap <C-U>',
- '--cmd', 'iunmap <C-W>',
+ '--cmd', 'mapclear',
+ '--cmd', 'mapclear!',
'--embed'}
-- Directory containing nvim.
diff --git a/test/functional/legacy/search_spec.lua b/test/functional/legacy/search_spec.lua
index 4ed08881de..67991f5d48 100644
--- a/test/functional/legacy/search_spec.lua
+++ b/test/functional/legacy/search_spec.lua
@@ -7,6 +7,7 @@ local eval = helpers.eval
local feed = helpers.feed
local funcs = helpers.funcs
local poke_eventloop = helpers.poke_eventloop
+local exec = helpers.exec
describe('search cmdline', function()
local screen
@@ -640,3 +641,34 @@ describe('search cmdline', function()
feed('<esc>')
end)
end)
+
+describe('Search highlight', function()
+ before_each(clear)
+ it('Search highlight is combined with Visual highlight vim-patch:8.2.2797', function()
+ local screen = Screen.new(40, 6)
+ screen:set_default_attr_ids({
+ [1] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [2] = {bold = true}, -- ModeMsg, Search
+ [3] = {background = Screen.colors.LightGrey}, -- Visual
+ [4] = {background = Screen.colors.Yellow, bold = true}, -- Search
+ [5] = {background = Screen.colors.LightGrey, bold = true}, -- Visual + Search
+ })
+ screen:attach()
+ exec([[
+ set hlsearch noincsearch
+ call setline(1, repeat(["xxx yyy zzz"], 3))
+ hi Search gui=bold
+ /yyy
+ call cursor(1, 6)
+ ]])
+ feed('vjj')
+ screen:expect([[
+ xxx {4:y}{5:yy}{3: zzz} |
+ {3:xxx }{5:yyy}{3: zzz} |
+ {3:xxx }{5:y}{4:^yy} zzz |
+ {1:~ }|
+ {1:~ }|
+ {2:-- VISUAL --} |
+ ]])
+ end)
+end)
diff --git a/test/functional/options/defaults_spec.lua b/test/functional/options/defaults_spec.lua
index 36a53d8d26..4731df7b95 100644
--- a/test/functional/options/defaults_spec.lua
+++ b/test/functional/options/defaults_spec.lua
@@ -206,7 +206,7 @@ describe('startup defaults', function()
describe('$NVIM_LOG_FILE', function()
local xdgdir = 'Xtest-startup-xdg-logpath'
- local xdgstatedir = xdgdir..'/nvim'
+ local xdgstatedir = iswin() and xdgdir..'/nvim-data' or xdgdir..'/nvim'
after_each(function()
os.remove('Xtest-logpath')
rmdir(xdgdir)
diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua
index 33a8976b79..4cb7636825 100644
--- a/test/functional/plugin/lsp_spec.lua
+++ b/test/functional/plugin/lsp_spec.lua
@@ -2753,12 +2753,33 @@ describe('LSP', function()
vim.lsp.commands['executed_preferred'] = function()
end
end
+ vim.lsp.commands['quickfix_command'] = function(cmd)
+ vim.lsp.commands['executed_quickfix'] = function()
+ end
+ end
local bufnr = vim.api.nvim_get_current_buf()
vim.lsp.buf_attach_client(bufnr, TEST_RPC_CLIENT_ID)
vim.lsp.buf.code_action({ filter = function(a) return a.isPreferred end, apply = true, })
+ vim.lsp.buf.code_action({
+ -- expect to be returned actions 'quickfix' and 'quickfix.foo'
+ context = { only = {'quickfix'}, },
+ apply = true,
+ filter = function(a)
+ if a.kind == 'quickfix.foo' then
+ vim.lsp.commands['filtered_quickfix_foo'] = function() end
+ return false
+ elseif a.kind == 'quickfix' then
+ return true
+ else
+ assert(nil, 'unreachable')
+ end
+ end,
+ })
]])
elseif ctx.method == 'shutdown' then
eq('function', exec_lua[[return type(vim.lsp.commands['executed_preferred'])]])
+ eq('function', exec_lua[[return type(vim.lsp.commands['filtered_quickfix_foo'])]])
+ eq('function', exec_lua[[return type(vim.lsp.commands['executed_quickfix'])]])
client.stop()
end
end
diff --git a/test/functional/plugin/man_spec.lua b/test/functional/plugin/man_spec.lua
index e5b2e7dc1f..c8da5a711f 100644
--- a/test/functional/plugin/man_spec.lua
+++ b/test/functional/plugin/man_spec.lua
@@ -2,13 +2,19 @@ local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local command, eval, rawfeed = helpers.command, helpers.eval, helpers.rawfeed
local clear = helpers.clear
+local funcs = helpers.funcs
+local nvim_prog = helpers.nvim_prog
+local matches = helpers.matches
describe(':Man', function()
+ before_each(function()
+ clear()
+ end)
+
describe('man.lua: highlight_line()', function()
local screen
before_each(function()
- clear()
command('syntax on')
command('set filetype=man')
command('syntax off') -- Ignore syntax groups
@@ -137,4 +143,10 @@ describe(':Man', function()
]])
end)
end)
+
+ it('q quits in "$MANPAGER mode" (:Man!) #18281', function()
+ -- This will hang if #18281 regresses.
+ local args = {nvim_prog, '--headless', '+autocmd VimLeave * echo "quit works!!"', '+Man!', '+call nvim_input("q")'}
+ matches('quit works!!', funcs.system(args, {'manpage contents'}))
+ end)
end)
diff --git a/test/functional/ui/input_spec.lua b/test/functional/ui/input_spec.lua
index 07582ba602..0f4e97088c 100644
--- a/test/functional/ui/input_spec.lua
+++ b/test/functional/ui/input_spec.lua
@@ -313,11 +313,6 @@ it('unsimplified mapping works when there was a partial match vim-patch:8.2.4504
expect('xb')
end)
-it('rhs of a mapping is not simplified', function()
- command('nnoremap <Plug>foo <C-J>')
- eq('<C-J>', funcs.maparg('<Plug>foo'))
-end)
-
describe('input non-printable chars', function()
after_each(function()
os.remove('Xtest-overwrite')