1
0
forked from aniani/vim

patch 8.2.1867: Vim9: argument to add() not checked for blob

Problem:    Vim9: argument to add() not checked for blob.
Solution:   Add the BLOBAPPEND instruction.
This commit is contained in:
Bram Moolenaar
2020-10-19 20:45:36 +02:00
parent 66fa5fd54f
commit 80b0e5ea11
7 changed files with 106 additions and 5 deletions

View File

@@ -1791,9 +1791,25 @@ def Test_list_add()
enddef
def Test_blob_add()
var b: blob = 0z12
add(b, 0x34)
assert_equal(0z1234, b)
var b1: blob = 0z12
add(b1, 0x34)
assert_equal(0z1234, b1)
var b2: blob # defaults to empty blob
add(b2, 0x67)
assert_equal(0z67, b2)
var lines =<< trim END
var b: blob
add(b, "x")
END
CheckDefFailure(lines, 'E1012:', 2)
lines =<< trim END
var b: blob = test_null_blob()
add(b, 123)
END
CheckDefExecFailure(lines, 'E1131:', 2)
enddef
def SID(): number