]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1025: wrong return type of blob2str() v9.1.1025
authorYegappan Lakshmanan <yegappan@yahoo.com>
Fri, 17 Jan 2025 10:48:12 +0000 (11:48 +0100)
committerChristian Brabandt <cb@256bit.org>
Fri, 17 Jan 2025 10:48:12 +0000 (11:48 +0100)
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>
runtime/doc/builtin.txt
src/evalfunc.c
src/testdir/test_vim9_builtin.vim
src/version.c

index d60d61f0d08c3be3392c14e89d139c84d86ef9c4..1837661bd55b90784b3fc5886464f25fe02c8c91 100644 (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
index 2b630cafc28bbbfd27d1c9c497cf9867e62afb66..8886088561244a3ef479448f8fe8f91a62036312 100644 (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,
index c82608b4658993733c47fd9dd07558d2597e6c08..cfaf0ace2154976f5662cbbe0be07d4c5e9495df 100644 (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)
index b002210866c83525ae4f8814e43295300823b5be..93f94c13649fa652f2eeaa01ce57275cde655425 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1025,
 /**/
     1024,
 /**/