@@ -267,6 +267,16 @@ func Test_redir_cmd()
267267 call assert_fails (' redir! > Xfile' , ' E190:' )
268268 call delete (' Xfile' )
269269 endif
270+
271+ " Test for redirecting to a register
272+ redir @q > | echon ' clean ' | redir END
273+ redir @q >> | echon ' water' | redir END
274+ call assert_equal (' clean water' , @q )
275+
276+ " Test for redirecting to a variable
277+ redir = > color | echon ' blue ' | redir END
278+ redir = >> color | echon ' sky' | redir END
279+ call assert_equal (' blue sky' , color )
270280endfunc
271281
272282" Test for the :filetype command
@@ -279,4 +289,50 @@ func Test_mode_cmd()
279289 call assert_fails (' mode abc' , ' E359:' )
280290endfunc
281291
292+ " Test for the :sleep command
293+ func Test_sleep_cmd ()
294+ call assert_fails (' sleep x' , ' E475:' )
295+ endfunc
296+
297+ " Test for the :read command
298+ func Test_read_cmd ()
299+ call writefile ([' one' ], ' Xfile' )
300+ new
301+ call assert_fails (' read' , ' E32:' )
302+ edit Xfile
303+ read
304+ call assert_equal ([' one' , ' one' ], getline (1 , ' $' ))
305+ close !
306+ new
307+ read Xfile
308+ call assert_equal ([' ' , ' one' ], getline (1 , ' $' ))
309+ call deletebufline (' ' , 1 , ' $' )
310+ call feedkeys (" Qr Xfile\<CR> visual\<CR> " , ' xt' )
311+ call assert_equal ([' one' ], getline (1 , ' $' ))
312+ close !
313+ call delete (' Xfile' )
314+ endfunc
315+
316+ " Test for running Ex commands when text is locked.
317+ " <C-\>e in the command line is used to lock the text
318+ func Test_run_excmd_with_text_locked ()
319+ " :quit
320+ let cmd = " :\<C-\>eexecute('quit')\<CR>\<C-C> "
321+ call assert_fails (" call feedkeys(cmd, 'xt')" , ' E523:' )
322+
323+ " :qall
324+ let cmd = " :\<C-\>eexecute('qall')\<CR>\<C-C> "
325+ call assert_fails (" call feedkeys(cmd, 'xt')" , ' E523:' )
326+
327+ " :exit
328+ let cmd = " :\<C-\>eexecute('exit')\<CR>\<C-C> "
329+ call assert_fails (" call feedkeys(cmd, 'xt')" , ' E523:' )
330+
331+ " :close - should be ignored
332+ new
333+ let cmd = " :\<C-\>eexecute('close')\<CR>\<C-C> "
334+ call assert_equal (2 , winnr (' $' ))
335+ close
336+ endfunc
337+
282338" vim: shiftwidth = 2 sts = 2 expandtab
0 commit comments