diff src/testdir/test_functions.vim @ 29875:cb4d95b545f1 v9.0.0276

patch 9.0.0276: 'buftype' values not sufficiently tested Commit: https://github.com/vim/vim/commit/93f72cc119c796f1ccb75468ef9e446cbfb41e9b Author: zeertzjq <zeertzjq@outlook.com> Date: Fri Aug 26 15:34:52 2022 +0100 patch 9.0.0276: 'buftype' values not sufficiently tested Problem: 'buftype' values not sufficiently tested. Solution: Add and extend tests with 'buftype' values. (closes https://github.com/vim/vim/issues/10988)
author Bram Moolenaar <Bram@vim.org>
date Fri, 26 Aug 2022 16:45:03 +0200
parents a4eab0d846dc
children d891115c0aea
line wrap: on
line diff
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -2368,19 +2368,23 @@ 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, '$'))
-
-  " when 'buftype' is "acwrite" then bufload() DOES read the file
-  bwipe! XotherName
-  let buf = bufadd('XotherName')
-  call setbufvar(buf, '&bt', 'acwrite')
-  call bufload(buf)
-  call assert_equal(['some', 'text'], getbufline(buf, 1, '$'))
+  " When 'buftype' is "nofile" then bufload() does not read the file.
+  " Other values too.
+  for val in [['nofile', 0],
+            \ ['nowrite', 1],
+            \ ['acwrite', 1],
+            \ ['quickfix', 0],
+            \ ['help', 1],
+            \ ['terminal', 0],
+            \ ['prompt', 0],
+            \ ['popup', 0],
+            \ ]
+    bwipe! XotherName
+    let buf = bufadd('XotherName')
+    call setbufvar(buf, '&bt', val[0])
+    call bufload(buf)
+    call assert_equal(val[1] ? ['some', 'text'] : [''], getbufline(buf, 1, '$'), val[0])
+  endfor
 
   bwipe someName
   bwipe XotherName