Mercurial > vim
diff src/testdir/test_vim9_import.vim @ 34773:af48c532bd88 v9.1.0263
patch 9.1.0263: Vim9: Problem with lambda blocks in enums and classes
Commit: https://github.com/vim/vim/commit/3fa8f7728a47822e4efd106ab30c83c28f198b3c
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Thu Apr 4 21:42:07 2024 +0200
patch 9.1.0263: Vim9: Problem with lambda blocks in enums and classes
Problem: Vim9: Problem with lambda blocks in enums and classes
(Aliaksei Budavei)
Solution: Support evaluating lambda blocks from a string, skip over
comments (Yegappan Lakshmanan)
fixes: #14350
closes: #14405
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 04 Apr 2024 22:00:04 +0200 |
parents | a14868d39709 |
children | 4cc31827e1db |
line wrap: on
line diff
--- a/src/testdir/test_vim9_import.vim +++ b/src/testdir/test_vim9_import.vim @@ -2993,4 +2993,30 @@ def Test_import_autloaded_script() &rtp = save_rtp enddef +" Test for autoloading an imported dict func +def Test_autoload_import_dict_func() + mkdir('Xdir/autoload', 'pR') + var lines =<< trim END + vim9script + export var al_exported_nr: number = 33 + def Al_AddNum(n: number) + al_exported_nr += n + enddef + export var al_exportedDict: dict<func> = {Fn: Al_AddNum} + END + writefile(lines, 'Xdir/autoload/Xdictfunc.vim') + + var save_rtp = &rtp + exe 'set rtp^=' .. getcwd() .. '/Xdir' + lines =<< trim END + import './Xdir/autoload/Xdictfunc.vim' + call Xdictfunc#al_exportedDict.Fn(5) + call assert_equal(38, Xdictfunc#al_exported_nr) + call call(Xdictfunc#al_exportedDict.Fn, [3]) + call assert_equal(41, Xdictfunc#al_exported_nr) + END + v9.CheckScriptSuccess(lines) + &rtp = save_rtp +enddef + " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker