diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/functional/api/extmark_spec.lua (renamed from test/functional/api/mark_extended_spec.lua) | 1 | ||||
| -rw-r--r-- | test/functional/autocmd/tabnewentered_spec.lua | 36 | ||||
| -rw-r--r-- | test/functional/helpers.lua | 2 | ||||
| -rw-r--r-- | test/functional/provider/perl_spec.lua | 80 | ||||
| -rw-r--r-- | test/functional/ui/popupmenu_spec.lua | 59 | ||||
| -rw-r--r-- | test/functional/ui/wildmode_spec.lua | 100 |
6 files changed, 263 insertions, 15 deletions
diff --git a/test/functional/api/mark_extended_spec.lua b/test/functional/api/extmark_spec.lua index 8aa8ed07c5..5bf3fa554f 100644 --- a/test/functional/api/mark_extended_spec.lua +++ b/test/functional/api/extmark_spec.lua @@ -548,7 +548,6 @@ describe('API/extmarks', function() end) it('deleting marks at end of line works', function() - -- mark_extended.c/extmark_col_adjust_delete set_extmark(ns, marks[1], 0, 4) feed('$x') check_undo_redo(ns, marks[1], 0, 4, 0, 4) diff --git a/test/functional/autocmd/tabnewentered_spec.lua b/test/functional/autocmd/tabnewentered_spec.lua index 123dbd0824..dc2fd3e97d 100644 --- a/test/functional/autocmd/tabnewentered_spec.lua +++ b/test/functional/autocmd/tabnewentered_spec.lua @@ -97,6 +97,7 @@ describe('tabpage/previous', function() switches_to_previous_after_new_tab_creation_at_end('g<Tab>')) it('switches to previous via <C-W>g<Tab>. after new tab creation at end', switches_to_previous_after_new_tab_creation_at_end('<C-W>g<Tab>')) it('switches to previous via <C-Tab>. after new tab creation at end', switches_to_previous_after_new_tab_creation_at_end('<C-Tab>')) + it('switches to previous via :tabn #<CR>. after new tab creation at end', switches_to_previous_after_new_tab_creation_at_end(':tabn #<CR>')) local function switches_to_previous_after_new_tab_creation_in_middle(characters) return function() @@ -140,6 +141,8 @@ describe('tabpage/previous', function() switches_to_previous_after_new_tab_creation_in_middle('<C-W>g<Tab>')) it('switches to previous via <C-Tab> after new tab creation in middle', switches_to_previous_after_new_tab_creation_in_middle('<C-Tab>')) + it('switches to previous via :tabn #<CR> after new tab creation in middle', + switches_to_previous_after_new_tab_creation_in_middle(':tabn #<CR>')) local function switches_to_previous_after_switching_to_next_tab(characters) return function() @@ -180,6 +183,8 @@ describe('tabpage/previous', function() switches_to_previous_after_switching_to_next_tab('<C-W>g<Tab>')) it('switches to previous via <C-Tab> after switching to next tab', switches_to_previous_after_switching_to_next_tab('<C-Tab>')) + it('switches to previous via :tabn #<CR> after switching to next tab', + switches_to_previous_after_switching_to_next_tab(':tabn #<CR>')) local function switches_to_previous_after_switching_to_last_tab(characters) return function() @@ -222,6 +227,8 @@ describe('tabpage/previous', function() switches_to_previous_after_switching_to_last_tab('<C-W>g<Tab>')) it('switches to previous after switching to last tab', switches_to_previous_after_switching_to_last_tab('<C-Tab>')) + it('switches to previous after switching to last tab', + switches_to_previous_after_switching_to_last_tab(':tabn #<CR>')) local function switches_to_previous_after_switching_to_previous_tab(characters) return function() @@ -262,6 +269,8 @@ describe('tabpage/previous', function() switches_to_previous_after_switching_to_previous_tab('<C-W>g<Tab>')) it('switches to previous via <C-Tab> after switching to previous tab', switches_to_previous_after_switching_to_previous_tab('<C-Tab>')) + it('switches to previous via :tabn #<CR> after switching to previous tab', + switches_to_previous_after_switching_to_previous_tab(':tabn #<CR>')) local function switches_to_previous_after_switching_to_first_tab(characters) return function() @@ -304,6 +313,8 @@ describe('tabpage/previous', function() switches_to_previous_after_switching_to_first_tab('<C-W>g<Tab>')) it('switches to previous via <C-Tab> after switching to first tab', switches_to_previous_after_switching_to_first_tab('<C-Tab>')) + it('switches to previous via :tabn #<CR> after switching to first tab', + switches_to_previous_after_switching_to_first_tab(':tabn #<CR>')) local function switches_to_previous_after_numbered_tab_switch(characters) return function() @@ -344,6 +355,8 @@ describe('tabpage/previous', function() switches_to_previous_after_numbered_tab_switch('<C-W>g<Tab>')) it('switches to previous via <C-Tab> after numbered tab switch', switches_to_previous_after_numbered_tab_switch('<C-Tab>')) + it('switches to previous via :tabn #<CR> after numbered tab switch', + switches_to_previous_after_numbered_tab_switch(':tabn #<CR>')) local function switches_to_previous_after_switching_to_previous(characters1, characters2) return function() @@ -386,18 +399,32 @@ describe('tabpage/previous', function() switches_to_previous_after_switching_to_previous('g<Tab>', '<C-W>g<Tab>')) it('switches to previous via <C-Tab> after switching to previous via g<Tab>', switches_to_previous_after_switching_to_previous('g<Tab>', '<C-Tab>')) + it('switches to previous via :tabn #<CR> after switching to previous via g<Tab>', + switches_to_previous_after_switching_to_previous('g<Tab>', ':tabn #<CR>')) it('switches to previous via g<Tab> after switching to previous via <C-W>g<Tab>', switches_to_previous_after_switching_to_previous('<C-W>g<Tab>', 'g<Tab>')) it('switches to previous via <C-W>g<Tab> after switching to previous via <C-W>g<Tab>', switches_to_previous_after_switching_to_previous('<C-W>g<Tab>', '<C-W>g<Tab>')) it('switches to previous via <C-Tab> after switching to previous via <C-W>g<Tab>', switches_to_previous_after_switching_to_previous('<C-W>g<Tab>', '<C-Tab>')) + it('switches to previous via :tabn #<CR> after switching to previous via <C-W>g<Tab>', + switches_to_previous_after_switching_to_previous('<C-W>g<Tab>', ':tabn #<CR>')) it('switches to previous via g<Tab> after switching to previous via <C-Tab>', switches_to_previous_after_switching_to_previous('<C-Tab>', 'g<Tab>')) it('switches to previous via <C-W>g<Tab> after switching to previous via <C-Tab>', switches_to_previous_after_switching_to_previous('<C-Tab>', '<C-W>g<Tab>')) it('switches to previous via <C-Tab> after switching to previous via <C-Tab>', switches_to_previous_after_switching_to_previous('<C-Tab>', '<C-Tab>')) + it('switches to previous via :tabn #<CR> after switching to previous via <C-Tab>', + switches_to_previous_after_switching_to_previous('<C-Tab>', ':tabn #<CR>')) + it('switches to previous via g<Tab> after switching to previous via :tabn #<CR>', + switches_to_previous_after_switching_to_previous(':tabn #<CR>', 'g<Tab>')) + it('switches to previous via <C-W>g<Tab> after switching to previous via :tabn #<CR>', + switches_to_previous_after_switching_to_previous(':tabn #<CR>', '<C-W>g<Tab>')) + it('switches to previous via <C-Tab> after switching to previous via <C-Tab>', + switches_to_previous_after_switching_to_previous(':tabn #<CR>', '<C-Tab>')) + it('switches to previous via :tabn #<CR> after switching to previous via :tabn #<CR>', + switches_to_previous_after_switching_to_previous(':tabn #<CR>', ':tabn #<CR>')) local function does_not_switch_to_previous_after_closing_current_tab(characters) return function() @@ -437,6 +464,8 @@ describe('tabpage/previous', function() does_not_switch_to_previous_after_closing_current_tab('<C-W>g<Tab>')) it('does not switch to previous via <C-Tab> after closing current tab', does_not_switch_to_previous_after_closing_current_tab('<C-Tab>')) + it('does not switch to previous via :tabn #<CR> after closing current tab', + does_not_switch_to_previous_after_closing_current_tab(':tabn #<CR>')) local function does_not_switch_to_previous_after_entering_operator_pending(characters) return function() @@ -480,6 +509,11 @@ describe('tabpage/previous', function() -- does_not_switch_to_previous_after_entering_operator_pending('<C-W>g<Tab>')) it('does not switch to previous via <C-Tab> after entering operator pending', does_not_switch_to_previous_after_entering_operator_pending('<C-Tab>')) + -- NOTE: When in operator pending mode, pressing : leaves operator pending + -- mode and enters command mode, so :tabn #<CR> does in fact switch + -- tabs. + -- it('does not switch to previous via :tabn #<CR> after entering operator pending', + -- does_not_switch_to_previous_after_entering_operator_pending(':tabn #<CR>')) local function cmdline_win_prevents_tab_switch(characters, completion_visible) return function() @@ -516,6 +550,8 @@ describe('tabpage/previous', function() cmdline_win_prevents_tab_switch('<C-W>g<Tab>', 1)) it('cmdline-win prevents tab switch via <C-Tab>', cmdline_win_prevents_tab_switch('<C-Tab>', 0)) + it('cmdline-win prevents tab switch via :tabn #<CR>', + cmdline_win_prevents_tab_switch(':tabn #<CR>', 0)) it(':tabs indicates correct prevtab curwin', function() -- Add three tabs for a total of four diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index de61ff9cc8..3ffc6137d6 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -768,7 +768,7 @@ function module.new_pipename() end function module.missing_provider(provider) - if provider == 'ruby' or provider == 'node' then + if provider == 'ruby' or provider == 'node' or provider == 'perl' then local prog = module.funcs['provider#' .. provider .. '#Detect']() return prog == '' and (provider .. ' not detected') or false elseif provider == 'python' or provider == 'python3' then diff --git a/test/functional/provider/perl_spec.lua b/test/functional/provider/perl_spec.lua new file mode 100644 index 0000000000..7b446e4ab3 --- /dev/null +++ b/test/functional/provider/perl_spec.lua @@ -0,0 +1,80 @@ +local helpers = require('test.functional.helpers')(after_each) +local eq, clear = helpers.eq, helpers.clear +local missing_provider = helpers.missing_provider +local command = helpers.command +local write_file = helpers.write_file +local eval = helpers.eval +local retry = helpers.retry + +do + clear() + local reason = missing_provider('perl') + if reason then + pending(string.format("Missing perl host, or perl version is too old (%s)", reason), function() end) + return + end +end + +before_each(function() + clear() +end) + +describe('perl host', function() + if helpers.pending_win32(pending) then return end + teardown(function () + os.remove('Xtest-perl-hello.pl') + os.remove('Xtest-perl-hello-plugin.pl') + end) + + it('works', function() + local fname = 'Xtest-perl-hello.pl' + write_file(fname, [[ + package main; + use strict; + use warnings; + use Neovim::Ext; + use Neovim::Ext::MsgPack::RPC; + + my $session = Neovim::Ext::MsgPack::RPC::socket_session($ENV{NVIM_LISTEN_ADDRESS}); + my $nvim = Neovim::Ext::from_session($session); + $nvim->command('let g:job_out = "hello"'); + 1; + ]]) + command('let g:job_id = jobstart(["perl", "'..fname..'"])') + retry(nil, 3000, function() eq('hello', eval('g:job_out')) end) + end) + + it('plugin works', function() + local fname = 'Xtest-perl-hello-plugin.pl' + write_file(fname, [[ + package TestPlugin; + use strict; + use warnings; + use parent qw(Neovim::Ext::Plugin); + + __PACKAGE__->register; + + @{TestPlugin::commands} = (); + @{TestPlugin::specs} = (); + sub test_command :nvim_command('TestCommand') + { + my ($this) = @_; + $this->nvim->command('let g:job_out = "hello-plugin"'); + } + + package main; + use strict; + use warnings; + use Neovim::Ext; + use Neovim::Ext::MsgPack::RPC; + + my $session = Neovim::Ext::MsgPack::RPC::socket_session($ENV{NVIM_LISTEN_ADDRESS}); + my $nvim = Neovim::Ext::from_session($session); + my $plugin = TestPlugin->new($nvim); + $plugin->test_command(); + 1; + ]]) + command('let g:job_id = jobstart(["perl", "'..fname..'"])') + retry(nil, 3000, function() eq('hello-plugin', eval('g:job_out')) end) + end) +end) diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua index a0e5c3ca63..b2ebf7af19 100644 --- a/test/functional/ui/popupmenu_spec.lua +++ b/test/functional/ui/popupmenu_spec.lua @@ -640,7 +640,7 @@ describe('builtin popupmenu', function() }) end) - it('works with preview-window above', function() + it('with preview-window above', function() feed(':ped<CR><c-w>4+') feed('iaa bb cc dd ee ff gg hh ii jj<cr>') feed('<c-x><c-n>') @@ -668,7 +668,7 @@ describe('builtin popupmenu', function() ]]) end) - it('works with preview-window below', function() + it('with preview-window below', function() feed(':ped<CR><c-w>4+<c-w>r') feed('iaa bb cc dd ee ff gg hh ii jj<cr>') feed('<c-x><c-n>') @@ -696,7 +696,7 @@ describe('builtin popupmenu', function() ]]) end) - it('works with preview-window above and tall and inverted', function() + it('with preview-window above and tall and inverted', function() feed(':ped<CR><c-w>8+') feed('iaa<cr>bb<cr>cc<cr>dd<cr>ee<cr>') feed('ff<cr>gg<cr>hh<cr>ii<cr>jj<cr>') @@ -726,7 +726,7 @@ describe('builtin popupmenu', function() ]]) end) - it('works with preview-window above and short and inverted', function() + it('with preview-window above and short and inverted', function() feed(':ped<CR><c-w>4+') feed('iaa<cr>bb<cr>cc<cr>dd<cr>ee<cr>') feed('ff<cr>gg<cr>hh<cr>ii<cr>jj<cr>') @@ -755,7 +755,7 @@ describe('builtin popupmenu', function() ]]) end) - it('works with preview-window below and inverted', function() + it('with preview-window below and inverted', function() feed(':ped<CR><c-w>4+<c-w>r') feed('iaa<cr>bb<cr>cc<cr>dd<cr>ee<cr>') feed('ff<cr>gg<cr>hh<cr>ii<cr>jj<cr>') @@ -784,7 +784,7 @@ describe('builtin popupmenu', function() ]]) end) - it('works with vsplits', function() + it('with vsplits', function() insert('aaa aab aac\n') feed(':vsplit<cr>') screen:expect([[ @@ -859,7 +859,7 @@ describe('builtin popupmenu', function() ]]) end) - it('works with split and scroll', function() + it('with split and scroll', function() screen:try_resize(60,14) command("split") command("set completeopt+=noinsert") @@ -1293,7 +1293,7 @@ describe('builtin popupmenu', function() ]]) end) - it('behaves correcty with VimResized autocmd', function() + it('with VimResized autocmd', function() feed('isome long prefix before the ') command("set completeopt+=noinsert,noselect") command("autocmd VimResized * redraw!") @@ -1337,7 +1337,7 @@ describe('builtin popupmenu', function() ]]) end) - it('works with rightleft window', function() + it('with rightleft window', function() command("set rl") feed('isome rightleft ') screen:expect([[ @@ -1437,7 +1437,7 @@ describe('builtin popupmenu', function() ]]) end) - it('works with multiline messages', function() + it('with multiline messages', function() screen:try_resize(40,8) feed('ixx<cr>') command('imap <f2> <cmd>echoerr "very"\\|echoerr "much"\\|echoerr "error"<cr>') @@ -1514,7 +1514,7 @@ describe('builtin popupmenu', function() ]], unchanged=true} end) - it('works with kind, menu and abbr attributes', function() + it('with kind, menu and abbr attributes', function() screen:try_resize(40,8) feed('ixx ') funcs.complete(4, {{word='wordey', kind= 'x', menu='extrainfo'}, 'thing', {word='secret', abbr='sneaky', menu='bar'}}) @@ -1566,7 +1566,7 @@ describe('builtin popupmenu', function() ]]) end) - it('works with wildoptions=pum', function() + it('wildoptions=pum', function() screen:try_resize(32,10) command('set wildmenu') command('set wildoptions=pum') @@ -1738,7 +1738,7 @@ describe('builtin popupmenu', function() ]]) end) - it('works with wildoptions=pum with scrolled mesages ', function() + it('wildoptions=pum with scrolled mesages ', function() screen:try_resize(40,10) command('set wildmenu') command('set wildoptions=pum') @@ -1786,6 +1786,39 @@ describe('builtin popupmenu', function() ]]} end) + it('wildoptions=pum and wildmode=longest,full #11622', function() + screen:try_resize(30,8) + command('set wildmenu') + command('set wildoptions=pum') + command('set wildmode=longest,full') + + feed(':sign u<tab>') + screen:expect{grid=[[ + | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + :sign un^ | + ]]} + eq(0, funcs.wildmenumode()) + + feed('<tab>') + screen:expect{grid=[[ + | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }{s: undefine }{1: }| + {1:~ }{n: unplace }{1: }| + :sign undefine^ | + ]]} + eq(1, funcs.wildmenumode()) + end) + it("'pumblend' RGB-color", function() screen:try_resize(60,14) screen:set_default_attr_ids({ diff --git a/test/functional/ui/wildmode_spec.lua b/test/functional/ui/wildmode_spec.lua index f3fa711fb1..56987d7bc2 100644 --- a/test/functional/ui/wildmode_spec.lua +++ b/test/functional/ui/wildmode_spec.lua @@ -221,6 +221,106 @@ describe("'wildmenu'", function() ]]) end) + it('wildmode=longest,list', function() + -- Need more than 5 rows, else tabline is covered and will be redrawn. + screen:try_resize(25, 7) + + command('set wildmenu wildmode=longest,list') + + -- give wildmode-longest something to expand to + feed(':sign u<tab>') + screen:expect([[ + | + ~ | + ~ | + ~ | + ~ | + ~ | + :sign un^ | + ]]) + feed('<tab>') -- trigger wildmode list + screen:expect([[ + | + ~ | + ~ | + | + :sign un | + undefine unplace | + :sign un^ | + ]]) + feed('<Esc>') + screen:expect([[ + ^ | + ~ | + ~ | + ~ | + ~ | + ~ | + | + ]]) + + -- give wildmode-longest something it cannot expand, use list + feed(':sign un<tab>') + screen:expect([[ + | + ~ | + ~ | + | + :sign un | + undefine unplace | + :sign un^ | + ]]) + feed('<tab>') + screen:expect_unchanged() + feed('<Esc>') + screen:expect([[ + ^ | + ~ | + ~ | + ~ | + ~ | + ~ | + | + ]]) + end) + + it('wildmode=list,longest', function() + -- Need more than 5 rows, else tabline is covered and will be redrawn. + screen:try_resize(25, 7) + + command('set wildmenu wildmode=list,longest') + feed(':sign u<tab>') + screen:expect([[ + | + ~ | + ~ | + | + :sign u | + undefine unplace | + :sign u^ | + ]]) + feed('<tab>') -- trigger wildmode longest + screen:expect([[ + | + ~ | + ~ | + | + :sign u | + undefine unplace | + :sign un^ | + ]]) + feed('<Esc>') + screen:expect([[ + ^ | + ~ | + ~ | + ~ | + ~ | + ~ | + | + ]]) + end) + it('multiple <C-D> renders correctly', function() screen:try_resize(25, 7) |