aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/test_listdict.vim19
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