0
0
mirror of https://github.com/vim/vim.git synced 2025-10-03 05:14:07 -04:00

patch 8.2.4050: Vim9: need to prefix every item in an autoload script

Problem:    Vim9: need to prefix every item in an autoload script.
Solution:   First step in supporting "vim9script autoload" and "import
            autoload".
This commit is contained in:
Bram Moolenaar
2022-01-09 21:36:37 +00:00
parent 5f25c38550
commit dc4451df61
15 changed files with 402 additions and 117 deletions

View File

@@ -3032,6 +3032,26 @@ def Test_vim9_autoload()
writefile(lines, 'Xdir/autoload/Other.vim')
assert_equal('other', g:Other#getOther())
# using "vim9script autoload" prefix is not needed
lines =<< trim END
vim9script autoload
g:prefixed_loaded = 'yes'
export def Gettest(): string
return 'test'
enddef
export var name = 'name'
END
writefile(lines, 'Xdir/autoload/prefixed.vim')
lines =<< trim END
vim9script
import autoload 'prefixed.vim'
assert_false(exists('g:prefixed_loaded'))
assert_equal('test', prefixed.Gettest())
assert_equal('yes', g:prefixed_loaded)
END
CheckScriptSuccess(lines)
delete('Xdir', 'rf')
&rtp = save_rtp
enddef