Hi,

I am attaching a patch to add tests for the getcmdtype(), getcmdpos()
and getcmdline() functions.

- Yegappan

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index aa8fb13..0a5c910 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -330,4 +330,36 @@ func Test_cmdline_search_range()
   bwipe!
 endfunc
 
+" Tests for getcmdline(), getcmdpos() and getcmdtype()
+func Check_cmdline(cmdtype)
+  call assert_equal('MyCmd a', getcmdline())
+  call assert_equal(8, getcmdpos())
+  call assert_equal(a:cmdtype, getcmdtype())
+  return ''
+endfunc
+
+func Test_getcmdtype()
+  call feedkeys(":MyCmd a\<C-R>=Check_cmdline(':')\<CR>\<Esc>", "xt")
+
+  let cmdtype = ''
+  debuggreedy
+  call feedkeys(":debug echo 'test'\<CR>", "t")
+  call feedkeys("let cmdtype = \<C-R>=string(getcmdtype())\<CR>\<CR>", "t")
+  call feedkeys("cont\<CR>", "xt")
+  0debuggreedy
+  call assert_equal('>', cmdtype)
+
+  call feedkeys("/MyCmd a\<C-R>=Check_cmdline('/')\<CR>\<Esc>", "xt")
+  call feedkeys("?MyCmd a\<C-R>=Check_cmdline('?')\<CR>\<Esc>", "xt")
+
+  call feedkeys(":call input('Answer?')\<CR>", "t")
+  call feedkeys("MyCmd a\<C-R>=Check_cmdline('@')\<CR>\<Esc>", "xt")
+
+  call feedkeys(":insert\<CR>MyCmd a\<C-R>=Check_cmdline('-')\<CR>\<Esc>", 
"xt")
+
+  cnoremap <expr> <F6> Check_cmdline('=')
+  call feedkeys("a\<C-R>=MyCmd a\<F6>\<Esc>\<Esc>", "xt")
+  cunmap <F6>
+endfunc
+
 set cpo&

Raspunde prin e-mail lui