From d079995fb81bf3d61f7698373442f61476b99fce Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 12 Jul 2022 08:28:56 +0800 Subject: vim-patch:8.2.0270: some code not covered by tests Problem: Some code not covered by tests. Solution: Add test cases. (Yegappan Lakshmanan, closes vim/vim#5649) https://github.com/vim/vim/commit/bc2b71d44a0b90b6aeb3534a76912fccbe5577df --- src/nvim/testdir/test_excmd.vim | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src/nvim/testdir/test_excmd.vim') diff --git a/src/nvim/testdir/test_excmd.vim b/src/nvim/testdir/test_excmd.vim index ff5c28d54a..5513892dc7 100644 --- a/src/nvim/testdir/test_excmd.vim +++ b/src/nvim/testdir/test_excmd.vim @@ -437,6 +437,16 @@ func Test_redir_cmd() call assert_fails('redir! > Xfile', 'E190:') call delete('Xfile') endif + + " Test for redirecting to a register + redir @q> | echon 'clean ' | redir END + redir @q>> | echon 'water' | redir END + call assert_equal('clean water', @q) + + " Test for redirecting to a variable + redir => color | echon 'blue ' | redir END + redir =>> color | echon 'sky' | redir END + call assert_equal('blue sky', color) endfunc " Test for the :filetype command @@ -449,6 +459,30 @@ func Test_mode_cmd() call assert_fails('mode abc', 'E359:') endfunc +" Test for the :sleep command +func Test_sleep_cmd() + call assert_fails('sleep x', 'E475:') +endfunc + +" Test for the :read command +func Test_read_cmd() + call writefile(['one'], 'Xfile') + new + call assert_fails('read', 'E32:') + edit Xfile + read + call assert_equal(['one', 'one'], getline(1, '$')) + close! + new + read Xfile + call assert_equal(['', 'one'], getline(1, '$')) + call deletebufline('', 1, '$') + call feedkeys("Qr Xfile\visual\", 'xt') + call assert_equal(['one'], getline(1, '$')) + close! + call delete('Xfile') +endfunc + " Test for running Ex commands when text is locked. " e in the command line is used to lock the text func Test_run_excmd_with_text_locked() -- cgit