diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-12-22 18:59:06 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-12-22 18:59:06 +0100 |
commit | 9123c0b31a283f460ed2b6af95080120cf528118 (patch) | |
tree | 275e918901c144e4bfcea65dc761f86f7da27d35 /src/testdir/test_python3.vim | |
parent | 4814ccbdf0e99e2d33e1ac926c59f677f5c2afe2 (diff) | |
download | vim-git-9123c0b31a283f460ed2b6af95080120cf528118.tar.gz |
patch 8.1.0627: Python cannot handle function name of script-local functionv8.1.0627
Problem: Python cannot handle function name of script-local function.
Solution: Use <SNR> instead of the special byte code. (Ozaki Kiichi, closes
#3681)
Diffstat (limited to 'src/testdir/test_python3.vim')
-rw-r--r-- | src/testdir/test_python3.vim | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/testdir/test_python3.vim b/src/testdir/test_python3.vim index 69ad80213..344034af0 100644 --- a/src/testdir/test_python3.vim +++ b/src/testdir/test_python3.vim @@ -36,3 +36,30 @@ func Test_set_cursor() normal j call assert_equal([2, 6], [line('.'), col('.')]) endfunc + +func Test_vim_function() + " Check creating vim.Function object + py3 import vim + + func s:foo() + return matchstr(expand('<sfile>'), '<SNR>\zs\d\+_foo$') + endfunc + let name = '<SNR>' . s:foo() + + try + py3 f = vim.bindeval('function("s:foo")') + call assert_equal(name, py3eval('f.name')) + catch + call assert_false(v:exception) + endtry + + try + py3 f = vim.Function(b'\x80\xfdR' + vim.eval('s:foo()').encode()) + call assert_equal(name, py3eval('f.name')) + catch + call assert_false(v:exception) + endtry + + py3 del f + delfunc s:foo +endfunc |