mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.2.0311: Vim9: insufficient script tests
Problem: Vim9: insufficient script tests. Solution: Add tests. Free imports when re-using a script.
This commit is contained in:
@@ -1284,6 +1284,9 @@ do_source(
|
|||||||
di = HI2DI(hi);
|
di = HI2DI(hi);
|
||||||
di->di_flags |= DI_FLAGS_RELOAD;
|
di->di_flags |= DI_FLAGS_RELOAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// old imports are no longer valid
|
||||||
|
free_imports(sid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -333,8 +333,30 @@ def Test_vim9script()
|
|||||||
delete('Ximport.vim')
|
delete('Ximport.vim')
|
||||||
delete('Xexport.vim')
|
delete('Xexport.vim')
|
||||||
|
|
||||||
|
" Check that in a Vim9 script 'cpo' is set to the Vim default.
|
||||||
|
set cpo&vi
|
||||||
|
let cpo_before = &cpo
|
||||||
|
let lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
g:cpo_in_vim9script = &cpo
|
||||||
|
END
|
||||||
|
writefile(lines, 'Xvim9_script')
|
||||||
|
source Xvim9_script
|
||||||
|
assert_equal(cpo_before, &cpo)
|
||||||
|
set cpo&vim
|
||||||
|
assert_equal(&cpo, g:cpo_in_vim9script)
|
||||||
|
delete('Xvim9_script')
|
||||||
|
enddef
|
||||||
|
|
||||||
|
def Test_vim9script_fails()
|
||||||
CheckScriptFailure(['scriptversion 2', 'vim9script'], 'E1039:')
|
CheckScriptFailure(['scriptversion 2', 'vim9script'], 'E1039:')
|
||||||
CheckScriptFailure(['vim9script', 'scriptversion 2'], 'E1040:')
|
CheckScriptFailure(['vim9script', 'scriptversion 2'], 'E1040:')
|
||||||
|
CheckScriptFailure(['export let some = 123'], 'E1042:')
|
||||||
|
CheckScriptFailure(['vim9script', 'export let g:some'], 'E1044:')
|
||||||
|
CheckScriptFailure(['vim9script', 'export echo 134'], 'E1043:')
|
||||||
|
|
||||||
|
assert_fails('vim9script', 'E1038')
|
||||||
|
assert_fails('export something', 'E1042')
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
def Test_vim9script_call()
|
def Test_vim9script_call()
|
||||||
|
@@ -738,6 +738,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
311,
|
||||||
/**/
|
/**/
|
||||||
310,
|
310,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user