From 5b2a3d77d320d76f12b1666938a9d58c2a848205 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 21 Oct 2022 11:25:30 +0100 Subject: patch 9.0.0810: readblob() returns empty when trying to read too much Problem: readblob() returns empty when trying to read too much. Solution: Return what is available. --- src/testdir/test_blob.vim | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/testdir/test_blob.vim') diff --git a/src/testdir/test_blob.vim b/src/testdir/test_blob.vim index 47315ab84f..4a957aa721 100644 --- a/src/testdir/test_blob.vim +++ b/src/testdir/test_blob.vim @@ -499,10 +499,17 @@ func Test_blob_read_write() VAR br6 = readblob('Xblob', -3, 2) call assert_equal(b[-3 : -2], br6) + #" reading past end of file, empty result VAR br1e = readblob('Xblob', 10000) call assert_equal(0z, br1e) - VAR br2e = readblob('Xblob', -10000) - call assert_equal(0z, br2e) + + #" reading too much, result is truncated + VAR blong = readblob('Xblob', -1000) + call assert_equal(b, blong) + LET blong = readblob('Xblob', -10, 8) + call assert_equal(b, blong) + LET blong = readblob('Xblob', 0, 10) + call assert_equal(b, blong) call delete('Xblob') END -- cgit v1.2.3