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 | |
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')
-rw-r--r-- | src/testdir/test_blob.vim | 33 | ||||
-rw-r--r-- | src/testdir/test_eval_stuff.vim | 6 |
2 files changed, 36 insertions, 3 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() diff --git a/src/testdir/test_eval_stuff.vim b/src/testdir/test_eval_stuff.vim index 1fbb74bc4e..ac9589d24c 100644 --- a/src/testdir/test_eval_stuff.vim +++ b/src/testdir/test_eval_stuff.vim @@ -65,9 +65,9 @@ func Test_E963() endfunc func Test_for_invalid() - call assert_fails("for x in 99", 'E714:') - call assert_fails("for x in function('winnr')", 'E714:') - call assert_fails("for x in {'a': 9}", 'E714:') + call assert_fails("for x in 99", 'E1098:') + call assert_fails("for x in function('winnr')", 'E1098:') + call assert_fails("for x in {'a': 9}", 'E1098:') if 0 /1/5/2/s/\n |