aboutsummaryrefslogtreecommitdiff
path: root/test/functional/viml/completion_spec.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2016-02-13 15:22:12 -0500
committerJustin M. Keyes <justinkz@gmail.com>2016-02-13 15:22:12 -0500
commit364d764889c6611a4ecf6aea4fbe71715df23e73 (patch)
treeb1255caf5d101cf5bedc0edccc810ae57348d2a2 /test/functional/viml/completion_spec.lua
parentf03ab69a35b4ecf27ad4e44643b5e63b29e0b7b6 (diff)
parent7567afbbe50ad82880fdc07b90e892e7d8bb9198 (diff)
downloadrneovim-364d764889c6611a4ecf6aea4fbe71715df23e73.tar.gz
rneovim-364d764889c6611a4ecf6aea4fbe71715df23e73.tar.bz2
rneovim-364d764889c6611a4ecf6aea4fbe71715df23e73.zip
Merge #2674
Diffstat (limited to 'test/functional/viml/completion_spec.lua')
-rw-r--r--test/functional/viml/completion_spec.lua43
1 files changed, 42 insertions, 1 deletions
diff --git a/test/functional/viml/completion_spec.lua b/test/functional/viml/completion_spec.lua
index 12f542de7f..4bb9707cda 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')
local clear, feed = helpers.clear, helpers.feed
local eval, eq, neq = helpers.eval, helpers.eq, helpers.neq
-local execute, source = helpers.execute, helpers.source
+local execute, source, expect = helpers.execute, helpers.source, helpers.expect
describe('completion', function()
before_each(function()
@@ -100,4 +100,45 @@ describe('completion', function()
eq('', eval('getline(3)'))
end)
end)
+
+ describe("refresh:always", function()
+ before_each(function()
+ source([[
+ function! TestCompletion(findstart, base) abort
+ if a:findstart
+ let line = getline('.')
+ let start = col('.') - 1
+ while start > 0 && line[start - 1] =~ '\a'
+ let start -= 1
+ endwhile
+ return start
+ else
+ let ret = []
+ for m in split("January February March April May June July August September October November December")
+ if m =~ a:base " match by regex
+ call add(ret, m)
+ endif
+ endfor
+ return {'words':ret, 'refresh':'always'}
+ endif
+ endfunction
+
+ set completeopt=menuone,noselect
+ set completefunc=TestCompletion
+ ]])
+ end )
+
+ it('completes on each input char', function ()
+ feed('i<C-x><C-u>gu<Down><C-y>')
+ expect('August')
+ end)
+ it("repeats correctly after backspace #2674", function ()
+ feed('o<C-x><C-u>Ja<BS><C-n><C-n><Esc>')
+ feed('.')
+ expect([[
+
+ June
+ June]])
+ end)
+ end)
end)