Patch 7.4.1984
Problem:    Not all quickfix features are tested.
Solution:   Add a few more tests. (Yegappan Lakshmanan)
Files:      src/testdir/test_quickfix.vim


*** ../vim-7.4.1983/src/testdir/test_quickfix.vim       2016-07-02 
15:41:41.586523202 +0200
--- src/testdir/test_quickfix.vim       2016-07-02 21:19:34.159152961 +0200
***************
*** 24,29 ****
--- 24,34 ----
      command! -nargs=* Xaddbuffer <mods>caddbuffer <args>
      command! -nargs=* Xrewind <mods>crewind <args>
      command! -nargs=* -bang Xnext <mods>cnext<bang> <args>
+     command! -nargs=* -bang Xprev <mods>cprev<bang> <args>
+     command! -nargs=* -bang Xfirst <mods>cfirst<bang> <args>
+     command! -nargs=* -bang Xlast <mods>clast<bang> <args>
+     command! -nargs=* -bang Xnfile <mods>cnfile<bang> <args>
+     command! -nargs=* -bang Xpfile <mods>cpfile<bang> <args>
      command! -nargs=* Xexpr <mods>cexpr <args>
      command! -nargs=* Xvimgrep <mods>vimgrep <args>
      command! -nargs=* Xgrep <mods> grep <args>
***************
*** 48,53 ****
--- 53,63 ----
      command! -nargs=* Xaddbuffer <mods>laddbuffer <args>
      command! -nargs=* Xrewind <mods>lrewind <args>
      command! -nargs=* -bang Xnext <mods>lnext<bang> <args>
+     command! -nargs=* -bang Xprev <mods>lprev<bang> <args>
+     command! -nargs=* -bang Xfirst <mods>lfirst<bang> <args>
+     command! -nargs=* -bang Xlast <mods>llast<bang> <args>
+     command! -nargs=* -bang Xnfile <mods>lnfile<bang> <args>
+     command! -nargs=* -bang Xpfile <mods>lpfile<bang> <args>
      command! -nargs=* Xexpr <mods>lexpr <args>
      command! -nargs=* Xvimgrep <mods>lvimgrep <args>
      command! -nargs=* Xgrep <mods> lgrep <args>
***************
*** 310,315 ****
--- 320,375 ----
    call XbufferTests('l')
  endfunction
  
+ function XexprTests(cchar)
+   call s:setup_commands(a:cchar)
+ 
+   call assert_fails('Xexpr 10', 'E777:')
+ endfunction
+ 
+ function Test_cexpr()
+   call XexprTests('c')
+   call XexprTests('l')
+ endfunction
+ 
+ " Tests for :cnext, :cprev, :cfirst, :clast commands
+ function Xtest_browse(cchar)
+   call s:setup_commands(a:cchar)
+ 
+   call s:create_test_file('Xqftestfile1')
+   call s:create_test_file('Xqftestfile2')
+ 
+   Xgetexpr ['Xqftestfile1:5:Line5',
+               \ 'Xqftestfile1:6:Line6',
+               \ 'Xqftestfile2:10:Line10',
+               \ 'Xqftestfile2:11:Line11']
+ 
+   Xfirst
+   call assert_fails('Xprev', 'E553')
+   call assert_fails('Xpfile', 'E553')
+   Xnfile
+   call assert_equal('Xqftestfile2', bufname('%'))
+   call assert_equal(10, line('.'))
+   Xpfile
+   call assert_equal('Xqftestfile1', bufname('%'))
+   call assert_equal(6, line('.'))
+   Xlast
+   call assert_equal('Xqftestfile2', bufname('%'))
+   call assert_equal(11, line('.'))
+   call assert_fails('Xnext', 'E553')
+   call assert_fails('Xnfile', 'E553')
+   Xrewind
+   call assert_equal('Xqftestfile1', bufname('%'))
+   call assert_equal(5, line('.'))
+ 
+   call delete('Xqftestfile1')
+   call delete('Xqftestfile2')
+ endfunction
+ 
+ function Test_browse()
+   call Xtest_browse('c')
+   call Xtest_browse('l')
+ endfunction
+ 
  function Test_nomem()
    call test_alloc_fail(GetAllocId('qf_dirname_start'), 0, 0)
    call assert_fails('vimgrep vim runtest.vim', 'E342:')
***************
*** 754,778 ****
    call delete('habits1.txt')
  endfunction
  
  " TODO:
  " Add tests for the following formats in 'errorformat'
! "     %n  %t  %r  %+  %-  %O
  function! Test_efm2()
    let save_efm = &efm
  
-   " Test for invalid efm
-   set efm=%L%M%N
-   call assert_fails('cexpr "abc.txt:1:Hello world"', 'E376:')
-   call assert_fails('lexpr "abc.txt:1:Hello world"', 'E376:')
- 
    " Test for %s format in efm
    set efm=%f:%s
    cexpr 'Xtestfile:Line search text'
- 
    let l = getqflist()
    call assert_equal(l[0].pattern, '^\VLine search text\$')
    call assert_equal(l[0].lnum, 0)
  
    let lines=["[Xtestfile1]",
              \ "(1,17)  error: ';' missing",
              \ "(21,2)  warning: variable 'z' not defined",
--- 814,874 ----
    call delete('habits1.txt')
  endfunction
  
+ " Tests for invalid error format specifies
+ function Xinvalid_efm_Tests(cchar)
+   call s:setup_commands(a:cchar)
+ 
+   let save_efm = &efm
+ 
+   set efm=%f:%l:%m,%f:%f:%l:%m
+   call assert_fails('Xexpr "abc.txt:1:Hello world"', 'E372:')
+ 
+   set efm=%f:%l:%m,%f:%l:%r:%m
+   call assert_fails('Xexpr "abc.txt:1:Hello world"', 'E373:')
+ 
+   set efm=%f:%l:%m,%O:%f:%l:%m
+   call assert_fails('Xexpr "abc.txt:1:Hello world"', 'E373:')
+ 
+   set efm=%f:%l:%m,%f:%l:%*[^a-z
+   call assert_fails('Xexpr "abc.txt:1:Hello world"', 'E374:')
+ 
+   set efm=%f:%l:%m,%f:%l:%*c
+   call assert_fails('Xexpr "abc.txt:1:Hello world"', 'E375:')
+ 
+   set efm=%f:%l:%m,%L%M%N
+   call assert_fails('Xexpr "abc.txt:1:Hello world"', 'E376:')
+ 
+   set efm=%f:%l:%m,%f:%l:%m:%R
+   call assert_fails('Xexpr "abc.txt:1:Hello world"', 'E377:')
+ 
+   set efm=
+   call assert_fails('Xexpr "abc.txt:1:Hello world"', 'E378:')
+ 
+   set efm=%DEntering\ dir\ abc,%f:%l:%m
+   call assert_fails('Xexpr ["Entering dir abc", "abc.txt:1:Hello world"]', 
'E379:')
+ 
+   let &efm = save_efm
+ endfunction
+ 
+ function Test_invalid_efm()
+   call Xinvalid_efm_Tests('c')
+   call Xinvalid_efm_Tests('l')
+ endfunction
+ 
  " TODO:
  " Add tests for the following formats in 'errorformat'
! "     %r  %O
  function! Test_efm2()
    let save_efm = &efm
  
    " Test for %s format in efm
    set efm=%f:%s
    cexpr 'Xtestfile:Line search text'
    let l = getqflist()
    call assert_equal(l[0].pattern, '^\VLine search text\$')
    call assert_equal(l[0].lnum, 0)
  
+   " Test for %P, %Q and %t format specifiers
    let lines=["[Xtestfile1]",
              \ "(1,17)  error: ';' missing",
              \ "(21,2)  warning: variable 'z' not defined",
***************
*** 794,799 ****
--- 890,923 ----
    call assert_equal(9, len(l))
    call assert_equal(21, l[2].lnum)
    call assert_equal(2, l[2].col)
+   call assert_equal('w', l[2].type)
+   call assert_equal('e', l[3].type)
+ 
+   " Tests for %E, %C and %Z format specifiers
+   let lines = ["Error 275",
+             \ "line 42",
+             \ "column 3",
+             \ "' ' expected after '--'"
+             \]
+   set efm=%EError\ %n,%Cline\ %l,%Ccolumn\ %c,%Z%m
+   cgetexpr lines
+   let l = getqflist()
+   call assert_equal(275, l[0].nr)
+   call assert_equal(42, l[0].lnum)
+   call assert_equal(3, l[0].col)
+   call assert_equal('E', l[0].type)
+   call assert_equal("\n' ' expected after '--'", l[0].text)
+ 
+   " Test for %>
+   let lines = ["Error in line 147 of foo.c:",
+             \"unknown variable 'i'"
+             \]
+   set efm=unknown\ variable\ %m,%E%>Error\ in\ line\ %l\ of\ %f:,%Z%m
+   cgetexpr lines
+   let l = getqflist()
+   call assert_equal(147, l[0].lnum)
+   call assert_equal('E', l[0].type)
+   call assert_equal("\nunknown variable 'i'", l[0].text)
  
    let &efm = save_efm
  endfunction
*** ../vim-7.4.1983/src/version.c       2016-07-02 20:27:29.957436300 +0200
--- src/version.c       2016-07-02 21:20:27.334360691 +0200
***************
*** 760,761 ****
--- 760,763 ----
  {   /* Add new patch number below this line */
+ /**/
+     1984,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
187. You promise yourself that you'll only stay online for another
     15 minutes...at least once every hour.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
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.

Raspunde prin e-mail lui