diff src/testdir/test_quickfix.vim @ 9538:26da1efa9e46 v7.4.2049

commit https://github.com/vim/vim/commit/f6acffbe83e622542d9fdf3066f51933e46e4954 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 16 16:54:24 2016 +0200 patch 7.4.2049 Problem: There is no way to get a list of the error lists. Solution: Add ":chistory" and ":lhistory".
author Christian Brabandt <cb@256bit.org>
date Sat, 16 Jul 2016 17:00:06 +0200
parents 374afcf9d11d
children 64a791c53418
line wrap: on
line diff
--- a/src/testdir/test_quickfix.vim
+++ b/src/testdir/test_quickfix.vim
@@ -1438,3 +1438,27 @@ function Test_cbottom()
   call XbottomTests('c')
   call XbottomTests('l')
 endfunction
+
+function HistoryTest(cchar)
+  call s:setup_commands(a:cchar)
+
+  call assert_fails(a:cchar . 'older 99', 'E380:')
+  " clear all lists after the first one, then replace the first one.
+  call g:Xsetlist([])
+  Xolder
+  let entry = {'filename': 'foo', 'lnum': 42}
+  call g:Xsetlist([entry], 'r')
+  call g:Xsetlist([entry, entry])
+  call g:Xsetlist([entry, entry, entry])
+  let res = split(execute(a:cchar . 'hist'), "\n")
+  call assert_equal(3, len(res))
+  let common = 'errors     :set' . (a:cchar == 'c' ? 'qf' : 'loc') . 'list()'
+  call assert_equal('  error list 1 of 3; 1 ' . common, res[0])
+  call assert_equal('  error list 2 of 3; 2 ' . common, res[1])
+  call assert_equal('> error list 3 of 3; 3 ' . common, res[2])
+endfunc
+
+func Test_history()
+  call HistoryTest('c')
+  call HistoryTest('l')
+endfunc