diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-05-04 16:12:52 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-05-04 16:14:43 +0800 |
commit | 47132823ab1c4f458c945df89d12e897d77db8a8 (patch) | |
tree | f71b8841ee2b9bd0e7a51e184a64d3117f51cc3d /test | |
parent | 7ac63906eae92b5d31fc7e380ef05b8bce73ad8b (diff) | |
download | rneovim-47132823ab1c4f458c945df89d12e897d77db8a8.tar.gz rneovim-47132823ab1c4f458c945df89d12e897d77db8a8.tar.bz2 rneovim-47132823ab1c4f458c945df89d12e897d77db8a8.zip |
vim-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 vim/vim#8749)
https://github.com/vim/vim/commit/92f05f21afdb8a43581554a252cb2fc050f9e03b
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/old/testdir/test_listdict.vim | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/old/testdir/test_listdict.vim b/test/old/testdir/test_listdict.vim index 0ff3582da9..11dade18f3 100644 --- a/test/old/testdir/test_listdict.vim +++ b/test/old/testdir/test_listdict.vim @@ -1,5 +1,7 @@ " Tests for the List and Dict types +source vim9.vim + func TearDown() " Run garbage collection after every test call test_garbagecollect_now() @@ -37,6 +39,23 @@ func Test_list_slice() let l[:1] += [1, 2] let l[2:] -= [1] call assert_equal([2, 4, 2], l) + + let lines =<< trim END + VAR l = [1, 2] + call assert_equal([1, 2], l[:]) + call assert_equal([2], l[-1 : -1]) + call assert_equal([1, 2], l[-2 : -1]) + END + call CheckLegacyAndVim9Success(lines) + + let l = [1, 2] + call assert_equal([], l[-3 : -1]) + + let lines =<< trim END + var l = [1, 2] + assert_equal([1, 2], l[-3 : -1]) + END + call CheckDefAndScriptSuccess(lines) endfunc " List identity |