diff src/testdir/test_vim9_expr.vim @ 21166:64f664f9b23a v8.2.1134

patch 8.2.1134: Vim9: getting a list member may not work Commit: https://github.com/vim/vim/commit/435d89789ef4dd329938edbe17c646db9f0ea772 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 5 16:42:13 2020 +0200 patch 8.2.1134: Vim9: getting a list member may not work Problem: Vim9: getting a list member may not work. Solution: Clear the list only after copying the item. (closes https://github.com/vim/vim/issues/6393)
author Bram Moolenaar <Bram@vim.org>
date Sun, 05 Jul 2020 16:45:03 +0200
parents 1561311249bb
children f26a606e6dbc
line wrap: on
line diff
--- a/src/testdir/test_vim9_expr.vim
+++ b/src/testdir/test_vim9_expr.vim
@@ -1141,6 +1141,11 @@ def Test_expr_member()
   call CheckDefExecFailure(["let d: dict<number>", "d = g:list_empty"], 'E1029: Expected dict but got list')
 enddef
 
+def Test_expr_index()
+  # getting the one member should clear the list only after getting the item
+  assert_equal('bbb', ['aaa', 'bbb', 'ccc'][1])
+enddef
+
 def Test_expr_member_vim9script()
   let lines =<< trim END
       vim9script