comparison src/testdir/test_autocmd.vim @ 33848:c3804ff17204 v9.0.2135

patch 9.0.2135: No test for mode() when executing Ex commands Commit: https://github.com/vim/vim/commit/fcaeb3d42b228e73c669b2fce78f1d3fe112769f Author: zeertzjq <zeertzjq@outlook.com> Date: Tue Nov 28 20:46:29 2023 +0100 patch 9.0.2135: No test for mode() when executing Ex commands Problem: No test for mode() when executing Ex commands Solution: Add some test cases and simplify several other test cases. Also add a few more test cases for ModeChanged. closes: #13588 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Tue, 28 Nov 2023 21:00:06 +0100
parents 46cd1fc257de
children f2d904d44ebd
comparison
equal deleted inserted replaced
33847:11f5d2f8c13e 33848:c3804ff17204
3778 let g:mode_seq += ['c', 'n', 'c', 'n'] 3778 let g:mode_seq += ['c', 'n', 'c', 'n']
3779 call feedkeys("q:\<C-C>\<Esc>", 'tnix') 3779 call feedkeys("q:\<C-C>\<Esc>", 'tnix')
3780 call assert_equal(len(g:mode_seq) - 1, g:index) 3780 call assert_equal(len(g:mode_seq) - 1, g:index)
3781 call assert_equal(2, g:n_to_c) 3781 call assert_equal(2, g:n_to_c)
3782 call assert_equal(2, g:c_to_n) 3782 call assert_equal(2, g:c_to_n)
3783 unlet g:n_to_c
3784 unlet g:c_to_n
3785 3783
3786 let g:n_to_v = 0 3784 let g:n_to_v = 0
3787 au ModeChanged n:v let g:n_to_v += 1 3785 au ModeChanged n:v let g:n_to_v += 1
3788 let g:v_to_n = 0 3786 let g:v_to_n = 0
3789 au ModeChanged v:n let g:v_to_n += 1 3787 au ModeChanged v:n let g:v_to_n += 1
3790 let g:mode_seq += ['v', 'n'] 3788 let g:mode_seq += ['v', 'n']
3791 call feedkeys("v\<C-C>", 'tnix') 3789 call feedkeys("v\<C-C>", 'tnix')
3792 call assert_equal(len(g:mode_seq) - 1, g:index) 3790 call assert_equal(len(g:mode_seq) - 1, g:index)
3793 call assert_equal(1, g:n_to_v) 3791 call assert_equal(1, g:n_to_v)
3794 call assert_equal(1, g:v_to_n) 3792 call assert_equal(1, g:v_to_n)
3795 unlet g:n_to_v 3793
3796 unlet g:v_to_n 3794 let g:mode_seq += ['c', 'cr', 'c', 'cr', 'n']
3795 call feedkeys(":\<Insert>\<Insert>\<Insert>\<CR>", 'tnix')
3796 call assert_equal(len(g:mode_seq) - 1, g:index)
3797 3797
3798 au! ModeChanged 3798 au! ModeChanged
3799 delfunc TestMode 3799 delfunc TestMode
3800 unlet! g:mode_seq 3800 unlet! g:mode_seq
3801 unlet! g:index 3801 unlet! g:index
3806 unlet! g:niI_to_i 3806 unlet! g:niI_to_i
3807 unlet! g:nany_to_i 3807 unlet! g:nany_to_i
3808 unlet! g:i_to_n 3808 unlet! g:i_to_n
3809 unlet! g:nori_to_any 3809 unlet! g:nori_to_any
3810 unlet! g:i_to_any 3810 unlet! g:i_to_any
3811 unlet! g:n_to_c
3812 unlet! g:c_to_n
3813 unlet! g:n_to_v
3814 unlet! g:v_to_n
3811 endfunc 3815 endfunc
3812 3816
3813 func Test_recursive_ModeChanged() 3817 func Test_recursive_ModeChanged()
3814 au! ModeChanged * norm 0u 3818 au! ModeChanged * norm 0u
3815 sil! norm  3819 sil! norm