mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
test(old): remove python2 tests (#23547)
Because python2 provider is no longer supported.
This commit is contained in:
parent
44fc2a6d7e
commit
84378c4dd5
@ -212,7 +212,7 @@ preprocess_patch() {
|
|||||||
2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/testdir/\<\%('"${na_src_testdir}"'\)\>@norm! d/\v(^diff)|%$
' +w +q "$file"
|
2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/testdir/\<\%('"${na_src_testdir}"'\)\>@norm! d/\v(^diff)|%$
' +w +q "$file"
|
||||||
|
|
||||||
# Remove testdir/test_*.vim files
|
# Remove testdir/test_*.vim files
|
||||||
local na_src_testdir='balloon.*\|behave\.vim\|channel.*\|crypt\.vim\|cscope\.vim\|gui.*\|hardcopy\.vim\|job_fails\.vim\|json\.vim\|mzscheme\.vim\|netbeans.*\|paste\.vim\|popupwin.*\|restricted\.vim\|shortpathname\.vim\|tcl\.vim\|terminal.*\|xxd\.vim'
|
local na_src_testdir='balloon.*\|behave\.vim\|channel.*\|crypt\.vim\|cscope\.vim\|gui.*\|hardcopy\.vim\|job_fails\.vim\|json\.vim\|mzscheme\.vim\|netbeans.*\|paste\.vim\|popupwin.*\|python2\.vim\|pyx2\.vim\|restricted\.vim\|shortpathname\.vim\|tcl\.vim\|terminal.*\|xxd\.vim'
|
||||||
2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/testdir/\<test_\%('"${na_src_testdir}"'\)\>@norm! d/\v(^diff)|%$
' +w +q "$file"
|
2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/testdir/\<test_\%('"${na_src_testdir}"'\)\>@norm! d/\v(^diff)|%$
' +w +q "$file"
|
||||||
|
|
||||||
# Remove version.c #7555
|
# Remove version.c #7555
|
||||||
|
@ -8654,7 +8654,7 @@ bool eval_has_provider(const char *feat)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
char name[32]; // Normalized: "python_compiled" => "python".
|
char name[32]; // Normalized: "python3_compiled" => "python3".
|
||||||
snprintf(name, sizeof(name), "%s", feat);
|
snprintf(name, sizeof(name), "%s", feat);
|
||||||
strchrsub(name, '_', '\0'); // Chop any "_xx" suffix.
|
strchrsub(name, '_', '\0'); // Chop any "_xx" suffix.
|
||||||
|
|
||||||
|
@ -1,195 +0,0 @@
|
|||||||
" Test for python 2 commands.
|
|
||||||
" TODO: move tests from test86.in here.
|
|
||||||
|
|
||||||
source check.vim
|
|
||||||
CheckFeature python
|
|
||||||
|
|
||||||
func Test_pydo()
|
|
||||||
" Check deleting lines does not trigger ml_get error.
|
|
||||||
py import vim
|
|
||||||
new
|
|
||||||
call setline(1, ['one', 'two', 'three'])
|
|
||||||
pydo vim.command("%d_")
|
|
||||||
bwipe!
|
|
||||||
|
|
||||||
" Disabled until neovim/neovim#8554 is resolved
|
|
||||||
if 0
|
|
||||||
" Check switching to another buffer does not trigger ml_get error.
|
|
||||||
new
|
|
||||||
let wincount = winnr('$')
|
|
||||||
call setline(1, ['one', 'two', 'three'])
|
|
||||||
pydo vim.command("new")
|
|
||||||
call assert_equal(wincount + 1, winnr('$'))
|
|
||||||
bwipe!
|
|
||||||
bwipe!
|
|
||||||
endif
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
func Test_set_cursor()
|
|
||||||
" Check that setting the cursor position works.
|
|
||||||
py import vim
|
|
||||||
new
|
|
||||||
call setline(1, ['first line', 'second line'])
|
|
||||||
normal gg
|
|
||||||
pydo vim.current.window.cursor = (1, 5)
|
|
||||||
call assert_equal([1, 6], [line('.'), col('.')])
|
|
||||||
|
|
||||||
" Check that movement after setting cursor position keeps current column.
|
|
||||||
normal j
|
|
||||||
call assert_equal([2, 6], [line('.'), col('.')])
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
func Test_vim_function()
|
|
||||||
throw 'Skipped: Nvim does not support vim.bindeval()'
|
|
||||||
" Check creating vim.Function object
|
|
||||||
py import vim
|
|
||||||
|
|
||||||
func s:foo()
|
|
||||||
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+_foo$')
|
|
||||||
endfunc
|
|
||||||
let name = '<SNR>' . s:foo()
|
|
||||||
|
|
||||||
try
|
|
||||||
py f = vim.bindeval('function("s:foo")')
|
|
||||||
call assert_equal(name, pyeval('f.name'))
|
|
||||||
catch
|
|
||||||
call assert_false(v:exception)
|
|
||||||
endtry
|
|
||||||
|
|
||||||
try
|
|
||||||
py f = vim.Function('\x80\xfdR' + vim.eval('s:foo()'))
|
|
||||||
call assert_equal(name, 'f.name'->pyeval())
|
|
||||||
catch
|
|
||||||
call assert_false(v:exception)
|
|
||||||
endtry
|
|
||||||
|
|
||||||
py del f
|
|
||||||
delfunc s:foo
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
func Test_skipped_python_command_does_not_affect_pyxversion()
|
|
||||||
set pyxversion=0
|
|
||||||
if 0
|
|
||||||
python import vim
|
|
||||||
endif
|
|
||||||
call assert_equal(0, &pyxversion) " This assertion would have failed with Vim 8.0.0251. (pyxversion was introduced in 8.0.0251.)
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
func _SetUpHiddenBuffer()
|
|
||||||
py import vim
|
|
||||||
new
|
|
||||||
edit hidden
|
|
||||||
setlocal bufhidden=hide
|
|
||||||
|
|
||||||
enew
|
|
||||||
let lnum = 0
|
|
||||||
while lnum < 10
|
|
||||||
call append( 1, string( lnum ) )
|
|
||||||
let lnum = lnum + 1
|
|
||||||
endwhile
|
|
||||||
normal G
|
|
||||||
|
|
||||||
call assert_equal( line( '.' ), 11 )
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
func _CleanUpHiddenBuffer()
|
|
||||||
bwipe! hidden
|
|
||||||
bwipe!
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
func Test_Write_To_HiddenBuffer_Does_Not_Fix_Cursor_Clear()
|
|
||||||
call _SetUpHiddenBuffer()
|
|
||||||
py vim.buffers[ int( vim.eval( 'bufnr("hidden")' ) ) ][:] = None
|
|
||||||
call assert_equal( line( '.' ), 11 )
|
|
||||||
call _CleanUpHiddenBuffer()
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
func Test_Write_To_HiddenBuffer_Does_Not_Fix_Cursor_List()
|
|
||||||
call _SetUpHiddenBuffer()
|
|
||||||
py vim.buffers[ int( vim.eval( 'bufnr("hidden")' ) ) ][:] = [ 'test' ]
|
|
||||||
call assert_equal( line( '.' ), 11 )
|
|
||||||
call _CleanUpHiddenBuffer()
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
func Test_Write_To_HiddenBuffer_Does_Not_Fix_Cursor_Str()
|
|
||||||
call _SetUpHiddenBuffer()
|
|
||||||
py vim.buffers[ int( vim.eval( 'bufnr("hidden")' ) ) ][0] = 'test'
|
|
||||||
call assert_equal( line( '.' ), 11 )
|
|
||||||
call _CleanUpHiddenBuffer()
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
func Test_Write_To_HiddenBuffer_Does_Not_Fix_Cursor_ClearLine()
|
|
||||||
call _SetUpHiddenBuffer()
|
|
||||||
py vim.buffers[ int( vim.eval( 'bufnr("hidden")' ) ) ][0] = None
|
|
||||||
call assert_equal( line( '.' ), 11 )
|
|
||||||
call _CleanUpHiddenBuffer()
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
func _SetUpVisibleBuffer()
|
|
||||||
py import vim
|
|
||||||
new
|
|
||||||
let lnum = 0
|
|
||||||
while lnum < 10
|
|
||||||
call append( 1, string( lnum ) )
|
|
||||||
let lnum = lnum + 1
|
|
||||||
endwhile
|
|
||||||
normal G
|
|
||||||
call assert_equal( line( '.' ), 11 )
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
func Test_Write_To_Current_Buffer_Fixes_Cursor_Clear()
|
|
||||||
call _SetUpVisibleBuffer()
|
|
||||||
|
|
||||||
py vim.current.buffer[:] = None
|
|
||||||
call assert_equal( line( '.' ), 1 )
|
|
||||||
|
|
||||||
bwipe!
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
func Test_Write_To_Current_Buffer_Fixes_Cursor_List()
|
|
||||||
call _SetUpVisibleBuffer()
|
|
||||||
|
|
||||||
py vim.current.buffer[:] = [ 'test' ]
|
|
||||||
call assert_equal( line( '.' ), 1 )
|
|
||||||
|
|
||||||
bwipe!
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
func Test_Write_To_Current_Buffer_Fixes_Cursor_Str()
|
|
||||||
call _SetUpVisibleBuffer()
|
|
||||||
|
|
||||||
py vim.current.buffer[-1] = None
|
|
||||||
call assert_equal( line( '.' ), 10 )
|
|
||||||
|
|
||||||
bwipe!
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
func Test_Catch_Exception_Message()
|
|
||||||
try
|
|
||||||
py raise RuntimeError( 'TEST' )
|
|
||||||
catch /.*/
|
|
||||||
call assert_match('^Vim(.*):.*RuntimeError: TEST$', v:exception )
|
|
||||||
endtry
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
" Test for various heredoc syntax
|
|
||||||
func Test_python_heredoc()
|
|
||||||
python << END
|
|
||||||
s='A'
|
|
||||||
END
|
|
||||||
python <<
|
|
||||||
s+='B'
|
|
||||||
.
|
|
||||||
python << trim END
|
|
||||||
s+='C'
|
|
||||||
END
|
|
||||||
python << trim
|
|
||||||
s+='D'
|
|
||||||
.
|
|
||||||
python << trim eof
|
|
||||||
s+='E'
|
|
||||||
eof
|
|
||||||
call assert_equal('ABCDE', pyxeval('s'))
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
|
@ -1,103 +0,0 @@
|
|||||||
" Test for pyx* commands and functions with Python 2.
|
|
||||||
|
|
||||||
source check.vim
|
|
||||||
CheckFeature python
|
|
||||||
set pyx=2
|
|
||||||
|
|
||||||
let s:py2pattern = '^2\.[0-7]\.\d\+'
|
|
||||||
let s:py3pattern = '^3\.\d\+\.\d\+'
|
|
||||||
|
|
||||||
|
|
||||||
func Test_has_pythonx()
|
|
||||||
call assert_true(has('pythonx'))
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
|
|
||||||
func Test_pyx()
|
|
||||||
redir => var
|
|
||||||
pyx << trim EOF
|
|
||||||
import sys
|
|
||||||
print(sys.version)
|
|
||||||
EOF
|
|
||||||
redir END
|
|
||||||
call assert_match(s:py2pattern, split(var)[0])
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
|
|
||||||
func Test_pyxdo()
|
|
||||||
pyx import sys
|
|
||||||
enew
|
|
||||||
pyxdo return sys.version.split("\n")[0]
|
|
||||||
call assert_match(s:py2pattern, split(getline('.'))[0])
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
|
|
||||||
func Test_pyxeval()
|
|
||||||
pyx import sys
|
|
||||||
call assert_match(s:py2pattern, split('sys.version'->pyxeval())[0])
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
|
|
||||||
func Test_pyxfile()
|
|
||||||
" No special comments nor shebangs
|
|
||||||
redir => var
|
|
||||||
pyxfile pyxfile/pyx.py
|
|
||||||
redir END
|
|
||||||
call assert_match(s:py2pattern, split(var)[0])
|
|
||||||
|
|
||||||
" Python 2 special comment
|
|
||||||
redir => var
|
|
||||||
pyxfile pyxfile/py2_magic.py
|
|
||||||
redir END
|
|
||||||
call assert_match(s:py2pattern, split(var)[0])
|
|
||||||
|
|
||||||
" Python 2 shebang
|
|
||||||
redir => var
|
|
||||||
pyxfile pyxfile/py2_shebang.py
|
|
||||||
redir END
|
|
||||||
call assert_match(s:py2pattern, split(var)[0])
|
|
||||||
|
|
||||||
if has('python3')
|
|
||||||
" Python 3 special comment
|
|
||||||
redir => var
|
|
||||||
pyxfile pyxfile/py3_magic.py
|
|
||||||
redir END
|
|
||||||
call assert_match(s:py3pattern, split(var)[0])
|
|
||||||
|
|
||||||
" Python 3 shebang
|
|
||||||
redir => var
|
|
||||||
pyxfile pyxfile/py3_shebang.py
|
|
||||||
redir END
|
|
||||||
call assert_match(s:py3pattern, split(var)[0])
|
|
||||||
endif
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
func Test_Catch_Exception_Message()
|
|
||||||
try
|
|
||||||
pyx raise RuntimeError( 'TEST' )
|
|
||||||
catch /.*/
|
|
||||||
call assert_match('^Vim(.*):.*RuntimeError: TEST$', v:exception )
|
|
||||||
endtry
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
" Test for various heredoc syntaxes
|
|
||||||
func Test_pyx2_heredoc()
|
|
||||||
pyx << END
|
|
||||||
result='A'
|
|
||||||
END
|
|
||||||
pyx <<
|
|
||||||
result+='B'
|
|
||||||
.
|
|
||||||
pyx << trim END
|
|
||||||
result+='C'
|
|
||||||
END
|
|
||||||
pyx << trim
|
|
||||||
result+='D'
|
|
||||||
.
|
|
||||||
pyx << trim eof
|
|
||||||
result+='E'
|
|
||||||
eof
|
|
||||||
call assert_equal('ABCDE', pyxeval('result'))
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
|
Loading…
Reference in New Issue
Block a user