diff options
author | Tony Chen <tchen1998@gmail.com> | 2020-11-30 08:33:52 -0500 |
---|---|---|
committer | chentau <tchen1998@gmail.com> | 2021-01-26 17:04:32 -0800 |
commit | d95a465b4399c3c10b83925935ec5f4807d65b60 (patch) | |
tree | 5a356442adb3cd61483cf0dfb6958731d58b1249 /test/functional/lua/command_line_completion_spec.lua | |
parent | 901dd79f6a5ee78a55d726abca868bebff117ca9 (diff) | |
download | rneovim-d95a465b4399c3c10b83925935ec5f4807d65b60.tar.gz rneovim-d95a465b4399c3c10b83925935ec5f4807d65b60.tar.bz2 rneovim-d95a465b4399c3c10b83925935ec5f4807d65b60.zip |
Don't show entire context when completing
Diffstat (limited to 'test/functional/lua/command_line_completion_spec.lua')
-rw-r--r-- | test/functional/lua/command_line_completion_spec.lua | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/test/functional/lua/command_line_completion_spec.lua b/test/functional/lua/command_line_completion_spec.lua index 9056f80fb5..31cd5cf02f 100644 --- a/test/functional/lua/command_line_completion_spec.lua +++ b/test/functional/lua/command_line_completion_spec.lua @@ -6,33 +6,34 @@ local funcs = helpers.funcs local exec_lua = helpers.exec_lua local get_completions = function(input, env) - return exec_lua("return vim._expand_pat(...)", '^' .. input, env) + return exec_lua("return {vim._expand_pat(...)}", '^' .. input, env) end local get_compl_parts = function(parts) - return funcs.luaeval("{vim._expand_pat_get_parts(_A)}", parts) + return exec_lua("return {vim._expand_pat_get_parts(...)}", parts) end before_each(clear) describe('nlua_expand_pat', function() it('should complete exact matches', function() - eq({'exact'}, get_completions('exact', { exact = true })) + eq({{'exact'}, 0}, get_completions('exact', { exact = true })) end) it('should return empty table when nothing matches', function() - eq({}, get_completions('foo', { bar = true })) + eq({{}, 0}, get_completions('foo', { bar = true })) end) it('should return nice completions with function call prefix', function() - eq({'print(FOO'}, get_completions('print(F', { FOO = true, bawr = true })) + eq({{'FOO'}, 6}, get_completions('print(F', { FOO = true, bawr = true })) end) it('should return keys for nested dictionaries', function() eq( - { - 'vim.api.nvim_buf_set_lines', - 'vim.api.nvim_buf_set_option' + {{ + 'nvim_buf_set_lines', + 'nvim_buf_set_option' + }, 8 }, get_completions('vim.api.nvim_buf_', { vim = { @@ -49,9 +50,10 @@ describe('nlua_expand_pat', function() it('it should work with colons', function() eq( - { - 'MyClass:bawr', - 'MyClass:baz', + {{ + 'bawr', + 'baz', + }, 8 }, get_completions('MyClass:b', { MyClass = { @@ -65,9 +67,10 @@ describe('nlua_expand_pat', function() it('should return keys for string reffed dictionaries', function() eq( - { - 'vim["api"].nvim_buf_set_lines', - 'vim["api"].nvim_buf_set_option' + {{ + 'nvim_buf_set_lines', + 'nvim_buf_set_option' + }, 11 }, get_completions('vim["api"].nvim_buf_', { vim = { @@ -84,9 +87,10 @@ describe('nlua_expand_pat', function() it('should return keys for string reffed dictionaries', function() eq( - { - 'vim["nested"]["api"].nvim_buf_set_lines', - 'vim["nested"]["api"].nvim_buf_set_option' + {{ + 'nvim_buf_set_lines', + 'nvim_buf_set_option' + }, 21 }, get_completions('vim["nested"]["api"].nvim_buf_', { vim = { @@ -105,9 +109,10 @@ describe('nlua_expand_pat', function() it('should be able to interpolate globals', function() eq( - { - 'vim[MY_VAR].nvim_buf_set_lines', - 'vim[MY_VAR].nvim_buf_set_option' + {{ + 'nvim_buf_set_lines', + 'nvim_buf_set_option' + }, 12 }, get_completions('vim[MY_VAR].nvim_buf_', { MY_VAR = "api", @@ -124,7 +129,7 @@ describe('nlua_expand_pat', function() end) it('should return everything if the input is of length 0', function() - eq({"other", "vim"}, get_completions('', { vim = true, other = true })) + eq({{"other", "vim"}, 0}, get_completions('', { vim = true, other = true })) end) describe('get_parts', function() |