comparison src/testdir/test_vim9_builtin.vim @ 26891:902b8bee5254 v8.2.3974

patch 8.2.3974: Vim9: LISTAPPEND instruction does not check for a locked list Commit: https://github.com/vim/vim/commit/1f4a3457a3e55cdacd70ab0d5be587c248fb1ce8 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jan 1 18:29:21 2022 +0000 patch 8.2.3974: Vim9: LISTAPPEND instruction does not check for a locked list Problem: Vim9: LISTAPPEND instruction does not check for a locked list. Solution: Check whether the list is locked. (closes https://github.com/vim/vim/issues/9452)
author Bram Moolenaar <Bram@vim.org>
date Sat, 01 Jan 2022 19:30:03 +0100
parents b7b82279426f
children 6f43253463cc
comparison
equal deleted inserted replaced
26890:453f8cb05fab 26891:902b8bee5254
76 enddef 76 enddef
77 77
78 def Test_add() 78 def Test_add()
79 CheckDefAndScriptFailure(['add({}, 1)'], ['E1013: Argument 1: type mismatch, expected list<any> but got dict<unknown>', 'E1226: List or Blob required for argument 1']) 79 CheckDefAndScriptFailure(['add({}, 1)'], ['E1013: Argument 1: type mismatch, expected list<any> but got dict<unknown>', 'E1226: List or Blob required for argument 1'])
80 CheckDefFailure(['add([1], "a")'], 'E1012: Type mismatch; expected number but got string') 80 CheckDefFailure(['add([1], "a")'], 'E1012: Type mismatch; expected number but got string')
81
82 var lines =<< trim END
83 vim9script
84 g:thelist = [1]
85 lockvar g:thelist
86 def TryChange()
87 g:thelist->add(2)
88 enddef
89 TryChange()
90 END
91 CheckScriptFailure(lines, 'E741:')
81 enddef 92 enddef
82 93
83 def Test_add_blob() 94 def Test_add_blob()
84 var b1: blob = 0z12 95 var b1: blob = 0z12
85 add(b1, 0x34) 96 add(b1, 0x34)