aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLucas Hoffmann <l-m-h@web.de>2015-05-05 10:29:21 +0200
committerJustin M. Keyes <justinkz@gmail.com>2015-05-27 12:31:09 -0400
commitbc27c9e8d1630e3170b5ea5a87c7ae06a231b058 (patch)
tree1aead5cfa9ffbffb309f1075b7436ae3dd94870b /test
parenta4c22c95e34080b7c9d0d704f1850dd109346622 (diff)
downloadrneovim-bc27c9e8d1630e3170b5ea5a87c7ae06a231b058.tar.gz
rneovim-bc27c9e8d1630e3170b5ea5a87c7ae06a231b058.tar.bz2
rneovim-bc27c9e8d1630e3170b5ea5a87c7ae06a231b058.zip
tests: Migrate legacy test 76. #2711
Diffstat (limited to 'test')
-rw-r--r--test/functional/legacy/076_completefunc_spec.lua68
1 files changed, 68 insertions, 0 deletions
diff --git a/test/functional/legacy/076_completefunc_spec.lua b/test/functional/legacy/076_completefunc_spec.lua
new file mode 100644
index 0000000000..8af3be003e
--- /dev/null
+++ b/test/functional/legacy/076_completefunc_spec.lua
@@ -0,0 +1,68 @@
+-- Tests for completefunc/omnifunc.
+
+local helpers = require('test.functional.helpers')
+local feed, insert, source = helpers.feed, helpers.insert, helpers.source
+local clear, expect, execute = helpers.clear, helpers.expect, helpers.execute
+
+describe('completefunc', function()
+ setup(clear)
+
+ it('is working', function()
+ insert([=[
+ +++
+ one
+ two
+ three]=])
+
+ -- Test that nothing happens if the 'completefunc' opens
+ -- a new window (no completion, no crash).
+ source([=[
+ function! DummyCompleteOne(findstart, base)
+ if a:findstart
+ return 0
+ else
+ wincmd n
+ return ['onedef', 'oneDEF']
+ endif
+ endfunction
+ setlocal completefunc=DummyCompleteOne
+ /^one
+ ]=])
+ feed('A<C-X><C-U><C-N><esc>')
+ execute('q!')
+ source([=[
+ function! DummyCompleteTwo(findstart, base)
+ if a:findstart
+ wincmd n
+ return 0
+ else
+ return ['twodef', 'twoDEF']
+ endif
+ endfunction
+ setlocal completefunc=DummyCompleteTwo
+ /^two
+ ]=])
+ feed('A<C-X><C-U><C-N><esc>')
+ execute('q!')
+ -- Test that 'completefunc' works when it's OK.
+ source([=[
+ function! DummyCompleteThree(findstart, base)
+ if a:findstart
+ return 0
+ else
+ return ['threedef', 'threeDEF']
+ endif
+ endfunction
+ setlocal completefunc=DummyCompleteThree
+ /^three
+ ]=])
+ feed('A<C-X><C-U><C-N><esc>')
+
+ -- Assert buffer contents.
+ expect([=[
+ +++
+
+ two
+ threeDEF]=])
+ end)
+end)