comparison 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
comparison
equal deleted inserted replaced
34772:cd738b9a790a 34773:af48c532bd88
2991 v9.CheckScriptSuccess(lines) 2991 v9.CheckScriptSuccess(lines)
2992 2992
2993 &rtp = save_rtp 2993 &rtp = save_rtp
2994 enddef 2994 enddef
2995 2995
2996 " Test for autoloading an imported dict func
2997 def Test_autoload_import_dict_func()
2998 mkdir('Xdir/autoload', 'pR')
2999 var lines =<< trim END
3000 vim9script
3001 export var al_exported_nr: number = 33
3002 def Al_AddNum(n: number)
3003 al_exported_nr += n
3004 enddef
3005 export var al_exportedDict: dict<func> = {Fn: Al_AddNum}
3006 END
3007 writefile(lines, 'Xdir/autoload/Xdictfunc.vim')
3008
3009 var save_rtp = &rtp
3010 exe 'set rtp^=' .. getcwd() .. '/Xdir'
3011 lines =<< trim END
3012 import './Xdir/autoload/Xdictfunc.vim'
3013 call Xdictfunc#al_exportedDict.Fn(5)
3014 call assert_equal(38, Xdictfunc#al_exported_nr)
3015 call call(Xdictfunc#al_exportedDict.Fn, [3])
3016 call assert_equal(41, Xdictfunc#al_exported_nr)
3017 END
3018 v9.CheckScriptSuccess(lines)
3019 &rtp = save_rtp
3020 enddef
3021
2996 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker 3022 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker