Mercurial > vim
comparison src/testdir/test_python2.vim @ 15234:ee63f4fe3d45 v8.1.0627
patch 8.1.0627: Python cannot handle function name of script-local function
commit https://github.com/vim/vim/commit/9123c0b31a283f460ed2b6af95080120cf528118
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Dec 22 18:59:06 2018 +0100
patch 8.1.0627: Python cannot handle function name of script-local function
Problem: Python cannot handle function name of script-local function.
Solution: Use <SNR> instead of the special byte code. (Ozaki Kiichi, closes
#3681)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 22 Dec 2018 19:00:06 +0100 |
parents | c15bef307de6 |
children | a83c4b1f8ea2 |
comparison
equal
deleted
inserted
replaced
15233:5e7515dbf871 | 15234:ee63f4fe3d45 |
---|---|
34 | 34 |
35 " Check that movement after setting cursor position keeps current column. | 35 " Check that movement after setting cursor position keeps current column. |
36 normal j | 36 normal j |
37 call assert_equal([2, 6], [line('.'), col('.')]) | 37 call assert_equal([2, 6], [line('.'), col('.')]) |
38 endfunc | 38 endfunc |
39 | |
40 func Test_vim_function() | |
41 " Check creating vim.Function object | |
42 py import vim | |
43 | |
44 func s:foo() | |
45 return matchstr(expand('<sfile>'), '<SNR>\zs\d\+_foo$') | |
46 endfunc | |
47 let name = '<SNR>' . s:foo() | |
48 | |
49 try | |
50 py f = vim.bindeval('function("s:foo")') | |
51 call assert_equal(name, pyeval('f.name')) | |
52 catch | |
53 call assert_false(v:exception) | |
54 endtry | |
55 | |
56 try | |
57 py f = vim.Function('\x80\xfdR' + vim.eval('s:foo()')) | |
58 call assert_equal(name, pyeval('f.name')) | |
59 catch | |
60 call assert_false(v:exception) | |
61 endtry | |
62 | |
63 py del f | |
64 delfunc s:foo | |
65 endfunc |