diff src/testdir/test_blob.vim @ 35190:ddd5eaa2c0dc v9.1.0415

patch 9.1.0415: Some functions are not tested Commit: https://github.com/vim/vim/commit/fe424d13ef6e5486923f23f15bb6951e3079412e Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Fri May 17 18:20:43 2024 +0200 patch 9.1.0415: Some functions are not tested Problem: Some functions are not tested Solution: Add a few more tests, fix a few minor problems (Yegappan Lakshmanan) closes: #14789 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Fri, 17 May 2024 18:30:06 +0200
parents f2b94f240b7d
children
line wrap: on
line diff
--- a/src/testdir/test_blob.vim
+++ b/src/testdir/test_blob.vim
@@ -74,6 +74,13 @@ func Test_blob_assign()
       VAR l = [0z12]
       VAR m = deepcopy(l)
       LET m[0] = 0z34	#" E742 or E741 should not occur.
+
+      VAR blob1 = 0z10
+      LET blob1 += test_null_blob()
+      call assert_equal(0z10, blob1)
+      LET blob1 = test_null_blob()
+      LET blob1 += 0z20
+      call assert_equal(0z20, blob1)
   END
   call v9.CheckLegacyAndVim9Success(lines)
 
@@ -343,6 +350,17 @@ func Test_blob_for_loop()
       call assert_equal(5, i)
   END
   call v9.CheckLegacyAndVim9Success(lines)
+
+  " Test for skipping the loop var assignment in a for loop
+  let lines =<< trim END
+    VAR blob = 0z998877
+    VAR c = 0
+    for _ in blob
+      LET c += 1
+    endfor
+    call assert_equal(3, c)
+  END
+  call v9.CheckLegacyAndVim9Success(lines)
 endfunc
 
 func Test_blob_concatenate()
@@ -831,6 +849,7 @@ func Test_indexof()
   call assert_equal(-1, indexof(test_null_blob(), "v:val == 0xde"))
   call assert_equal(-1, indexof(b, test_null_string()))
   call assert_equal(-1, indexof(b, test_null_function()))
+  call assert_equal(-1, indexof(b, ""))
 
   let b = 0z01020102
   call assert_equal(1, indexof(b, "v:val == 0x02", #{startidx: 0}))
@@ -842,6 +861,7 @@ func Test_indexof()
   " failure cases
   call assert_fails('let i = indexof(b, "val == 0xde")', 'E121:')
   call assert_fails('let i = indexof(b, {})', 'E1256:')
+  call assert_fails('let i = indexof(b, " ")', 'E15:')
 endfunc
 
 " vim: shiftwidth=2 sts=2 expandtab