forked from VimPlug/jedi-vim
Merge pull request #864 from blueyed/nvim (neovim testing)
Testing is now alow possible with Neovim
This commit is contained in:
11
.travis.yml
11
.travis.yml
@@ -5,11 +5,20 @@ env:
|
|||||||
matrix:
|
matrix:
|
||||||
- ENV=test
|
- ENV=test
|
||||||
- ENV=check
|
- ENV=check
|
||||||
|
- ENV=test_nvim
|
||||||
install:
|
install:
|
||||||
- |
|
- |
|
||||||
if [ "$ENV" = "test" ]; then
|
if [ "$ENV" = "test" ]; then
|
||||||
python3.6 -m pip install pytest
|
python3.6 -m pip install pytest
|
||||||
fi
|
fi
|
||||||
|
- |
|
||||||
|
# https://github.com/neovim/bot-ci#generated-builds
|
||||||
|
if [ "$ENV" = "test_nvim" ]; then
|
||||||
|
eval "$(curl -Ss https://raw.githubusercontent.com/neovim/bot-ci/master/scripts/travis-setup.sh) nightly-x64"
|
||||||
|
pip --version
|
||||||
|
pip install neovim
|
||||||
|
else
|
||||||
|
vim --version
|
||||||
|
fi
|
||||||
script:
|
script:
|
||||||
- vim --version
|
|
||||||
- make --keep-going "$ENV"
|
- make --keep-going "$ENV"
|
||||||
|
|||||||
3
Makefile
3
Makefile
@@ -1,6 +1,9 @@
|
|||||||
test:
|
test:
|
||||||
pytest test_*.py
|
pytest test_*.py
|
||||||
|
|
||||||
|
test_nvim:
|
||||||
|
VSPEC_VIM=nvim pytest test_*.py
|
||||||
|
|
||||||
build:
|
build:
|
||||||
mkdir $@
|
mkdir $@
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,20 @@ describe 'completions'
|
|||||||
bd!
|
bd!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'longest in completeopt'
|
||||||
|
" This gets set up with Vim only on VimEnter.
|
||||||
|
if has('nvim')
|
||||||
|
Expect stridx(&completeopt, 'longest') > -1
|
||||||
|
else
|
||||||
|
Expect stridx(&completeopt, 'longest') == -1
|
||||||
|
doautocmd VimEnter
|
||||||
|
Expect stridx(&completeopt, 'longest') > -1
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Do not use it for following tests.
|
||||||
|
set completeopt-=longest
|
||||||
|
end
|
||||||
|
|
||||||
it 'smart import'
|
it 'smart import'
|
||||||
exec "normal ifrom os "
|
exec "normal ifrom os "
|
||||||
Expect getline('.') == 'from os import '
|
Expect getline('.') == 'from os import '
|
||||||
@@ -35,20 +49,35 @@ describe 'completions'
|
|||||||
it 'exception'
|
it 'exception'
|
||||||
normal oIndentationErrX
|
normal oIndentationErrX
|
||||||
Expect getline('.') == 'IndentationError'
|
Expect getline('.') == 'IndentationError'
|
||||||
normal a().filenaX
|
|
||||||
|
" Do not remap keys (".") here, otherwise this triggers completion in
|
||||||
|
" Neovim already.
|
||||||
|
normal! a().filena
|
||||||
|
|
||||||
|
normal aX
|
||||||
Expect getline('.') == 'IndentationError().filename'
|
Expect getline('.') == 'IndentationError().filename'
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'multi complete'
|
it 'multi complete'
|
||||||
|
" NOTE: nvim results in "importErr()" here with completeopt+=longest,
|
||||||
|
" but Vim is fine.
|
||||||
|
" This is due to `pumvisible()` in jedi#complete_opened being true
|
||||||
|
" with nvim still, but it is 0 with Vim, i.e. Vim appears to close
|
||||||
|
" the pum already (with the tests).
|
||||||
|
"
|
||||||
|
" This might be a misunderstanding though, since the test might not
|
||||||
|
" expect the "import" keyword to be offered for completion?!
|
||||||
normal oImpXErrX()
|
normal oImpXErrX()
|
||||||
Expect getline('.') == 'ImportError()'
|
Expect getline('.') == 'ImportError()'
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'cycling through entries popup_select_first=0'
|
it 'cycling through entries popup_select_first=0'
|
||||||
|
set completeopt+=longest
|
||||||
let g:jedi#popup_select_first = 0
|
let g:jedi#popup_select_first = 0
|
||||||
execute "normal oraise impX\<C-n>"
|
execute "normal oraise impX\<C-n>"
|
||||||
" It looks like this is currently not working properly.
|
|
||||||
"Expect getline('.') == 'raise ImportError'
|
Expect getline('.') == 'raise ImportError'
|
||||||
|
set completeopt-=longest
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'cycling through entries popup_select_first=1'
|
it 'cycling through entries popup_select_first=1'
|
||||||
@@ -56,12 +85,27 @@ describe 'completions'
|
|||||||
Expect getline('.') == 'raise ImportWarning'
|
Expect getline('.') == 'raise ImportWarning'
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'longest'
|
it 'cycling through entries popup_select_first=1 and longest'
|
||||||
" -longest completes the first one
|
set completeopt+=longest
|
||||||
set completeopt -=longest
|
execute "normal oraise impX"
|
||||||
execute "normal oraise baseX"
|
Expect getline('.') == 'raise Import'
|
||||||
Expect getline('.') == 'raise BaseException'
|
|
||||||
set completeopt +=longest
|
" With Neovim pumvisible() is 1 in jedi#complete_opened, which then
|
||||||
|
" triggers the <Down>. This is not the case with Vim.
|
||||||
|
if has('nvim')
|
||||||
|
execute "normal oraise impX\<C-n>"
|
||||||
|
Expect getline('.') == 'raise ImportWarning'
|
||||||
|
|
||||||
|
execute "normal oraise impX\<C-n>\<C-n>"
|
||||||
|
Expect getline('.') == 'raise imp'
|
||||||
|
else
|
||||||
|
execute "normal oraise impX\<C-n>"
|
||||||
|
Expect getline('.') == 'raise ImportError'
|
||||||
|
|
||||||
|
execute "normal oraise impX\<C-n>\<C-n>"
|
||||||
|
Expect getline('.') == 'raise ImportWarning'
|
||||||
|
endif
|
||||||
|
set completeopt-=longest
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -94,10 +94,10 @@ describe 'signatures'
|
|||||||
return msg
|
return msg
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let funcname = repeat('a', &columns - 30)
|
let funcname = repeat('a', &columns - (30 + (&ruler ? 18 : 0)))
|
||||||
put = 'def '.funcname.'(arg1, arg2, arg3, a, b, c):'
|
put = 'def '.funcname.'(arg1, arg2, arg3, a, b, c):'
|
||||||
put = ' pass'
|
put = ' pass'
|
||||||
execute "normal o".funcname."( "
|
execute "normal o\<BS>".funcname."( "
|
||||||
Expect Signature() == "\n".funcname."(arg1, …)"
|
Expect Signature() == "\n".funcname."(arg1, …)"
|
||||||
|
|
||||||
exe 'normal sarg1, '
|
exe 'normal sarg1, '
|
||||||
@@ -112,7 +112,7 @@ describe 'signatures'
|
|||||||
g/^/d
|
g/^/d
|
||||||
put = 'def '.funcname.'('.repeat('b', 20).', arg2):'
|
put = 'def '.funcname.'('.repeat('b', 20).', arg2):'
|
||||||
put = ' pass'
|
put = ' pass'
|
||||||
execute "normal o".funcname."( "
|
execute "normal o\<BS>".funcname."( "
|
||||||
Expect Signature() == "\n".funcname."(…)"
|
Expect Signature() == "\n".funcname."(…)"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user