0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

patch 8.2.4526: Vim9: cannot set variables to a null value

Problem:    Vim9: cannot set variables to a null value.
Solution:   Add null_list, null_job, etc.
This commit is contained in:
Bram Moolenaar
2022-03-08 13:18:55 +00:00
parent 08238045e7
commit 8acb9cc620
16 changed files with 346 additions and 51 deletions

View File

@@ -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 []