diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-02-20 17:04:02 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-02-20 17:04:02 +0100 |
commit | 5b5ae29bd3d7b832b6f15320430f7f191e0abd1f (patch) | |
tree | 94858648f12e7261a37e82308c15dafb5a789cf9 /src/testdir | |
parent | ada1d870b4a818151cfba1c18962af2369b88df9 (diff) | |
download | vim-git-5b5ae29bd3d7b832b6f15320430f7f191e0abd1f.tar.gz |
patch 8.2.2533: Vim9: cannot use a range with :unletv8.2.2533
Problem: Vim9: cannot use a range with :unlet.
Solution: Implement ISN_UNLETRANGE.
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_vim9_assign.vim | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_assign.vim b/src/testdir/test_vim9_assign.vim index 392a091a1..bcddc4f16 100644 --- a/src/testdir/test_vim9_assign.vim +++ b/src/testdir/test_vim9_assign.vim @@ -9,6 +9,7 @@ let g:existing = 'yes' let g:inc_counter = 1 let $SOME_ENV_VAR = 'some' let g:alist = [7] +let g:adict = #{a: 1} let g:astring = 'text' def Test_assignment_bool() @@ -1414,6 +1415,51 @@ def Test_unlet() unlet ll[-1] assert_equal([1, 3], ll) + ll = [1, 2, 3, 4] + unlet ll[0 : 1] + assert_equal([3, 4], ll) + + ll = [1, 2, 3, 4] + unlet ll[2 : 8] + assert_equal([1, 2], ll) + + ll = [1, 2, 3, 4] + unlet ll[-2 : -1] + assert_equal([1, 2], ll) + + CheckDefFailure([ + 'var ll = [1, 2]', + 'll[1 : 2] = 7', + ], 'E1165:', 2) + CheckDefFailure([ + 'var dd = {a: 1}', + 'unlet dd["a" : "a"]', + ], 'E1166:', 2) + CheckDefExecFailure([ + 'unlet g:adict[0 : 1]', + ], 'E1148:', 1) + CheckDefFailure([ + 'var ll = [1, 2]', + 'unlet ll[0:1]', + ], 'E1004:', 2) + CheckDefFailure([ + 'var ll = [1, 2]', + 'unlet ll[0 :1]', + ], 'E1004:', 2) + CheckDefFailure([ + 'var ll = [1, 2]', + 'unlet ll[0: 1]', + ], 'E1004:', 2) + + CheckDefFailure([ + 'var ll = [1, 2]', + 'unlet ll["x" : 1]', + ], 'E1012:', 2) + CheckDefFailure([ + 'var ll = [1, 2]', + 'unlet ll[0 : "x"]', + ], 'E1012:', 2) + # list of dict unlet var dl = [{a: 1, b: 2}, {c: 3}] unlet dl[0]['b'] |