diff options
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/api/vim_spec.lua | 18 | ||||
-rw-r--r-- | test/functional/editor/mode_insert_spec.lua | 43 | ||||
-rw-r--r-- | test/functional/ex_cmds/verbose_spec.lua | 17 | ||||
-rw-r--r-- | test/functional/fixtures/fake-lsp-server.lua | 36 | ||||
-rw-r--r-- | test/functional/lua/buffer_updates_spec.lua | 19 | ||||
-rw-r--r-- | test/functional/plugin/lsp/helpers.lua | 2 | ||||
-rw-r--r-- | test/functional/plugin/lsp_spec.lua | 1 | ||||
-rw-r--r-- | test/functional/ui/cursor_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/ui/popupmenu_spec.lua | 62 |
9 files changed, 177 insertions, 25 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index 08abf82f47..48ac491ade 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -2832,6 +2832,24 @@ describe('API', function() type = "boolean", was_set = true }, meths.get_option_info'showcmd') + + meths.set_option_value('showcmd', true, {}) + + eq({ + allows_duplicates = true, + commalist = false, + default = true, + flaglist = false, + global_local = false, + last_set_chan = 1, + last_set_linenr = 0, + last_set_sid = -9, + name = "showcmd", + scope = "global", + shortname = "sc", + type = "boolean", + was_set = true + }, meths.get_option_info'showcmd') end) end) diff --git a/test/functional/editor/mode_insert_spec.lua b/test/functional/editor/mode_insert_spec.lua index cd51a65be3..b00661ac3a 100644 --- a/test/functional/editor/mode_insert_spec.lua +++ b/test/functional/editor/mode_insert_spec.lua @@ -1,6 +1,7 @@ -- Insert-mode tests. local helpers = require('test.functional.helpers')(after_each) +local Screen = require('test.functional.ui.screen') local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert local expect = helpers.expect local command = helpers.command @@ -48,6 +49,48 @@ describe('insert-mode', function() feed('i<C-r>"') expect('påskägg') end) + + it('double quote is removed after hit-enter prompt #22609', function() + local screen = Screen.new(60, 6) + screen:set_default_attr_ids({ + [0] = {bold = true, foreground = Screen.colors.Blue}, + [1] = {foreground = Screen.colors.Blue}, + [2] = {foreground = Screen.colors.SlateBlue}, + [3] = {bold = true}, + [4] = {reverse = true, bold = true}, + [5] = {background = Screen.colors.Red, foreground = Screen.colors.Red}, + [6] = {background = Screen.colors.Red, foreground = Screen.colors.White}, + [7] = {foreground = Screen.colors.SeaGreen, bold = true}, + }) + screen:attach() + feed('i<C-R>') + screen:expect([[ + {1:^"} | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {3:-- INSERT --} | + ]]) + feed('={}<CR>') + screen:expect([[ + {1:"} | + {0:~ }| + {4: }| + ={5:{}{2:}} | + {6:E731: using Dictionary as a String} | + {7:Press ENTER or type command to continue}^ | + ]]) + feed('<CR>') + screen:expect([[ + ^ | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {3:-- INSERT --} | + ]]) + end) end) describe('Ctrl-O', function() diff --git a/test/functional/ex_cmds/verbose_spec.lua b/test/functional/ex_cmds/verbose_spec.lua index 000e746f1c..e55372e993 100644 --- a/test/functional/ex_cmds/verbose_spec.lua +++ b/test/functional/ex_cmds/verbose_spec.lua @@ -7,7 +7,7 @@ local exec_capture = helpers.exec_capture local write_file = helpers.write_file local call_viml_function = helpers.meths.call_function -describe('lua :verbose', function() +local function last_set_tests(cmd) local script_location, script_file -- All test cases below use the same nvim instance. setup(function() @@ -46,7 +46,7 @@ endfunction\ let &tw = s:return80()\ ", true) ]]) - exec(':source '..script_file) + exec(cmd .. ' ' .. script_file) end) teardown(function() @@ -106,6 +106,9 @@ test_group FileType end) it('"Last set" for command defined by nvim_command', function() + if cmd == 'luafile' then + pending('nvim_command does not set the script context') + end local result = exec_capture(':verbose command Bdelete') eq(string.format([[ Name Args Address Complete Definition @@ -123,7 +126,7 @@ test_group FileType script_location), result) end) - it('"Last set for function', function() + it('"Last set" for function', function() local result = exec_capture(':verbose function Close_Window') eq(string.format([[ function Close_Window() abort @@ -140,6 +143,14 @@ test_group FileType Last set from %s line 22]], script_location), result) end) +end + +describe('lua :verbose when using :source', function() + last_set_tests('source') +end) + +describe('lua :verbose when using :luafile', function() + last_set_tests('luafile') end) describe('lua verbose:', function() diff --git a/test/functional/fixtures/fake-lsp-server.lua b/test/functional/fixtures/fake-lsp-server.lua index 9cc2f6fa27..001cd5770a 100644 --- a/test/functional/fixtures/fake-lsp-server.lua +++ b/test/functional/fixtures/fake-lsp-server.lua @@ -293,8 +293,6 @@ function tests.text_document_sync_save_bool() end; body = function() notify('start') - expect_notification('textDocument/didClose') - expect_notification('textDocument/didOpen') expect_notification('textDocument/didSave', {textDocument = { uri = "file://" }}) notify('shutdown') end; @@ -316,8 +314,6 @@ function tests.text_document_sync_save_includeText() end; body = function() notify('start') - expect_notification('textDocument/didClose') - expect_notification('textDocument/didOpen') expect_notification('textDocument/didSave', { textDocument = { uri = "file://" @@ -464,7 +460,7 @@ function tests.basic_check_buffer_open() textDocument = { languageId = ""; text = table.concat({"testing"; "123"}, "\n") .. '\n'; - uri = "buffer://"; + uri = "file://"; version = 0; }; }) @@ -491,13 +487,13 @@ function tests.basic_check_buffer_open_and_change() textDocument = { languageId = ""; text = table.concat({"testing"; "123"}, "\n") .. '\n'; - uri = "buffer://"; + uri = "file://"; version = 0; }; }) expect_notification('textDocument/didChange', { textDocument = { - uri = "buffer://"; + uri = "file://"; version = 3; }; contentChanges = { @@ -527,13 +523,13 @@ function tests.basic_check_buffer_open_and_change_noeol() textDocument = { languageId = ""; text = table.concat({"testing"; "123"}, "\n"); - uri = "buffer://"; + uri = "file://"; version = 0; }; }) expect_notification('textDocument/didChange', { textDocument = { - uri = "buffer://"; + uri = "file://"; version = 3; }; contentChanges = { @@ -562,13 +558,13 @@ function tests.basic_check_buffer_open_and_change_multi() textDocument = { languageId = ""; text = table.concat({"testing"; "123"}, "\n") .. '\n'; - uri = "buffer://"; + uri = "file://"; version = 0; }; }) expect_notification('textDocument/didChange', { textDocument = { - uri = "buffer://"; + uri = "file://"; version = 3; }; contentChanges = { @@ -577,7 +573,7 @@ function tests.basic_check_buffer_open_and_change_multi() }) expect_notification('textDocument/didChange', { textDocument = { - uri = "buffer://"; + uri = "file://"; version = 4; }; contentChanges = { @@ -607,13 +603,13 @@ function tests.basic_check_buffer_open_and_change_multi_and_close() textDocument = { languageId = ""; text = table.concat({"testing"; "123"}, "\n") .. '\n'; - uri = "buffer://"; + uri = "file://"; version = 0; }; }) expect_notification('textDocument/didChange', { textDocument = { - uri = "buffer://"; + uri = "file://"; version = 3; }; contentChanges = { @@ -622,7 +618,7 @@ function tests.basic_check_buffer_open_and_change_multi_and_close() }) expect_notification('textDocument/didChange', { textDocument = { - uri = "buffer://"; + uri = "file://"; version = 4; }; contentChanges = { @@ -631,7 +627,7 @@ function tests.basic_check_buffer_open_and_change_multi_and_close() }) expect_notification('textDocument/didClose', { textDocument = { - uri = "buffer://"; + uri = "file://"; }; }) expect_notification("finish") @@ -665,13 +661,13 @@ function tests.basic_check_buffer_open_and_change_incremental() textDocument = { languageId = ""; text = table.concat({"testing"; "123"}, "\n") .. '\n'; - uri = "buffer://"; + uri = "file://"; version = 0; }; }) expect_notification('textDocument/didChange', { textDocument = { - uri = "buffer://"; + uri = "file://"; version = 3; }; contentChanges = { @@ -708,13 +704,13 @@ function tests.basic_check_buffer_open_and_change_incremental_editing() textDocument = { languageId = ""; text = table.concat({"testing"; "123"}, "\n"); - uri = "buffer://"; + uri = "file://"; version = 0; }; }) expect_notification('textDocument/didChange', { textDocument = { - uri = "buffer://"; + uri = "file://"; version = 3; }; contentChanges = { diff --git a/test/functional/lua/buffer_updates_spec.lua b/test/functional/lua/buffer_updates_spec.lua index b1b39501f7..2cd3123dcd 100644 --- a/test/functional/lua/buffer_updates_spec.lua +++ b/test/functional/lua/buffer_updates_spec.lua @@ -1171,6 +1171,25 @@ describe('lua: nvim_buf_attach on_bytes', function() } end) + it('works with :diffput and :diffget', function() + local check_events = setup_eventcheck(verify, {"AAA"}) + command('diffthis') + command('new') + command('diffthis') + meths.buf_set_lines(0, 0, -1, true, {"AAA", "BBB"}) + feed('G') + command('diffput') + check_events { + { "test1", "bytes", 1, 3, 1, 0, 4, 0, 0, 0, 1, 0, 4 }; + } + meths.buf_set_lines(0, 0, -1, true, {"AAA", "CCC"}) + feed('<C-w>pG') + command('diffget') + check_events { + { "test1", "bytes", 1, 4, 1, 0, 4, 1, 0, 4, 1, 0, 4 }; + } + end) + local function test_lockmarks(mode) local description = (mode ~= "") and mode or "(baseline)" it("test_lockmarks " .. description .. " %delete _", function() diff --git a/test/functional/plugin/lsp/helpers.lua b/test/functional/plugin/lsp/helpers.lua index caab174b4d..86f7da0d2c 100644 --- a/test/functional/plugin/lsp/helpers.lua +++ b/test/functional/plugin/lsp/helpers.lua @@ -13,6 +13,7 @@ function M.clear_notrace() -- solution: don't look too closely for dragons clear {env={ NVIM_LUA_NOTRACK="1"; + NVIM_APPNAME="nvim_lsp_test"; VIMRUNTIME=os.getenv"VIMRUNTIME"; }} end @@ -85,6 +86,7 @@ local function fake_lsp_server_setup(test_name, timeout_ms, options, settings) cmd_env = { NVIM_LOG_FILE = fake_lsp_logfile; NVIM_LUA_NOTRACK = "1"; + NVIM_APPNAME = "nvim_lsp_test"; }; cmd = { vim.v.progpath, '-l', fake_lsp_code, test_name, tostring(timeout), diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua index 56c53a6fed..c621a5eae2 100644 --- a/test/functional/plugin/lsp_spec.lua +++ b/test/functional/plugin/lsp_spec.lua @@ -57,6 +57,7 @@ describe('LSP', function() return lsp.start_client { cmd_env = { NVIM_LOG_FILE = fake_lsp_logfile; + NVIM_APPNAME = "nvim_lsp_test"; }; cmd = { vim.v.progpath, '-l', fake_lsp_code, test_name; diff --git a/test/functional/ui/cursor_spec.lua b/test/functional/ui/cursor_spec.lua index e261f0dfab..7e28caea04 100644 --- a/test/functional/ui/cursor_spec.lua +++ b/test/functional/ui/cursor_spec.lua @@ -212,10 +212,10 @@ describe('ui/cursor', function() if m.blinkwait then m.blinkwait = 700 end end if m.hl_id then - m.hl_id = 60 + m.hl_id = 64 m.attr = {background = Screen.colors.DarkGray} end - if m.id_lm then m.id_lm = 62 end + if m.id_lm then m.id_lm = 66 end end -- Assert the new expectation. diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua index c681453294..944319c443 100644 --- a/test/functional/ui/popupmenu_spec.lua +++ b/test/functional/ui/popupmenu_spec.lua @@ -3490,6 +3490,68 @@ describe('builtin popupmenu', function() pasted | ]]) end) + + describe('"kind" and "menu"', function() + before_each(function() + screen:try_resize(30, 8) + exec([[ + func CompleteFunc( findstart, base ) + if a:findstart + return 0 + endif + return { + \ 'words': [ + \ { 'word': 'aword1', 'menu': 'extra text 1', 'kind': 'W', }, + \ { 'word': 'aword2', 'menu': 'extra text 2', 'kind': 'W', }, + \ { 'word': 'aword3', 'menu': 'extra text 3', 'kind': 'W', }, + \]} + endfunc + set completeopt=menu + set completefunc=CompleteFunc + ]]) + end) + + -- oldtest: Test_pum_highlights_default() + it('default highlight groups', function() + feed('iaw<C-X><C-u>') + screen:expect([[ + aword1^ | + {s:aword1 W extra text 1 }{1: }| + {n:aword2 W extra text 2 }{1: }| + {n:aword3 W extra text 3 }{1: }| + {1:~ }| + {1:~ }| + {1:~ }| + {2:-- }{5:match 1 of 3} | + ]]) + end) + + -- oldtest: Test_pum_highlights_custom() + it('custom highlight groups', function() + exec([[ + hi PmenuKind guifg=Red guibg=Magenta + hi PmenuKindSel guifg=Red guibg=Grey + hi PmenuExtra guifg=White guibg=Magenta + hi PmenuExtraSel guifg=Black guibg=Grey + ]]) + local attrs = screen:get_default_attr_ids() + attrs.kn = {foreground = Screen.colors.Red, background = Screen.colors.Magenta} + attrs.ks = {foreground = Screen.colors.Red, background = Screen.colors.Grey} + attrs.xn = {foreground = Screen.colors.White, background = Screen.colors.Magenta} + attrs.xs = {foreground = Screen.colors.Black, background = Screen.colors.Grey} + feed('iaw<C-X><C-u>') + screen:expect([[ + aword1^ | + {s:aword1 }{ks:W }{xs:extra text 1 }{1: }| + {n:aword2 }{kn:W }{xn:extra text 2 }{1: }| + {n:aword3 }{kn:W }{xn:extra text 3 }{1: }| + {1:~ }| + {1:~ }| + {1:~ }| + {2:-- }{5:match 1 of 3} | + ]], attrs) + end) + end) end) describe('builtin popupmenu with ui/ext_multigrid', function() |