mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 22:18:33 +00:00
tests: Migrate legacy test 76. #2711
This commit is contained in:

committed by
Justin M. Keyes

parent
a4c22c95e3
commit
bc27c9e8d1
@@ -24,7 +24,7 @@ SCRIPTS := test_autoformat_join.out \
|
|||||||
test61.out test62.out test63.out test64.out test65.out \
|
test61.out test62.out test63.out test64.out test65.out \
|
||||||
test68.out test69.out \
|
test68.out test69.out \
|
||||||
test71.out test73.out test74.out \
|
test71.out test73.out test74.out \
|
||||||
test76.out test79.out test80.out \
|
test79.out test80.out \
|
||||||
test82.out test83.out \
|
test82.out test83.out \
|
||||||
test86.out test87.out test88.out \
|
test86.out test87.out test88.out \
|
||||||
test_listlbr.out \
|
test_listlbr.out \
|
||||||
|
@@ -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
|
|
@@ -1,4 +0,0 @@
|
|||||||
+++
|
|
||||||
|
|
||||||
two
|
|
||||||
threeDEF
|
|
68
test/functional/legacy/076_completefunc_spec.lua
Normal file
68
test/functional/legacy/076_completefunc_spec.lua
Normal file
@@ -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)
|
Reference in New Issue
Block a user