Mercurial > vim
comparison src/testdir/test_cmdline.vim @ 10849:6ae12eba42b5 v8.0.0314
patch 8.0.0314: getcmd*() functions are not tested
commit https://github.com/vim/vim/commit/65189a1294307abf007faab7385dc0145ba72b06
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Feb 6 22:22:17 2017 +0100
patch 8.0.0314: getcmd*() functions are not tested
Problem: getcmdtype(), getcmdpos() and getcmdline() are not tested.
Solution: Add tests. (Yegappan Lakshmanan)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Mon, 06 Feb 2017 22:30:03 +0100 |
parents | cc8079703414 |
children | 9a5a4b36a1c1 |
comparison
equal
deleted
inserted
replaced
10848:39f7b3170883 | 10849:6ae12eba42b5 |
---|---|
328 call assert_equal('B', getline(2)) | 328 call assert_equal('B', getline(2)) |
329 | 329 |
330 bwipe! | 330 bwipe! |
331 endfunc | 331 endfunc |
332 | 332 |
333 " Tests for getcmdline(), getcmdpos() and getcmdtype() | |
334 func Check_cmdline(cmdtype) | |
335 call assert_equal('MyCmd a', getcmdline()) | |
336 call assert_equal(8, getcmdpos()) | |
337 call assert_equal(a:cmdtype, getcmdtype()) | |
338 return '' | |
339 endfunc | |
340 | |
341 func Test_getcmdtype() | |
342 call feedkeys(":MyCmd a\<C-R>=Check_cmdline(':')\<CR>\<Esc>", "xt") | |
343 | |
344 let cmdtype = '' | |
345 debuggreedy | |
346 call feedkeys(":debug echo 'test'\<CR>", "t") | |
347 call feedkeys("let cmdtype = \<C-R>=string(getcmdtype())\<CR>\<CR>", "t") | |
348 call feedkeys("cont\<CR>", "xt") | |
349 0debuggreedy | |
350 call assert_equal('>', cmdtype) | |
351 | |
352 call feedkeys("/MyCmd a\<C-R>=Check_cmdline('/')\<CR>\<Esc>", "xt") | |
353 call feedkeys("?MyCmd a\<C-R>=Check_cmdline('?')\<CR>\<Esc>", "xt") | |
354 | |
355 call feedkeys(":call input('Answer?')\<CR>", "t") | |
356 call feedkeys("MyCmd a\<C-R>=Check_cmdline('@')\<CR>\<Esc>", "xt") | |
357 | |
358 call feedkeys(":insert\<CR>MyCmd a\<C-R>=Check_cmdline('-')\<CR>\<Esc>", "xt") | |
359 | |
360 cnoremap <expr> <F6> Check_cmdline('=') | |
361 call feedkeys("a\<C-R>=MyCmd a\<F6>\<Esc>\<Esc>", "xt") | |
362 cunmap <F6> | |
363 endfunc | |
364 | |
333 set cpo& | 365 set cpo& |