diff src/testdir/test_vim9_assign.vim @ 33668:fcc8296f36eb v9.0.2072

patch 9.0.2072: Vim9: no nr2str conversion in list-unpack Commit: https://github.com/vim/vim/commit/c229a6ac0775e07dff456ca8832c516e57a74e74 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Thu Oct 26 23:05:07 2023 +0200 patch 9.0.2072: Vim9: no nr2str conversion in list-unpack Problem: Vim9: no nr2str conversion in list-unpack Solution: Generate 2STRING instruction to convert dict index to string Generate instruction to convert dict index to a string fixes: #13417 closes: #13424 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
author Christian Brabandt <cb@256bit.org>
date Thu, 26 Oct 2023 23:15:06 +0200
parents 2c66a4fe1513
children 2fc593290679
line wrap: on
line diff
--- a/src/testdir/test_vim9_assign.vim
+++ b/src/testdir/test_vim9_assign.vim
@@ -2986,4 +2986,21 @@ def Test_heredoc_expr()
   v9.CheckDefAndScriptFailure(lines, 'E15: Invalid expression: "}"')
 enddef
 
+" Test for assigning to a multi-dimensional list item.
+def Test_list_item_assign()
+  var lines =<< trim END
+    vim9script
+
+    def Foo()
+        var l: list<list<string>> = [['x', 'x', 'x'], ['y', 'y', 'y']]
+        var z: number = 1
+
+        [l[1][2], z] = ['a', 20]
+        assert_equal([['x', 'x', 'x'], ['y', 'y', 'a']], l)
+    enddef
+    Foo()
+  END
+  v9.CheckSourceSuccess(lines)
+enddef
+
 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker