1
0
forked from aniani/vim

patch 8.2.4409: Vim9: some code not covered by tests

Problem:    Vim9: some code not covered by tests.
Solution:   Add a few more tests.  Fix reported line number.
This commit is contained in:
Bram Moolenaar
2022-02-17 16:30:11 +00:00
parent ea5c898b5f
commit 6296d1e60e
3 changed files with 17 additions and 4 deletions

View File

@@ -847,6 +847,9 @@ def Test_assignment_list()
assert_equal(['sdf', 'asdf', 'end'], list3)
v9.CheckDefExecFailure(['var ll = [1, 2, 3]', 'll[-4] = 6'], 'E684:')
v9.CheckDefExecFailure(['var ll = [1, 2, 3]', 'unlet ll[8 : 9]'], 'E684:')
v9.CheckDefExecFailure(['var ll = [1, 2, 3]', 'unlet ll[1 : -9]'], 'E684:')
v9.CheckDefExecFailure(['var ll = [1, 2, 3]', 'unlet ll[2 : 1]'], 'E684:')
# type becomes list<any>
var somelist = rand() > 0 ? [1, 2, 3] : ['a', 'b', 'c']
@@ -2193,6 +2196,10 @@ def Test_unlet()
'g:dd = {"a": 1, 2: 2}'
'unlet g:dd[0z11]',
], 'E1029:', 2)
v9.CheckDefExecFailure([
'g:str = "a string"'
'unlet g:str[0]',
], 'E1148: Cannot index a string', 2)
# can compile unlet before variable exists
g:someDict = {key: 'val'}