From e18a5783080f7c94f408ec5f53dedffdb69789e1 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 20 Aug 2016 22:24:34 +0300 Subject: *: Move some dictionary functions to typval.h and use char* Also fixes buffer reusage in setmatches() and complete(). --- test/functional/viml/completion_spec.lua | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'test/functional/viml/completion_spec.lua') diff --git a/test/functional/viml/completion_spec.lua b/test/functional/viml/completion_spec.lua index cd5f4260e0..3c09d71eb7 100644 --- a/test/functional/viml/completion_spec.lua +++ b/test/functional/viml/completion_spec.lua @@ -3,6 +3,7 @@ local Screen = require('test.functional.ui.screen') local clear, feed = helpers.clear, helpers.feed local eval, eq, neq = helpers.eval, helpers.eq, helpers.neq local execute, source, expect = helpers.execute, helpers.source, helpers.expect +local meths = helpers.meths if helpers.pending_win32(pending) then return end @@ -814,6 +815,41 @@ describe('completion', function() end) end) + describe('with numeric items', function() + before_each(function() + source([[ + function! TestComplete() abort + call complete(1, g:_complist) + return '' + endfunction + ]]) + meths.set_option('completeopt', 'menuone,noselect') + meths.set_var('_complist', {{ + word=0, + abbr=1, + menu=2, + kind=3, + info=4, + icase=5, + dup=6, + empty=7, + }}) + end) + + it('shows correct variant as word', function() + feed('i=TestComplete()') + screen:expect([[ + ^ | + {1:1 3 2 }{0: }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {3:-- INSERT --} | + ]]) + end) + end) end) describe('External completion popupmenu', function() -- cgit From 30e1cda8acb7bd8120348d1812cfd9ecd8be8528 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 6 Apr 2017 21:35:03 +0200 Subject: completion: fix segfault with ignorecase+infercase (#6452) Helped-by: Matthew Malcomson Closes #6451 --- test/functional/viml/completion_spec.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test/functional/viml/completion_spec.lua') diff --git a/test/functional/viml/completion_spec.lua b/test/functional/viml/completion_spec.lua index 3c09d71eb7..5a37cb8f43 100644 --- a/test/functional/viml/completion_spec.lua +++ b/test/functional/viml/completion_spec.lua @@ -850,6 +850,22 @@ describe('completion', function() ]]) end) end) + + it("'ignorecase' 'infercase' CTRL-X CTRL-N #6451", function() + execute('set ignorecase infercase') + execute('edit BACKERS.md') + feed('oX') + screen:expect([[ + # Bountysource Backers | + Xnull^ | + {2:Xnull }{6: } | + {1:Xoxomoon }{6: }ryone who backed our [Bountysource fundraise| + {1:Xu }{6: }ountysource.com/teams/neovim/fundraiser)! | + {1:Xpayn }{2: } | + {1:Xinity }{2: }d URL in BACKERS.md. | + {3:-- Keyword Local completion (^N^P) }{4:match 1 of 7} | + ]]) + end) end) describe('External completion popupmenu', function() -- cgit From 65fb622000af8e3dbb65480e1581758ecf4ba3e2 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 9 Apr 2017 00:12:26 +0300 Subject: functests: Replace execute with either command or feed_command Hope this will make people using feed_command less likely: this hides bugs. Already found at least two: 1. msgpackparse() will show internal error: hash_add() in case of duplicate keys, though it will still work correctly. Currently silenced. 2. ttimeoutlen was spelled incorrectly, resulting in option not being set when expected. Test was still functioning somehow though. Currently fixed. --- test/functional/viml/completion_spec.lua | 52 ++++++++++++++++---------------- 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'test/functional/viml/completion_spec.lua') diff --git a/test/functional/viml/completion_spec.lua b/test/functional/viml/completion_spec.lua index 5a37cb8f43..b35e8d4f94 100644 --- a/test/functional/viml/completion_spec.lua +++ b/test/functional/viml/completion_spec.lua @@ -2,7 +2,7 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') local clear, feed = helpers.clear, helpers.feed local eval, eq, neq = helpers.eval, helpers.eq, helpers.neq -local execute, source, expect = helpers.execute, helpers.source, helpers.expect +local feed_command, source, expect = helpers.feed_command, helpers.source, helpers.expect local meths = helpers.meths if helpers.pending_win32(pending) then return end @@ -67,25 +67,25 @@ describe('completion', function() it('is readonly', function() screen:try_resize(80, 8) feed('ifooo') - execute('let v:completed_item.word = "bar"') + feed_command('let v:completed_item.word = "bar"') neq(nil, string.find(eval('v:errmsg'), '^E46: ')) - execute('let v:errmsg = ""') + feed_command('let v:errmsg = ""') - execute('let v:completed_item.abbr = "bar"') + feed_command('let v:completed_item.abbr = "bar"') neq(nil, string.find(eval('v:errmsg'), '^E46: ')) - execute('let v:errmsg = ""') + feed_command('let v:errmsg = ""') - execute('let v:completed_item.menu = "bar"') + feed_command('let v:completed_item.menu = "bar"') neq(nil, string.find(eval('v:errmsg'), '^E46: ')) - execute('let v:errmsg = ""') + feed_command('let v:errmsg = ""') - execute('let v:completed_item.info = "bar"') + feed_command('let v:completed_item.info = "bar"') neq(nil, string.find(eval('v:errmsg'), '^E46: ')) - execute('let v:errmsg = ""') + feed_command('let v:errmsg = ""') - execute('let v:completed_item.kind = "bar"') + feed_command('let v:completed_item.kind = "bar"') neq(nil, string.find(eval('v:errmsg'), '^E46: ')) - execute('let v:errmsg = ""') + feed_command('let v:errmsg = ""') end) it('returns expected dict in omni completion', function() source([[ @@ -125,7 +125,7 @@ describe('completion', function() end) it('inserts the first candidate if default', function() - execute('set completeopt+=menuone') + feed_command('set completeopt+=menuone') feed('ifooo') screen:expect([[ foo | @@ -176,7 +176,7 @@ describe('completion', function() eq('foo', eval('getline(3)')) end) it('selects the first candidate if noinsert', function() - execute('set completeopt+=menuone,noinsert') + feed_command('set completeopt+=menuone,noinsert') feed('ifooo') screen:expect([[ foo | @@ -216,7 +216,7 @@ describe('completion', function() eq('foo', eval('getline(3)')) end) it('does not insert the first candidate if noselect', function() - execute('set completeopt+=menuone,noselect') + feed_command('set completeopt+=menuone,noselect') feed('ifooo') screen:expect([[ foo | @@ -256,7 +256,7 @@ describe('completion', function() eq('bar', eval('getline(3)')) end) it('does not select/insert the first candidate if noselect and noinsert', function() - execute('set completeopt+=menuone,noselect,noinsert') + feed_command('set completeopt+=menuone,noselect,noinsert') feed('ifooo') screen:expect([[ foo | @@ -305,14 +305,14 @@ describe('completion', function() eq('', eval('getline(3)')) end) it('does not change modified state if noinsert', function() - execute('set completeopt+=menuone,noinsert') - execute('setlocal nomodified') + feed_command('set completeopt+=menuone,noinsert') + feed_command('setlocal nomodified') feed('i=TestComplete()') eq(0, eval('&l:modified')) end) it('does not change modified state if noselect', function() - execute('set completeopt+=menuone,noselect') - execute('setlocal nomodified') + feed_command('set completeopt+=menuone,noselect') + feed_command('setlocal nomodified') feed('i=TestComplete()') eq(0, eval('&l:modified')) end) @@ -326,8 +326,8 @@ describe('completion', function() return '' endfunction ]]) - execute('set completeopt+=noselect,noinsert') - execute('inoremap =TestComplete()') + feed_command('set completeopt+=noselect,noinsert') + feed_command('inoremap =TestComplete()') end) local tests = { @@ -541,7 +541,7 @@ describe('completion', function() return '' endfunction ]]) - execute("set completeopt=menuone,noselect") + feed_command("set completeopt=menuone,noselect") end) it("works", function() @@ -707,7 +707,7 @@ describe('completion', function() it('disables folding during completion', function () - execute("set foldmethod=indent") + feed_command("set foldmethod=indent") feed('ifoobargg') screen:expect([[ ^foo | @@ -734,7 +734,7 @@ describe('completion', function() end) it('popupmenu is not interrupted by events', function () - execute("set complete=.") + feed_command("set complete=.") feed('ifoobar fooeggf') screen:expect([[ @@ -852,8 +852,8 @@ describe('completion', function() end) it("'ignorecase' 'infercase' CTRL-X CTRL-N #6451", function() - execute('set ignorecase infercase') - execute('edit BACKERS.md') + feed_command('set ignorecase infercase') + feed_command('edit BACKERS.md') feed('oX') screen:expect([[ # Bountysource Backers | -- cgit From 00843902d3472ac4e74106fc06fa60e599914496 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 25 Apr 2017 02:17:15 +0200 Subject: api/ui: externalize tabline - Work with a bool[] array parallel to the UIWidget enum. - Rename some functions. - Documentation. --- test/functional/viml/completion_spec.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/functional/viml/completion_spec.lua') diff --git a/test/functional/viml/completion_spec.lua b/test/functional/viml/completion_spec.lua index b35e8d4f94..5f5e9437dc 100644 --- a/test/functional/viml/completion_spec.lua +++ b/test/functional/viml/completion_spec.lua @@ -868,13 +868,13 @@ describe('completion', function() end) end) -describe('External completion popupmenu', function() +describe('ui/externalized/popupmenu', function() local screen local items, selected, anchor before_each(function() clear() screen = Screen.new(60, 8) - screen:attach({rgb=true, popupmenu_external=true}) + screen:attach({rgb=true, ui_ext={'popupmenu'}}) screen:set_default_attr_ids({ [1] = {bold=true, foreground=Screen.colors.Blue}, [2] = {bold = true}, -- cgit From c8e1af93de90b2e23579f726fd4aa6a65f9387b6 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 25 Apr 2017 10:14:29 +0200 Subject: api: nvim_ui_attach(): Flatten ext_* options. --- test/functional/viml/completion_spec.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/functional/viml/completion_spec.lua') diff --git a/test/functional/viml/completion_spec.lua b/test/functional/viml/completion_spec.lua index 5f5e9437dc..0e5278345c 100644 --- a/test/functional/viml/completion_spec.lua +++ b/test/functional/viml/completion_spec.lua @@ -874,7 +874,7 @@ describe('ui/externalized/popupmenu', function() before_each(function() clear() screen = Screen.new(60, 8) - screen:attach({rgb=true, ui_ext={'popupmenu'}}) + screen:attach({rgb=true, ext_popupmenu=true}) screen:set_default_attr_ids({ [1] = {bold=true, foreground=Screen.colors.Blue}, [2] = {bold = true}, -- cgit