summaryrefslogtreecommitdiffstats
path: root/src/testdir
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-08-25 12:45:21 +0100
committerBram Moolenaar <Bram@vim.org>2022-08-25 12:45:21 +0100
commit2eddbacd6dc17c84e4bdc41e60e81949a36bb973 (patch)
treee408f43fe5348de1725340122ded24d66e673364 /src/testdir
parentd6c67629ed05aae436164eec474832daf8ba7420 (diff)
patch 9.0.0261: bufload() reads a file even if the name is not a file namev9.0.0261
Problem: bufload() reads a file even if the name is not a file name. (Cyker Way) Solution: Do not read the file when the buffer name is not a file name. (closes #10975)
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/test_functions.vim7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index 38cd7930af..68970407ce 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -2368,6 +2368,13 @@ func Test_bufadd_bufload()
exe 'bwipe ' .. buf2
call assert_equal(0, bufexists(buf2))
+ " when 'buftype' is "nofile" then bufload() does not read the file
+ bwipe! XotherName
+ let buf = bufadd('XotherName')
+ call setbufvar(buf, '&bt', 'nofile')
+ call bufload(buf)
+ call assert_equal([''], getbufline(buf, 1, '$'))
+
bwipe someName
bwipe XotherName
call assert_equal(0, bufexists('someName'))