aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/vim-patch.sh2
-rw-r--r--src/nvim/eval.c2
-rw-r--r--test/old/testdir/test_python2.vim195
-rw-r--r--test/old/testdir/test_pyx2.vim103
4 files changed, 2 insertions, 300 deletions
diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh
index 385005a442..df0af72fdb 100755
--- a/scripts/vim-patch.sh
+++ b/scripts/vim-patch.sh
@@ -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"
# 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"
# Remove version.c #7555
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index cb1f4d26fb..5c05b8faf7 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -8654,7 +8654,7 @@ bool eval_has_provider(const char *feat)
return false;
}
- char name[32]; // Normalized: "python_compiled" => "python".
+ char name[32]; // Normalized: "python3_compiled" => "python3".
snprintf(name, sizeof(name), "%s", feat);
strchrsub(name, '_', '\0'); // Chop any "_xx" suffix.
diff --git a/test/old/testdir/test_python2.vim b/test/old/testdir/test_python2.vim
deleted file mode 100644
index f21eb2c128..0000000000
--- a/test/old/testdir/test_python2.vim
+++ /dev/null
@@ -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
diff --git a/test/old/testdir/test_pyx2.vim b/test/old/testdir/test_pyx2.vim
deleted file mode 100644
index 74f4b187f0..0000000000
--- a/test/old/testdir/test_pyx2.vim
+++ /dev/null
@@ -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