aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/testdir/Makefile2
-rw-r--r--src/nvim/testdir/test76.in46
-rw-r--r--src/nvim/testdir/test76.ok4
-rw-r--r--test/functional/legacy/076_completefunc_spec.lua68
4 files changed, 69 insertions, 51 deletions
diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile
index bc5b03727e..b95f6b4499 100644
--- a/src/nvim/testdir/Makefile
+++ b/src/nvim/testdir/Makefile
@@ -24,7 +24,7 @@ SCRIPTS := test_autoformat_join.out \
test61.out test62.out test63.out test64.out test65.out \
test68.out test69.out \
test71.out test73.out test74.out \
- test76.out test79.out test80.out \
+ test79.out test80.out \
test82.out test83.out \
test86.out test87.out test88.out \
test_listlbr.out \
diff --git a/src/nvim/testdir/test76.in b/src/nvim/testdir/test76.in
deleted file mode 100644
index db7ebe2169..0000000000
--- a/src/nvim/testdir/test76.in
+++ /dev/null
@@ -1,46 +0,0 @@
-Tests for completefunc/omnifunc. vim: set ft=vim :
-
-STARTTEST
-:"Test that nothing happens if the 'completefunc' opens
-:"a new window (no completion, no crash)
-:so small.vim
-:function! DummyCompleteOne(findstart, base)
-: if a:findstart
-: return 0
-: else
-: wincmd n
-: return ['onedef', 'oneDEF']
-: endif
-:endfunction
-:setlocal completefunc=DummyCompleteOne
-/^one
-A:q!
-:function! DummyCompleteTwo(findstart, base)
-: if a:findstart
-: wincmd n
-: return 0
-: else
-: return ['twodef', 'twoDEF']
-: endif
-:endfunction
-:setlocal completefunc=DummyCompleteTwo
-/^two
-A:q!
-:"Test that 'completefunc' works when it's OK.
-:function! DummyCompleteThree(findstart, base)
-: if a:findstart
-: return 0
-: else
-: return ['threedef', 'threeDEF']
-: endif
-:endfunction
-:setlocal completefunc=DummyCompleteThree
-/^three
-A:/^+++/,/^three/w! test.out
-:qa!
-ENDTEST
-
-+++
-one
-two
-three
diff --git a/src/nvim/testdir/test76.ok b/src/nvim/testdir/test76.ok
deleted file mode 100644
index 2a70acbade..0000000000
--- a/src/nvim/testdir/test76.ok
+++ /dev/null
@@ -1,4 +0,0 @@
-+++
-
-two
-threeDEF
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)