diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2021-08-04 19:25:54 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-08-04 19:25:54 +0200 |
commit | 80d7395dcfe96158428da6bb3d28a6eee1244e28 (patch) | |
tree | 84b3b09fe59c97f69d6248e87cf0b51dfdfd82e6 /src/testdir/test_blob.vim | |
parent | 0eec8519424eaea7baebfda979c33dd609a4e3fa (diff) |
patch 8.2.3284: no error for insert() or remove() changing a locked blobv8.2.3284
Problem: No error for insert() or remove() changing a locked blob.
Solution: Check a blob is not locked before changing it. (Sean Dewar,
closes #8696)
Diffstat (limited to 'src/testdir/test_blob.vim')
-rw-r--r-- | src/testdir/test_blob.vim | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/testdir/test_blob.vim b/src/testdir/test_blob.vim index b41ca78f3a..d56c4f748a 100644 --- a/src/testdir/test_blob.vim +++ b/src/testdir/test_blob.vim @@ -428,6 +428,23 @@ func Test_blob_func_remove() call remove(test_null_blob(), 1, 2) END call CheckLegacyAndVim9Failure(lines, 'E979:') + + let lines =<< trim END + let b = 0zDEADBEEF + lockvar b + call remove(b, 0) + unlockvar b + END + call CheckScriptFailure(lines, 'E741:') + + " can only check at script level, not in a :def function + let lines =<< trim END + vim9script + var b = 0zDEADBEEF + lockvar b + remove(b, 0) + END + call CheckScriptFailure(lines, 'E741:') endfunc func Test_blob_read_write() @@ -543,6 +560,22 @@ func Test_blob_insert() insert(test_null_blob(), 0x33) END call CheckDefExecAndScriptFailure(lines, 'E1131:') + + let lines =<< trim END + let b = 0zDEADBEEF + lockvar b + call insert(b, 3) + unlockvar b + END + call CheckScriptFailure(lines, 'E741:') + + let lines =<< trim END + vim9script + var b = 0zDEADBEEF + lockvar b + insert(b, 3) + END + call CheckScriptFailure(lines, 'E741:') endfunc func Test_blob_reverse() |