0
0
mirror of https://github.com/vim/vim.git synced 2025-07-04 23:07:33 -04:00

patch 9.1.1025: wrong return type of blob2str()

Problem:  wrong return type of blob2str()
Solution: update return to list of string
          (Yegappan Lakshmanan)

closes: #16461

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Yegappan Lakshmanan 2025-01-17 11:48:12 +01:00 committed by Christian Brabandt
parent a11b23c4d5
commit 166b1754a9
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
4 changed files with 22 additions and 3 deletions

View File

@ -1,4 +1,4 @@
*builtin.txt* For Vim version 9.1. Last change: 2025 Jan 16
*builtin.txt* For Vim version 9.1. Last change: 2025 Jan 17
VIM REFERENCE MANUAL by Bram Moolenaar
@ -72,7 +72,7 @@ base64_encode({blob}) String base64 encode the bytes in {blob}
bindtextdomain({package}, {path})
Bool bind text domain to specified path
blob2list({blob}) List convert {blob} into a list of numbers
blob2str({blob} [, {options}]) String convert {blob} into a list of strings
blob2str({blob} [, {options}]) List convert {blob} into a list of strings
browse({save}, {title}, {initdir}, {default})
String put up a file requester
browsedir({title}, {initdir}) String put up a directory requester

View File

@ -1847,7 +1847,7 @@ static funcentry_T global_functions[] =
{"blob2list", 1, 1, FEARG_1, arg1_blob,
ret_list_number, f_blob2list},
{"blob2str", 1, 2, FEARG_1, arg2_blob_dict,
ret_string, f_blob2str},
ret_list_string, f_blob2str},
{"browse", 4, 4, 0, arg4_browse,
ret_string, f_browse},
{"browsedir", 2, 2, 0, arg2_string,

View File

@ -357,6 +357,16 @@ def Test_blob2list()
v9.CheckSourceDefAndScriptFailure(['blob2list(10)'], ['E1013: Argument 1: type mismatch, expected blob but got number', 'E1238: Blob required for argument 1'])
enddef
def Test_blob2str()
0z6162->blob2str()->assert_equal(["ab"])
blob2str(0z)->assert_equal([])
var l: list<string> = blob2str(0zC2ABC2BB)
assert_equal(["«»"], l)
v9.CheckSourceDefAndScriptFailure(['blob2str("ab")'], ['E1013: Argument 1: type mismatch, expected blob but got string', 'E1238: Blob required for argument 1'])
enddef
def Test_browse()
CheckFeature browse
@ -4325,6 +4335,13 @@ def Test_state()
assert_equal('', state('a'))
enddef
def Test_str2blob()
["ab"]->str2blob()->assert_equal(0z6162)
str2blob([""])->assert_equal(0z)
v9.CheckSourceDefAndScriptFailure(['str2blob("ab")'], ['E1013: Argument 1: type mismatch, expected list<string> but got string', 'E1211: List required for argument 1'])
enddef
def Test_str2float()
str2float("1.00")->assert_equal(1.00)
str2float("2e-2")->assert_equal(0.02)

View File

@ -704,6 +704,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1025,
/**/
1024,
/**/