diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2023-02-28 19:29:59 +0800 |
|---|---|---|
| committer | zeertzjq <zeertzjq@outlook.com> | 2023-02-28 19:52:45 +0800 |
| commit | 7aad75e293e3a01e292308ca2058e35083b83280 (patch) | |
| tree | 7198c028ad1b012b9b0710d697df0b3ea95fd76d /src/nvim/testdir | |
| parent | 4bd0611d7b07b56fc5a9e121669a313166ba540f (diff) | |
| download | rneovim-7aad75e293e3a01e292308ca2058e35083b83280.tar.gz rneovim-7aad75e293e3a01e292308ca2058e35083b83280.tar.bz2 rneovim-7aad75e293e3a01e292308ca2058e35083b83280.zip | |
vim-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.
https://github.com/vim/vim/commit/5b2a3d77d320d76f12b1666938a9d58c2a848205
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src/nvim/testdir')
| -rw-r--r-- | src/nvim/testdir/test_blob.vim | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/nvim/testdir/test_blob.vim b/src/nvim/testdir/test_blob.vim index 5fc232119c..b01d9309fa 100644 --- a/src/nvim/testdir/test_blob.vim +++ b/src/nvim/testdir/test_blob.vim @@ -450,10 +450,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 |