summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_python3.vim
diff options
context:
space:
mode:
Diffstat (limited to 'src/testdir/test_python3.vim')
-rw-r--r--src/testdir/test_python3.vim27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/testdir/test_python3.vim b/src/testdir/test_python3.vim
index 69ad802131..344034af00 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