changeset 10434:f3bb76ec4155 v8.0.0111

commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Dec 1 17:57:44 2016 +0100 patch 8.0.0111 Problem: The :history command is not tested. Solution: Add tests. (Dominique Pelle)
author Christian Brabandt <cb@256bit.org>
date Thu, 01 Dec 2016 18:00:04 +0100
parents 08803a35b735
children 989d9cb41882
files runtime/doc/cmdline.txt src/testdir/test_history.vim src/version.c
diffstat 3 files changed, 31 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/doc/cmdline.txt
+++ b/runtime/doc/cmdline.txt
@@ -359,8 +359,11 @@ terminals)
 		List entries 6 to 12 from the search history: >
 			:history / 6,12
 <
-		List the recent five entries from all histories: >
-			:history all -5,
+		List the penultimate entry from all histories: >
+			:history all -2
+<
+		List the most recent two entries from all histories: >
+			:history all -2,
 
 :keepp[atterns] {command}			*:keepp* *:keeppatterns*
 		Execute {command}, without adding anything to the search
--- a/src/testdir/test_history.vim
+++ b/src/testdir/test_history.vim
@@ -31,6 +31,30 @@ function History_Tests(hist)
   call assert_equal('ls', histget(a:hist, -1))
   call assert_equal(4, histnr(a:hist))
 
+  let a=execute('history ' . a:hist)
+  call assert_match("^\n      #  \\S* history\n      3  buffers\n>     4  ls$", a)
+  let a=execute('history all')
+  call assert_match("^\n      #  .* history\n      3  buffers\n>     4  ls", a)
+
+  if len(a:hist) > 0
+    let a=execute('history ' . a:hist . ' 2')
+    call assert_match("^\n      #  \\S* history$", a)
+    let a=execute('history ' . a:hist . ' 3')
+    call assert_match("^\n      #  \\S* history\n      3  buffers$", a)
+    let a=execute('history ' . a:hist . ' 4')
+    call assert_match("^\n      #  \\S* history\n>     4  ls$", a)
+    let a=execute('history ' . a:hist . ' 3,4')
+    call assert_match("^\n      #  \\S* history\n      3  buffers\n>     4  ls$", a)
+    let a=execute('history ' . a:hist . ' -1')
+    call assert_match("^\n      #  \\S* history\n>     4  ls$", a)
+    let a=execute('history ' . a:hist . ' -2')
+    call assert_match("^\n      #  \\S* history\n      3  buffers$", a)
+    let a=execute('history ' . a:hist . ' -2,')
+    call assert_match("^\n      #  \\S* history\n      3  buffers\n>     4  ls$", a)
+    let a=execute('history ' . a:hist . ' -3')
+    call assert_match("^\n      #  \\S* history$", a)
+  endif
+
   " Test for removing entries matching a pattern
   for i in range(1, 3)
       call histadd(a:hist, 'text_' . i)
--- a/src/version.c
+++ b/src/version.c
@@ -765,6 +765,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    111,
+/**/
     110,
 /**/
     109,