Mercurial > vim
changeset 21801:1344d45ca6f2 v8.2.1450
patch 8.2.1450: Vim9: no check that script-local items don't become global
Commit: https://github.com/vim/vim/commit/7d6997015d533604f18756e59b4a2a1266a66a97
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Aug 14 20:52:28 2020 +0200
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 14 Aug 2020 21:00:05 +0200 |
parents | d397f4708862 |
children | 9c76dc7535a6 |
files | src/testdir/test_vim9_script.vim src/version.c |
diffstat | 2 files changed, 38 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -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