comparison src/testdir/test_vim9_import.vim @ 27068:6a4fc2e6e6eb v8.2.4063

patch 8.2.4063: Vim9: exported function in autoload script not found Commit: https://github.com/vim/vim/commit/b8822442d716df0230c79531132e530e95cc17e3 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jan 11 15:24:05 2022 +0000 patch 8.2.4063: Vim9: exported function in autoload script not found Problem: Vim9: exported function in autoload script not found. (Yegappan Lakshmanan) Solution: Use the autoload prefix to search for the function.
author Bram Moolenaar <Bram@vim.org>
date Tue, 11 Jan 2022 16:30:03 +0100
parents 1a56c0252772
children 19fefc42a063
comparison
equal deleted inserted replaced
27067:89bc175b25a5 27068:6a4fc2e6e6eb
1144 1144
1145 export def Gettest(): string 1145 export def Gettest(): string
1146 return 'test' 1146 return 'test'
1147 enddef 1147 enddef
1148 1148
1149 export func GetSome() 1149 export func GetMore()
1150 return 'some' 1150 return Gettest() .. 'more'
1151 endfunc 1151 endfunc
1152 1152
1153 export var name = 'name' 1153 export var name = 'name'
1154 export final fname = 'final' 1154 export final fname = 'final'
1155 export const cname = 'const' 1155 export const cname = 'const'
1161 import autoload 'prefixed.vim' 1161 import autoload 'prefixed.vim'
1162 assert_false(exists('g:prefixed_loaded')) 1162 assert_false(exists('g:prefixed_loaded'))
1163 assert_equal('test', prefixed.Gettest()) 1163 assert_equal('test', prefixed.Gettest())
1164 assert_equal('yes', g:prefixed_loaded) 1164 assert_equal('yes', g:prefixed_loaded)
1165 1165
1166 assert_equal('some', prefixed.GetSome()) 1166 assert_equal('testmore', prefixed.GetMore())
1167 assert_equal('name', prefixed.name) 1167 assert_equal('name', prefixed.name)
1168 assert_equal('final', prefixed.fname) 1168 assert_equal('final', prefixed.fname)
1169 assert_equal('const', prefixed.cname) 1169 assert_equal('const', prefixed.cname)
1170 END 1170 END
1171 CheckScriptSuccess(lines) 1171 CheckScriptSuccess(lines)
1172 1172
1173 # can also get the items by autoload name 1173 # can also get the items by autoload name
1174 lines =<< trim END 1174 lines =<< trim END
1175 call assert_equal('test', prefixed#Gettest()) 1175 call assert_equal('test', prefixed#Gettest())
1176 call assert_equal('some', prefixed#GetSome()) 1176 call assert_equal('testmore', prefixed#GetMore())
1177 call assert_equal('name', prefixed#name) 1177 call assert_equal('name', prefixed#name)
1178 call assert_equal('final', prefixed#fname) 1178 call assert_equal('final', prefixed#fname)
1179 call assert_equal('const', prefixed#cname) 1179 call assert_equal('const', prefixed#cname)
1180 END 1180 END
1181 CheckScriptSuccess(lines) 1181 CheckScriptSuccess(lines)