Mercurial > vim
comparison src/testdir/test_excmd.vim @ 19425:67fbe280a502 v8.2.0270
patch 8.2.0270: some code not covered by tests
Commit: https://github.com/vim/vim/commit/bc2b71d44a0b90b6aeb3534a76912fccbe5577df
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Feb 17 21:33:30 2020 +0100
patch 8.2.0270: some code not covered by tests
Problem: Some code not covered by tests.
Solution: Add test cases. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5649)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 17 Feb 2020 21:45:04 +0100 |
parents | 02111977dd05 |
children | 8f8a5a15d00a |
comparison
equal
deleted
inserted
replaced
19424:38c3f2b16596 | 19425:67fbe280a502 |
---|---|
265 call writefile([], 'Xfile') | 265 call writefile([], 'Xfile') |
266 call setfperm('Xfile', 'r--r--r--') | 266 call setfperm('Xfile', 'r--r--r--') |
267 call assert_fails('redir! > Xfile', 'E190:') | 267 call assert_fails('redir! > Xfile', 'E190:') |
268 call delete('Xfile') | 268 call delete('Xfile') |
269 endif | 269 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) | |
270 endfunc | 280 endfunc |
271 | 281 |
272 " Test for the :filetype command | 282 " Test for the :filetype command |
273 func Test_filetype_cmd() | 283 func Test_filetype_cmd() |
274 call assert_fails('filetype abc', 'E475:') | 284 call assert_fails('filetype abc', 'E475:') |
277 " Test for the :mode command | 287 " Test for the :mode command |
278 func Test_mode_cmd() | 288 func Test_mode_cmd() |
279 call assert_fails('mode abc', 'E359:') | 289 call assert_fails('mode abc', 'E359:') |
280 endfunc | 290 endfunc |
281 | 291 |
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 | |
282 " vim: shiftwidth=2 sts=2 expandtab | 338 " vim: shiftwidth=2 sts=2 expandtab |