0
0
mirror of https://github.com/vim/vim.git synced 2025-09-07 22:03:36 -04:00

patch 8.2.1450: Vim9: no check that script-local items don't become global

Problem:    Vim9: no check that script-local items don't become global.
Solution:   Add a test.
This commit is contained in:
Bram Moolenaar 2020-08-14 20:52:28 +02:00
parent 32a23ac615
commit 7d6997015d
2 changed files with 38 additions and 0 deletions

View File

@ -3039,6 +3039,42 @@ def Test_source_vim9_from_legacy()
delete('Xvim9_script.vim')
enddef
func Test_vim9script_not_global()
" check that items defined in Vim9 script are script-local, not global
let vim9lines =<< trim END
vim9script
let var = 'local'
func TheFunc()
echo 'local'
endfunc
def DefFunc()
echo 'local'
enddef
END
call writefile(vim9lines, 'Xvim9script.vim')
source Xvim9script.vim
try
echo g:var
assert_report('did not fail')
catch /E121:/
" caught
endtry
try
call TheFunc()
assert_report('did not fail')
catch /E117:/
" caught
endtry
try
call DefFunc()
assert_report('did not fail')
catch /E117:/
" caught
endtry
call delete('Xvim9script.vium')
endfunc
def Test_vim9_copen()
# this was giving an error for setting w:quickfix_title
copen

View File

@ -754,6 +754,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1450,
/**/
1449,
/**/