Mercurial > vim
diff src/testdir/test_vim9_script.vim @ 28646:a2cf17d0d5da v8.2.4847
patch 8.2.4847: crash when using uninitialized function pointer
Commit: https://github.com/vim/vim/commit/a5d3590505fc3e1deea990560d472baa563abed7
Author: LemonBoy <thatlemon@gmail.com>
Date: Fri Apr 29 21:15:02 2022 +0100
patch 8.2.4847: crash when using uninitialized function pointer
Problem: Crash when using uninitialized function pointer.
Solution: Check for NULL pointer. (closes https://github.com/vim/vim/issues/10319, closes https://github.com/vim/vim/issues/10319)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 29 Apr 2022 22:30:03 +0200 |
parents | 1d92ba691dc4 |
children | 89ff3a0fff82 |
line wrap: on
line diff
--- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -4115,6 +4115,38 @@ def Run_Test_misplaced_type() delete('XTest_misplaced_type') enddef +" Ensure echo doesn't crash when stringifying empty variables. +def Test_echo_uninit_variables() + var res: string + + var var_bool: bool + var var_num: number + var var_float: float + var Var_func: func + var var_string: string + var var_blob: blob + var var_job: job + var var_channel: channel + var var_list: list<any> + var var_dict: dict<any> + + redir => res + echo var_bool + echo var_num + echo var_float + echo Var_func + echo var_string + echo var_blob + echo var_job + echo var_channel + echo var_list + echo var_dict + redir END + + assert_equal(['false', '0', '0.0', 'function()', '', '0z', 'no process', + 'channel fail', '[]', '{}'], res->split('\n')) +enddef + " Keep this last, it messes up highlighting. def Test_substitute_cmd() new