diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-02-28 19:04:32 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-02-28 19:52:45 +0800 |
commit | bfa0bc7df0ca527fcec49dbd2055f1bac438663e (patch) | |
tree | 9b654edacf1b0f91bbf79b70b3fceec8d4e911b5 /src/nvim/testdir | |
parent | 3b927762264c27aaeb31b83ba2e4924d5312ddcc (diff) | |
download | rneovim-bfa0bc7df0ca527fcec49dbd2055f1bac438663e.tar.gz rneovim-bfa0bc7df0ca527fcec49dbd2055f1bac438663e.tar.bz2 rneovim-bfa0bc7df0ca527fcec49dbd2055f1bac438663e.zip |
vim-patch:9.0.0795: readblob() always reads the whole file
Problem: readblob() always reads the whole file.
Solution: Add arguments to read part of the file. (Ken Takata,
closes vim/vim#11402)
https://github.com/vim/vim/commit/11df3aeee548b959ccd4b9a4d3c44651eab6b3ce
Remove trailing whitespace in test as done in patch 9.0.1257.
Move the help for rand() before range().
Co-authored-by: K.Takata <kentkt@csc.jp>
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r-- | src/nvim/testdir/test_blob.vim | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_blob.vim b/src/nvim/testdir/test_blob.vim index b1859f9dfe..dd37fb2f11 100644 --- a/src/nvim/testdir/test_blob.vim +++ b/src/nvim/testdir/test_blob.vim @@ -439,10 +439,29 @@ func Test_blob_read_write() call writefile(b, 'Xblob') VAR br = readfile('Xblob', 'B') call assert_equal(b, br) + VAR br2 = readblob('Xblob') + call assert_equal(b, br2) + VAR br3 = readblob('Xblob', 1) + call assert_equal(b[1 :], br3) + VAR br4 = readblob('Xblob', 1, 2) + call assert_equal(b[1 : 2], br4) + VAR br5 = readblob('Xblob', -3) + call assert_equal(b[-3 :], br5) + VAR br6 = readblob('Xblob', -3, 2) + call assert_equal(b[-3 : -2], br6) + + VAR br1e = readblob('Xblob', 10000) + call assert_equal(0z, br1e) + VAR br2e = readblob('Xblob', -10000) + call assert_equal(0z, br2e) + call delete('Xblob') END call CheckLegacyAndVim9Success(lines) + call assert_fails("call readblob('notexist')", 'E484:') + " TODO: How do we test for the E485 error? + " This was crashing when calling readfile() with a directory. call assert_fails("call readfile('.', 'B')", 'E17: "." is a directory') endfunc |