Mercurial > vim
comparison src/testdir/test_listdict.vim @ 25599:b85e44974a08 v8.2.3336
patch 8.2.3336: behavior of negative index in list change changed
Commit: https://github.com/vim/vim/commit/92f05f21afdb8a43581554a252cb2fc050f9e03b
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Aug 12 21:12:56 2021 +0200
patch 8.2.3336: behavior of negative index in list change changed
Problem: Behavior of negative index in list change changed. (Naruhiko
Nishino)
Solution: Only change it for Vim9 script. (closes #8749)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 12 Aug 2021 21:15:03 +0200 |
parents | 0fdacd8f0cf3 |
children | 525ef4d1d412 |
comparison
equal
deleted
inserted
replaced
25598:9569ab5f546a | 25599:b85e44974a08 |
---|---|
40 " perform an operation on a list slice | 40 " perform an operation on a list slice |
41 let l = [1, 2, 3] | 41 let l = [1, 2, 3] |
42 let l[:1] += [1, 2] | 42 let l[:1] += [1, 2] |
43 let l[2:] -= [1] | 43 let l[2:] -= [1] |
44 call assert_equal([2, 4, 2], l) | 44 call assert_equal([2, 4, 2], l) |
45 | |
46 let lines =<< trim END | |
47 VAR l = [1, 2] | |
48 call assert_equal([1, 2], l[:]) | |
49 call assert_equal([2], l[-1 : -1]) | |
50 call assert_equal([1, 2], l[-2 : -1]) | |
51 END | |
52 call CheckLegacyAndVim9Success(lines) | |
53 | |
54 let l = [1, 2] | |
55 call assert_equal([], l[-3 : -1]) | |
56 | |
57 let lines =<< trim END | |
58 var l = [1, 2] | |
59 assert_equal([1, 2], l[-3 : -1]) | |
60 END | |
61 call CheckDefAndScriptSuccess(lines) | |
45 endfunc | 62 endfunc |
46 | 63 |
47 " List identity | 64 " List identity |
48 func Test_list_identity() | 65 func Test_list_identity() |
49 let lines =<< trim END | 66 let lines =<< trim END |