mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.4533: Vim9: no test that after assigning null type is still checked
Problem: Vim9: no test that after assigning null the type is still checked. Solution: Add a test.
This commit is contained in:
parent
f2832ad965
commit
56b84b1728
@ -340,10 +340,35 @@ def Test_null_values()
|
||||
var j: job = null_job
|
||||
var c: channel = null_channel
|
||||
endif
|
||||
|
||||
var d: dict<func> = {a: function('tr'), b: null_function}
|
||||
END
|
||||
v9.CheckDefAndScriptSuccess(lines)
|
||||
enddef
|
||||
|
||||
def Test_keep_type_after_assigning_null()
|
||||
var lines =<< trim END
|
||||
var b: blob
|
||||
b = null_blob
|
||||
b = 'text'
|
||||
END
|
||||
v9.CheckDefExecAndScriptFailure(lines, 'E1012: Type mismatch; expected blob but got string')
|
||||
|
||||
lines =<< trim END
|
||||
var l: list<number>
|
||||
l = null_list
|
||||
l = ['text']
|
||||
END
|
||||
v9.CheckDefExecAndScriptFailure(lines, 'E1012: Type mismatch; expected list<number> but got list<string>')
|
||||
|
||||
lines =<< trim END
|
||||
var d: dict<string>
|
||||
d = null_dict
|
||||
d = {a: 1, b: 2}
|
||||
END
|
||||
v9.CheckDefExecAndScriptFailure(lines, 'E1012: Type mismatch; expected dict<string> but got dict<number>')
|
||||
enddef
|
||||
|
||||
def Test_skipped_assignment()
|
||||
var lines =<< trim END
|
||||
for x in []
|
||||
|
@ -750,6 +750,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
4533,
|
||||
/**/
|
||||
4532,
|
||||
/**/
|
||||
|
Loading…
x
Reference in New Issue
Block a user