diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-03-08 13:18:55 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-03-08 13:18:55 +0000 |
commit | 8acb9cc6209768ca7ec75c9f7af8c389312ea8d6 (patch) | |
tree | 8a5f92b1b10f53f7a3f0e95ffbdcb519ce9ecb09 /src/testdir/test_vim9_assign.vim | |
parent | 08238045e769fce2d5bf1e17167e26eafc3d72b8 (diff) |
patch 8.2.4526: Vim9: cannot set variables to a null valuev8.2.4526
Problem: Vim9: cannot set variables to a null value.
Solution: Add null_list, null_job, etc.
Diffstat (limited to 'src/testdir/test_vim9_assign.vim')
-rw-r--r-- | src/testdir/test_vim9_assign.vim | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/src/testdir/test_vim9_assign.vim b/src/testdir/test_vim9_assign.vim index 6f6433493b..abc3a15b9a 100644 --- a/src/testdir/test_vim9_assign.vim +++ b/src/testdir/test_vim9_assign.vim @@ -306,12 +306,44 @@ def Test_assign_register() enddef def Test_reserved_name() - for name in ['true', 'false', 'null'] + var more_names = ['null_job', 'null_channel'] + if !has('job') + more_names = [] + endif + + for name in ['true', + 'false', + 'null', + 'null_blob', + 'null_dict', + 'null_function', + 'null_list', + 'null_partial', + 'null_string', + ] + more_names v9.CheckDefExecAndScriptFailure(['var ' .. name .. ' = 0'], 'E1034:') v9.CheckDefExecAndScriptFailure(['var ' .. name .. ': bool'], 'E1034:') endfor enddef +def Test_null_values() + var lines =<< trim END + var b: blob = null_blob + var dn: dict<number> = null_dict + var ds: dict<string> = null_dict + var ln: list<number> = null_list + var ls: list<string> = null_list + var Ff: func(string): string = null_function + var Fp: func(number): number = null_partial + var s: string = null_string + if has('job') + var j: job = null_job + var c: channel = null_channel + endif + END + v9.CheckDefAndScriptSuccess(lines) +enddef + def Test_skipped_assignment() var lines =<< trim END for x in [] |