diff src/testdir/test_vim9_assign.vim @ 22365:a4866826cebc v8.2.1731

patch 8.2.1731: Vim9: cannot use += to append to empty NULL list Commit: https://github.com/vim/vim/commit/81ed4960482f8baabdd7f95b4d5e39744be88ae7 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Sep 23 15:56:50 2020 +0200 patch 8.2.1731: Vim9: cannot use += to append to empty NULL list Problem: Vim9: cannot use += to append to empty NULL list. Solution: Copy the list instead of extending it. (closes https://github.com/vim/vim/issues/6998)
author Bram Moolenaar <Bram@vim.org>
date Wed, 23 Sep 2020 16:00:04 +0200
parents 6c3d15011081
children a9fb7efa31d6
line wrap: on
line diff
--- a/src/testdir/test_vim9_assign.vim
+++ b/src/testdir/test_vim9_assign.vim
@@ -223,6 +223,20 @@ def Test_assignment()
   endif
 enddef
 
+def Test_extend_list()
+  let lines =<< trim END
+      vim9script
+      let l: list<number>
+      l += [123]
+      assert_equal([123], l)
+
+      let d: dict<number>
+      d['one'] = 1
+      assert_equal(#{one: 1}, d)
+  END
+  CheckScriptSuccess(lines)
+enddef
+
 def Test_single_letter_vars()
   # single letter variables
   let a: number = 123