comparison 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
comparison
equal deleted inserted replaced
29874:fd1e8bf02d4b 29875:cb4d95b545f1
574 call assert_fails('help', 'E434:') 574 call assert_fails('help', 'E434:')
575 575
576 au! BufReadCmd 576 au! BufReadCmd
577 endfunc 577 endfunc
578 578
579 " BufReadCmd is triggered for a "nofile" buffer 579 " BufReadCmd is triggered for a "nofile" buffer. Check all values.
580 func Test_BufReadCmdNofile() 580 func Test_BufReadCmdNofile()
581 new somefile 581 for val in ['nofile',
582 set buftype=nofile 582 \ 'nowrite',
583 au BufReadCmd somefile call setline(1, 'triggered') 583 \ 'acwrite',
584 edit 584 \ 'quickfix',
585 call assert_equal('triggered', getline(1)) 585 \ 'help',
586 586 \ 'terminal',
587 au! BufReadCmd 587 \ 'prompt',
588 bwipe! 588 \ 'popup',
589 \ ]
590 new somefile
591 exe 'set buftype=' .. val
592 au BufReadCmd somefile call setline(1, 'triggered')
593 edit
594 call assert_equal('triggered', getline(1))
595
596 au! BufReadCmd
597 bwipe!
598 endfor
589 endfunc 599 endfunc
590 600
591 func Test_augroup_deleted() 601 func Test_augroup_deleted()
592 " This caused a crash before E936 was introduced 602 " This caused a crash before E936 was introduced
593 augroup x 603 augroup x
683 bwipe! Xdir 693 bwipe! Xdir
684 call delete('Xdir', 'd') 694 call delete('Xdir', 'd')
685 au! BufEnter 695 au! BufEnter
686 696
687 " Editing a "nofile" buffer doesn't read the file but does trigger BufEnter 697 " Editing a "nofile" buffer doesn't read the file but does trigger BufEnter
688 " for historic reasons. 698 " for historic reasons. Also test other 'buftype' values.
689 new somefile 699 for val in ['nofile',
690 set buftype=nofile 700 \ 'nowrite',
691 au BufEnter somefile call setline(1, 'some text') 701 \ 'acwrite',
692 edit 702 \ 'quickfix',
693 call assert_equal('some text', getline(1)) 703 \ 'help',
694 704 \ 'terminal',
695 bwipe! 705 \ 'prompt',
696 au! BufEnter 706 \ 'popup',
707 \ ]
708 new somefile
709 exe 'set buftype=' .. val
710 au BufEnter somefile call setline(1, 'some text')
711 edit
712 call assert_equal('some text', getline(1))
713 bwipe!
714 au! BufEnter
715 endfor
697 endfunc 716 endfunc
698 717
699 " Closing a window might cause an endless loop 718 " Closing a window might cause an endless loop
700 " E814 for older Vims 719 " E814 for older Vims
701 func Test_autocmd_bufwipe_in_SessLoadPost() 720 func Test_autocmd_bufwipe_in_SessLoadPost()