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

patch 8.2.2162: Vim9: Cannot load or store autoload variables

Problem:    Vim9: Cannot load or store autoload variables.
Solution:   Add ISN_LOADAUTO and ISN_STOREAUTO. (closes #7485)
This commit is contained in:
Bram Moolenaar
2020-12-19 16:30:44 +01:00
parent 1f33e0a7c4
commit 03290b8444
10 changed files with 106 additions and 15 deletions

View File

@@ -2779,8 +2779,32 @@ def Test_vim9_copen()
quit
enddef
" test using a vim9script that is auto-loaded from an autocmd
" test using an auto-loaded function and variable
def Test_vim9_autoload()
var lines =<< trim END
vim9script
def some#gettest(): string
return 'test'
enddef
g:some#name = 'name'
END
mkdir('Xdir/autoload', 'p')
writefile(lines, 'Xdir/autoload/some.vim')
var save_rtp = &rtp
exe 'set rtp^=' .. getcwd() .. '/Xdir'
assert_equal('test', g:some#gettest())
assert_equal('name', g:some#name)
g:some#other = 'other'
assert_equal('other', g:some#other)
delete('Xdir', 'rf')
&rtp = save_rtp
enddef
" test using a vim9script that is auto-loaded from an autocmd
def Test_vim9_aucmd_autoload()
var lines =<< trim END
vim9script
def foo#test()
@@ -2842,6 +2866,12 @@ def Test_vim9_autoload_error()
delete('Xdidit')
delete('Xscript')
delete('Xruntime', 'rf')
lines =<< trim END
vim9script
var foo#bar = 'asdf'
END
CheckScriptFailure(lines, 'E461: Illegal variable name: foo#bar', 2)
enddef
def Test_script_var_in_autocmd()