comparison src/testdir/test_vim9_import.vim @ 27362:2ca6dd1f62af v8.2.4209

patch 8.2.4209: partial in 'opfunc' cannot use an imported function Commit: https://github.com/vim/vim/commit/3e93a2b075e99a2b3ced85227a6373be233712ff Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jan 24 21:28:01 2022 +0000 patch 8.2.4209: partial in 'opfunc' cannot use an imported function Problem: partial in 'opfunc' cannot use an imported function. Solution: Also expand the function name in a partial. (closes https://github.com/vim/vim/issues/9614)
author Bram Moolenaar <Bram@vim.org>
date Mon, 24 Jan 2022 22:30:04 +0100
parents 9a9c34c84cd4
children 1a6421c5be20
comparison
equal deleted inserted replaced
27361:73508f35e8ab 27362:2ca6dd1f62af
671 bwipe! 671 bwipe!
672 delete('Xdir', 'rf') 672 delete('Xdir', 'rf')
673 &rtp = save_rtp 673 &rtp = save_rtp
674 enddef 674 enddef
675 675
676 def Test_use_autoload_import_partial_in_opfunc()
677 mkdir('Xdir/autoload', 'p')
678 var save_rtp = &rtp
679 exe 'set rtp^=' .. getcwd() .. '/Xdir'
680
681 var lines =<< trim END
682 vim9script
683 export def Opfunc(..._)
684 g:opfunc_called = 'yes'
685 enddef
686 END
687 writefile(lines, 'Xdir/autoload/opfunc.vim')
688
689 new
690 lines =<< trim END
691 vim9script
692 import autoload 'opfunc.vim'
693 nnoremap <expr> <F3> TheFunc()
694 def TheFunc(): string
695 &operatorfunc = function('opfunc.Opfunc', [0])
696 return 'g@'
697 enddef
698 feedkeys("\<F3>l", 'xt')
699 assert_equal('yes', g:opfunc_called)
700 END
701 CheckScriptSuccess(lines)
702
703 set opfunc=
704 bwipe!
705 delete('Xdir', 'rf')
706 &rtp = save_rtp
707 enddef
708
676 def Test_use_autoload_import_in_fold_expression() 709 def Test_use_autoload_import_in_fold_expression()
677 mkdir('Xdir/autoload', 'p') 710 mkdir('Xdir/autoload', 'p')
678 var save_rtp = &rtp 711 var save_rtp = &rtp
679 exe 'set rtp^=' .. getcwd() .. '/Xdir' 712 exe 'set rtp^=' .. getcwd() .. '/Xdir'
680 713