aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_excmd.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-07-08 17:43:05 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-07-12 05:36:33 +0800
commit27fd17a79cd2c51e71077bdd896635188ad711b5 (patch)
tree7203add5f3ae1ca1dcc32334beb5f985543cb37c /src/nvim/testdir/test_excmd.vim
parenteea6a4f2a0ad089e0f92dfbc54c92d88c9fea51e (diff)
downloadrneovim-27fd17a79cd2c51e71077bdd896635188ad711b5.tar.gz
rneovim-27fd17a79cd2c51e71077bdd896635188ad711b5.tar.bz2
rneovim-27fd17a79cd2c51e71077bdd896635188ad711b5.zip
vim-patch:8.2.0243: insufficient code coverage for ex_docmd.c functions
Problem: Insufficient code coverage for ex_docmd.c functions. Solution: Add more tests. (Yegappan Lakshmanan, closes vim/vim#5618) https://github.com/vim/vim/commit/9f6277bdde97b7767ded43a0b5a2023eb601b3b7 Cherry-pick Test_window_only() from patch 8.2.0203. Cherry-pick a memory leak fix from patch 8.2.0399.
Diffstat (limited to 'src/nvim/testdir/test_excmd.vim')
-rw-r--r--src/nvim/testdir/test_excmd.vim33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_excmd.vim b/src/nvim/testdir/test_excmd.vim
index df2cf97633..9b59792696 100644
--- a/src/nvim/testdir/test_excmd.vim
+++ b/src/nvim/testdir/test_excmd.vim
@@ -22,6 +22,7 @@ func Test_range_error()
call assert_fails(':\/echo 1', 'E481:')
normal vv
call assert_fails(":'<,'>echo 1", 'E481:')
+ call assert_fails(":\\xcenter", 'E10:')
endfunc
func Test_buffers_lastused()
@@ -391,6 +392,11 @@ func Test_confirm_write_partial_file()
call delete('Xscript')
endfunc
+" Test for the :print command
+func Test_print_cmd()
+ call assert_fails('print', 'E749:')
+endfunc
+
" Test for the :winsize command
func Test_winsize_cmd()
call assert_fails('winsize 1', 'E465:')
@@ -399,6 +405,33 @@ func Test_winsize_cmd()
" Actually changing the window size would be flaky.
endfunc
+" Test for the :redir command
+func Test_redir_cmd()
+ call assert_fails('redir @@', 'E475:')
+ call assert_fails('redir abc', 'E475:')
+ if has('unix')
+ call mkdir('Xdir')
+ call assert_fails('redir > Xdir', 'E17:')
+ call delete('Xdir', 'd')
+ endif
+ if !has('bsd')
+ call writefile([], 'Xfile')
+ call setfperm('Xfile', 'r--r--r--')
+ call assert_fails('redir! > Xfile', 'E190:')
+ call delete('Xfile')
+ endif
+endfunc
+
+" Test for the :filetype command
+func Test_filetype_cmd()
+ call assert_fails('filetype abc', 'E475:')
+endfunc
+
+" Test for the :mode command
+func Test_mode_cmd()
+ call assert_fails('mode abc', 'E359:')
+endfunc
+
" Test for running Ex commands when text is locked.
" <C-\>e in the command line is used to lock the text
func Test_run_excmd_with_text_locked()