Mercurial > vim
diff src/testdir/test_autocmd.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 | adc2dec6d27d |
children | 27cb0eed6aef |
line wrap: on
line diff
--- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -576,16 +576,26 @@ func Test_BufReadCmdHelpJump() au! BufReadCmd endfunc -" BufReadCmd is triggered for a "nofile" buffer +" BufReadCmd is triggered for a "nofile" buffer. Check all values. func Test_BufReadCmdNofile() - new somefile - set buftype=nofile - au BufReadCmd somefile call setline(1, 'triggered') - edit - call assert_equal('triggered', getline(1)) - - au! BufReadCmd - bwipe! + for val in ['nofile', + \ 'nowrite', + \ 'acwrite', + \ 'quickfix', + \ 'help', + \ 'terminal', + \ 'prompt', + \ 'popup', + \ ] + new somefile + exe 'set buftype=' .. val + au BufReadCmd somefile call setline(1, 'triggered') + edit + call assert_equal('triggered', getline(1)) + + au! BufReadCmd + bwipe! + endfor endfunc func Test_augroup_deleted() @@ -685,15 +695,24 @@ func Test_BufEnter() au! BufEnter " Editing a "nofile" buffer doesn't read the file but does trigger BufEnter - " for historic reasons. - new somefile - set buftype=nofile - au BufEnter somefile call setline(1, 'some text') - edit - call assert_equal('some text', getline(1)) - - bwipe! - au! BufEnter + " for historic reasons. Also test other 'buftype' values. + for val in ['nofile', + \ 'nowrite', + \ 'acwrite', + \ 'quickfix', + \ 'help', + \ 'terminal', + \ 'prompt', + \ 'popup', + \ ] + new somefile + exe 'set buftype=' .. val + au BufEnter somefile call setline(1, 'some text') + edit + call assert_equal('some text', getline(1)) + bwipe! + au! BufEnter + endfor endfunc " Closing a window might cause an endless loop