aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy/packadd_spec.lua
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2016-05-02 21:15:57 -0400
committerJames McCoy <jamessan@jamessan.com>2016-07-08 01:43:36 -0400
commit85e539c99609cec0b5a0eab3aded394d0bbab555 (patch)
tree0c0b84a962abcaab753d6a7d150b07800a10255d /test/functional/legacy/packadd_spec.lua
parent5f3813daf4e68a354800bdf553e75899cf24afba (diff)
downloadrneovim-85e539c99609cec0b5a0eab3aded394d0bbab555.tar.gz
rneovim-85e539c99609cec0b5a0eab3aded394d0bbab555.tar.bz2
rneovim-85e539c99609cec0b5a0eab3aded394d0bbab555.zip
vim-patch:7.4.1492
Problem: No command line completion for ":packadd". Solution: Implement completion. (Hirohito Higashi) https://github.com/vim/vim/commit/35ca0e7a1cb6e6daef8e0052a8437801226cef19
Diffstat (limited to 'test/functional/legacy/packadd_spec.lua')
-rw-r--r--test/functional/legacy/packadd_spec.lua64
1 files changed, 63 insertions, 1 deletions
diff --git a/test/functional/legacy/packadd_spec.lua b/test/functional/legacy/packadd_spec.lua
index 94b5336b9f..9ca7c4e723 100644
--- a/test/functional/legacy/packadd_spec.lua
+++ b/test/functional/legacy/packadd_spec.lua
@@ -1,8 +1,9 @@
-- Tests for 'packpath' and :packadd
local helpers = require('test.functional.helpers')(after_each)
-local clear, source = helpers.clear, helpers.source
+local clear, source, execute = helpers.clear, helpers.source, helpers.execute
local call, eq, nvim = helpers.call, helpers.eq, helpers.meths
+local feed = helpers.feed
local function expected_empty()
eq({}, nvim.get_vvar('errors'))
@@ -85,4 +86,65 @@ describe('packadd', function()
call('Test_packadd_noload')
expected_empty()
end)
+
+ describe('command line completion', function()
+ local Screen = require('test.functional.ui.screen')
+ local screen
+
+ before_each(function()
+ screen = Screen.new(30, 5)
+ screen:attach()
+ screen:set_default_attr_ids({
+ [1] = {
+ foreground = Screen.colors.Black,
+ background = Screen.colors.Yellow,
+ },
+ [2] = {bold = true, reverse = true}
+ })
+ local NonText = Screen.colors.Blue
+ screen:set_default_attr_ignore({{}, {bold=true, foreground=NonText}})
+
+ execute([[let optdir1 = &packpath . '/pack/mine/opt']])
+ execute([[let optdir2 = &packpath . '/pack/candidate/opt']])
+ execute([[call mkdir(optdir1 . '/pluginA', 'p')]])
+ execute([[call mkdir(optdir1 . '/pluginC', 'p')]])
+ execute([[call mkdir(optdir2 . '/pluginB', 'p')]])
+ execute([[call mkdir(optdir2 . '/pluginC', 'p')]])
+ end)
+
+ it('works', function()
+ feed(':packadd <Tab>')
+ screen:expect([=[
+ |
+ ~ |
+ ~ |
+ {1:pluginA}{2: pluginB pluginC }|
+ :packadd pluginA^ |
+ ]=])
+ feed('<Tab>')
+ screen:expect([=[
+ |
+ ~ |
+ ~ |
+ {2:pluginA }{1:pluginB}{2: pluginC }|
+ :packadd pluginB^ |
+ ]=])
+ feed('<Tab>')
+ screen:expect([=[
+ |
+ ~ |
+ ~ |
+ {2:pluginA pluginB }{1:pluginC}{2: }|
+ :packadd pluginC^ |
+ ]=])
+ feed('<Tab>')
+ screen:expect([=[
+ |
+ ~ |
+ ~ |
+ {2:pluginA pluginB pluginC }|
+ :packadd ^ |
+ ]=])
+ end)
+ end)
end)