patch 8.2.3438: cannot manipulate blobs

Problem:    Cannot manipulate blobs.
Solution:   Add blob2list() and list2blob(). (Yegappan Lakshmanan,
            closes #8868)
diff --git a/src/testdir/test_blob.vim b/src/testdir/test_blob.vim
index d56c4f7..e722dab 100644
--- a/src/testdir/test_blob.vim
+++ b/src/testdir/test_blob.vim
@@ -638,4 +638,43 @@
   call CheckLegacyAndVim9Failure(['call sort([11, 0z11], "N")'], 'E974:')
 endfunc
 
+" Tests for the blob2list() function
+func Test_blob2list()
+  call assert_fails('let v = blob2list(10)', 'E1238: Blob required for argument 1')
+  eval 0zFFFF->blob2list()->assert_equal([255, 255])
+  let tests = [[0z0102, [1, 2]],
+        \ [0z00, [0]],
+        \ [0z, []],
+        \ [0z00000000, [0, 0, 0, 0]],
+        \ [0zAABB.CCDD, [170, 187, 204, 221]]]
+  for t in tests
+    call assert_equal(t[0]->blob2list(), t[1])
+  endfor
+  exe 'let v = 0z' .. repeat('000102030405060708090A0B0C0D0E0F', 64)
+  call assert_equal(1024, blob2list(v)->len())
+  call assert_equal([4, 8, 15], [v[100], v[1000], v[1023]])
+  call assert_equal([], blob2list(test_null_blob()))
+endfunc
+
+" Tests for the list2blob() function
+func Test_list2blob()
+  call assert_fails('let b = list2blob(0z10)', 'E1211: List required for argument 1')
+  let tests = [[[1, 2], 0z0102],
+        \ [[0], 0z00],
+        \ [[], 0z],
+        \ [[0, 0, 0, 0], 0z00000000],
+        \ [[170, 187, 204, 221], 0zAABB.CCDD],
+        \ ]
+  for t in tests
+    call assert_equal(t[0]->list2blob(), t[1])
+  endfor
+  call assert_fails('let b = list2blob([1, []])', 'E745:')
+  call assert_fails('let b = list2blob([-1])', 'E1239:')
+  call assert_fails('let b = list2blob([256])', 'E1239:')
+  let b = range(16)->repeat(64)->list2blob()
+  call assert_equal(1024, b->len())
+  call assert_equal([4, 8, 15], [b[100], b[1000], b[1023]])
+  call assert_equal(0z, list2blob(test_null_list()))
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_vim9_builtin.vim b/src/testdir/test_vim9_builtin.vim
index 5f22b33..746d3f8 100644
--- a/src/testdir/test_vim9_builtin.vim
+++ b/src/testdir/test_vim9_builtin.vim
@@ -287,6 +287,10 @@
   assert_fails('balloon_split(true)', 'E1174:')
 enddef
 
+def Test_blob2list()
+  CheckDefAndScriptFailure2(['blob2list(10)'], 'E1013: Argument 1: type mismatch, expected blob but got number', 'E1238: Blob required for argument 1')
+enddef
+
 def Test_browse()
   CheckFeature browse
 
@@ -572,6 +576,7 @@
   assert_equal(97, char2nr('a', 0))
   assert_equal(97, char2nr('a', true))
   assert_equal(97, char2nr('a', false))
+  char2nr('')->assert_equal(0)
 enddef
 
 def Test_charclass()
@@ -786,6 +791,8 @@
   CheckDefAndScriptFailure2(['escape(true, false)'], 'E1013: Argument 1: type mismatch, expected string but got bool', 'E1174: String required for argument 1')
   CheckDefAndScriptFailure2(['escape("a", 10)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2')
   assert_equal('a\:b', escape("a:b", ":"))
+  escape('abc', '')->assert_equal('abc')
+  escape('', ':')->assert_equal('')
 enddef
 
 def Test_eval()
@@ -1921,6 +1928,11 @@
   assert_equal(0, lispindent(1))
 enddef
 
+def Test_list2blob()
+  CheckDefAndScriptFailure2(['list2blob(10)'], 'E1013: Argument 1: type mismatch, expected list<number> but got number', 'E1211: List required for argument 1')
+  CheckDefFailure(['list2blob([0z10, 0z02])'], 'E1013: Argument 1: type mismatch, expected list<number> but got list<blob>')
+enddef
+
 def Test_list2str_str2list_utf8()
   var s = "\u3042\u3044"
   var l = [0x3042, 0x3044]