Skip to content

Commit eebd84e

Browse files
committed
patch 8.0.0111
Problem: The :history command is not tested. Solution: Add tests. (Dominique Pelle)
1 parent 5a030a5 commit eebd84e

3 files changed

Lines changed: 31 additions & 2 deletions

File tree

runtime/doc/cmdline.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,8 +359,11 @@ terminals)
359359
List entries 6 to 12 from the search history: >
360360
:history / 6,12
361361
<
362-
List the recent five entries from all histories: >
363-
:history all -5,
362+
List the penultimate entry from all histories: >
363+
:history all -2
364+
<
365+
List the most recent two entries from all histories: >
366+
:history all -2,
364367
365368
:keepp[atterns] {command} *:keepp* *:keeppatterns*
366369
Execute {command}, without adding anything to the search

src/testdir/test_history.vim

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,30 @@ function History_Tests(hist)
3131
call assert_equal('ls', histget(a:hist, -1))
3232
call assert_equal(4, histnr(a:hist))
3333

34+
let a=execute('history ' . a:hist)
35+
call assert_match("^\n # \\S* history\n 3 buffers\n> 4 ls$", a)
36+
let a=execute('history all')
37+
call assert_match("^\n # .* history\n 3 buffers\n> 4 ls", a)
38+
39+
if len(a:hist) > 0
40+
let a=execute('history ' . a:hist . ' 2')
41+
call assert_match("^\n # \\S* history$", a)
42+
let a=execute('history ' . a:hist . ' 3')
43+
call assert_match("^\n # \\S* history\n 3 buffers$", a)
44+
let a=execute('history ' . a:hist . ' 4')
45+
call assert_match("^\n # \\S* history\n> 4 ls$", a)
46+
let a=execute('history ' . a:hist . ' 3,4')
47+
call assert_match("^\n # \\S* history\n 3 buffers\n> 4 ls$", a)
48+
let a=execute('history ' . a:hist . ' -1')
49+
call assert_match("^\n # \\S* history\n> 4 ls$", a)
50+
let a=execute('history ' . a:hist . ' -2')
51+
call assert_match("^\n # \\S* history\n 3 buffers$", a)
52+
let a=execute('history ' . a:hist . ' -2,')
53+
call assert_match("^\n # \\S* history\n 3 buffers\n> 4 ls$", a)
54+
let a=execute('history ' . a:hist . ' -3')
55+
call assert_match("^\n # \\S* history$", a)
56+
endif
57+
3458
" Test for removing entries matching a pattern
3559
for i in range(1, 3)
3660
call histadd(a:hist, 'text_' . i)

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
111,
767769
/**/
768770
110,
769771
/**/

0 commit comments

Comments
 (0)