]> granicus.if.org Git - vim/commitdiff
patch 8.0.0111 v8.0.0111
authorBram Moolenaar <Bram@vim.org>
Thu, 1 Dec 2016 16:57:44 +0000 (17:57 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 1 Dec 2016 16:57:44 +0000 (17:57 +0100)
Problem:    The :history command is not tested.
Solution:   Add tests. (Dominique Pelle)

runtime/doc/cmdline.txt
src/testdir/test_history.vim
src/version.c

index 8eb3a9394d7770da8995ec4225eb2e985ecda2ed..e05e6d36e8ece2814bce1e2cf0e05cd6c8132102 100644 (file)
@@ -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
index ee6acfffc3c7810e271f972633d420a0da98d8d9..243ede7517165f513e351b6a2ff4368bd42cd6f3 100644 (file)
@@ -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)
index c9fc5727df9a5ed17395aed7f9e28d6555a98f69..75e1222ac981586becd6d0517ab666721a98385e 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    111,
 /**/
     110,
 /**/