aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-04-16 00:16:36 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-04-16 16:12:52 +0800
commite24a84f18e59b356925a435d5ee3085842415299 (patch)
tree3a2bedadf303d0f4d7524f915e7cdddce14a0d50 /test
parent0d9b0fbe579343fa6d6c46e6e1bf6bb8719ea5e0 (diff)
downloadrneovim-e24a84f18e59b356925a435d5ee3085842415299.tar.gz
rneovim-e24a84f18e59b356925a435d5ee3085842415299.tar.bz2
rneovim-e24a84f18e59b356925a435d5ee3085842415299.zip
vim-patch:9.0.1064: code for making 'shortmess' temporarily empty is repeated
Problem: Code for making 'shortmess' temporarily empty is repeated. Solution: Add functions for making 'shortmess' empty and restoring it. (Christian Brabandt, closes vim/vim#11709) https://github.com/vim/vim/commit/9aee8ec400fe617f6d82441c46a22d0cef6fa3e6 Co-authored-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/test_autocmd.vim55
1 files changed, 55 insertions, 0 deletions
diff --git a/test/old/testdir/test_autocmd.vim b/test/old/testdir/test_autocmd.vim
index ec671369f5..f0ad5946cc 100644
--- a/test/old/testdir/test_autocmd.vim
+++ b/test/old/testdir/test_autocmd.vim
@@ -3623,5 +3623,60 @@ func Test_autocmd_nested_setbufvar()
%bwipe!
endfunc
+func SetupVimTest_shm()
+ let g:bwe = []
+ let g:brp = []
+ set shortmess+=F
+
+ let dirname='XVimTestSHM'
+ call mkdir(dirname, 'R')
+ call writefile(['test'], dirname .. '/1')
+ call writefile(['test'], dirname .. '/2')
+ call writefile(['test'], dirname .. '/3')
+
+ augroup test
+ autocmd!
+ autocmd BufWinEnter * call add(g:bwe, $'BufWinEnter: {expand('<amatch>')}')
+ autocmd BufReadPost * call add(g:brp, $'BufReadPost: {expand('<amatch>')}')
+ augroup END
+
+ call setqflist([
+ \ {'filename': dirname .. '/1', 'lnum': 1, 'col': 1, 'text': 'test', 'vcol': 0},
+ \ {'filename': dirname .. '/2', 'lnum': 1, 'col': 1, 'text': 'test', 'vcol': 0},
+ \ {'filename': dirname .. '/3', 'lnum': 1, 'col': 1, 'text': 'test', 'vcol': 0}
+ \ ])
+ cdo! substitute/test/TEST
+
+ " clean up
+ noa enew!
+ set shortmess&vim
+ augroup test
+ autocmd!
+ augroup END
+ augroup! test
+endfunc
+
+func Test_autocmd_shortmess()
+ CheckNotMSWindows
+
+ call SetupVimTest_shm()
+ let output = execute(':mess')->split('\n')
+
+ let info = copy(output)->filter({idx, val -> val =~# '\d of 3'} )
+ let bytes = copy(output)->filter({idx, val -> val =~# 'bytes'} )
+
+ " We test the following here:
+ " BufReadPost should have been triggered 3 times, once per file
+ " BufWinEnter should have been triggered 3 times, once per file
+ " FileInfoMessage should have been shown 3 times, regardless of shm option
+ " "(x of 3)" message from :cnext has been shown 3 times
+
+ call assert_equal(3, g:brp->len())
+ call assert_equal(3, g:bwe->len())
+ call assert_equal(3, info->len())
+ call assert_equal(3, bytes->len())
+
+ delfunc SetupVimTest_shm
+endfunc
" vim: shiftwidth=2 sts=2 expandtab