Patch 8.2.0311
Problem: Vim9: insufficient script tests.
Solution: Add tests. Free imports when re-using a script.
Files: src/testdir/test_vim9_script.vim, src/scriptfile.c
*** ../vim-8.2.0310/src/testdir/test_vim9_script.vim 2020-02-23
14:34:57.796437728 +0100
--- src/testdir/test_vim9_script.vim 2020-02-23 17:10:22.627968287 +0100
***************
*** 333,340 ****
--- 333,362 ----
delete('Ximport.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(['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
def Test_vim9script_call()
*** ../vim-8.2.0310/src/scriptfile.c 2020-01-26 19:26:42.794068329 +0100
--- src/scriptfile.c 2020-02-23 17:48:26.256336362 +0100
***************
*** 1284,1289 ****
--- 1284,1292 ----
di = HI2DI(hi);
di->di_flags |= DI_FLAGS_RELOAD;
}
+
+ // old imports are no longer valid
+ free_imports(sid);
}
else
{
*** ../vim-8.2.0310/src/version.c 2020-02-23 16:16:23.271358004 +0100
--- src/version.c 2020-02-23 16:52:32.347722995 +0100
***************
*** 740,741 ****
--- 740,743 ----
{ /* Add new patch number below this line */
+ /**/
+ 311,
/**/
--
hundred-and-one symptoms of being an internet addict:
108. While reading a magazine, you look for the Zoom icon for a better
look at a photograph.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202002231744.01NHiarr015054%40masaka.moolenaar.net.