Mercurial > vim
annotate src/testdir/test_history.vim @ 33420:aa7cd2253130 v9.0.1968
patch 9.0.1968: cmdline completion should consider key option
Commit: https://github.com/vim/vim/commit/6ee7b521fa7531ef356ececc8be7575c3800f872
Author: Yee Cheng Chin <ychin.git@gmail.com>
Date: Sun Oct 1 09:13:22 2023 +0200
patch 9.0.1968: cmdline completion should consider key option
Problem: cmdline completion should consider key option
Solution: Disable cmdline completion for key option, slightly
refactor how P_NO_CMD_EXPAND is handled
Harden crypto 'key' option: turn off cmdline completion, disable set-=
"set-=" can be used maliciously with a crypto key, as it allows an
attacker (who either has access to the computer or a plugin author) to
guess a substring by observing the modified state. Simply turn off
set+=/-=/^= for this option as there is no good reason for them to be
used.
Update docs to make that clear as well.
Also, don't allow cmdline completion for 'key' as it just shows *****
which is not useful and confusing to the user what it means (if the user
accidentally hits enter they will have replaced their key with "*****"
instead).
Move logic to better location, don't use above 32-bit for flags
Move P_NO_CMD_EXPAND to use the unused 0x20 instead of going above
32-bits, as currently the flags parameter is only 32-bits on some
systems. Left a comment to warn that future additions will need to
change how the flags work either by making it 64-bit or split into two
member vars.
Also, move the logic for detecting P_NO_CMD_EXPAND earlier so it's not
up to each handler to decide, and you won't see the temporary "..." that
Vim shows while waiting for completion handler to complete.
closes: #13224
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 01 Oct 2023 09:30:03 +0200 |
parents | 7dbd3a65a04b |
children | ca0229869b38 |
rev | line source |
---|---|
8406
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Tests for the history functions |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
17089
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
17049
diff
changeset
|
3 source check.vim |
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
17049
diff
changeset
|
4 CheckFeature cmdline_hist |
8406
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 set history=7 |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 function History_Tests(hist) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 " First clear the history |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 call histadd(a:hist, 'dummy') |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 call assert_true(histdel(a:hist)) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 call assert_equal(-1, histnr(a:hist)) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 call assert_equal('', histget(a:hist)) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 |
17914
af3d441845cd
patch 8.1.1953: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
15 call assert_true('ls'->histadd(a:hist)) |
8406
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 call assert_true(histadd(a:hist, 'buffers')) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 call assert_equal('buffers', histget(a:hist)) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 call assert_equal('ls', histget(a:hist, -2)) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 call assert_equal('ls', histget(a:hist, 1)) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 call assert_equal('', histget(a:hist, 5)) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 call assert_equal('', histget(a:hist, -5)) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 call assert_equal(2, histnr(a:hist)) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 call assert_true(histdel(a:hist, 2)) |
17914
af3d441845cd
patch 8.1.1953: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
24 call assert_false(a:hist->histdel(7)) |
8406
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 call assert_equal(1, histnr(a:hist)) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 call assert_equal('ls', histget(a:hist, -1)) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 call assert_true(histadd(a:hist, 'buffers')) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 call assert_true(histadd(a:hist, 'ls')) |
17914
af3d441845cd
patch 8.1.1953: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
30 call assert_equal('ls', a:hist->histget(-1)) |
af3d441845cd
patch 8.1.1953: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
31 call assert_equal(4, a:hist->histnr()) |
8406
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 |
10434
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
33 let a=execute('history ' . a:hist) |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
34 call assert_match("^\n # \\S* history\n 3 buffers\n> 4 ls$", a) |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
35 let a=execute('history all') |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
36 call assert_match("^\n # .* history\n 3 buffers\n> 4 ls", a) |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
37 |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
38 if len(a:hist) > 0 |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
39 let a=execute('history ' . a:hist . ' 2') |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
40 call assert_match("^\n # \\S* history$", a) |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
41 let a=execute('history ' . a:hist . ' 3') |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
42 call assert_match("^\n # \\S* history\n 3 buffers$", a) |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
43 let a=execute('history ' . a:hist . ' 4') |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
44 call assert_match("^\n # \\S* history\n> 4 ls$", a) |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
45 let a=execute('history ' . a:hist . ' 3,4') |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
46 call assert_match("^\n # \\S* history\n 3 buffers\n> 4 ls$", a) |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
47 let a=execute('history ' . a:hist . ' -1') |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
48 call assert_match("^\n # \\S* history\n> 4 ls$", a) |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
49 let a=execute('history ' . a:hist . ' -2') |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
50 call assert_match("^\n # \\S* history\n 3 buffers$", a) |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
51 let a=execute('history ' . a:hist . ' -2,') |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
52 call assert_match("^\n # \\S* history\n 3 buffers\n> 4 ls$", a) |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
53 let a=execute('history ' . a:hist . ' -3') |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
54 call assert_match("^\n # \\S* history$", a) |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
55 endif |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
56 |
8406
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 " Test for removing entries matching a pattern |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 for i in range(1, 3) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 call histadd(a:hist, 'text_' . i) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 endfor |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
61 call assert_true(histdel(a:hist, 'text_\d\+')) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
62 call assert_equal('ls', histget(a:hist, -1)) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
63 |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
64 " Test for freeing the entire history list |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 for i in range(1, 7) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
66 call histadd(a:hist, 'text_' . i) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
67 endfor |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
68 call histdel(a:hist) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
69 for i in range(1, 7) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
70 call assert_equal('', histget(a:hist, i)) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
71 call assert_equal('', histget(a:hist, i - 7 - 1)) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
72 endfor |
19536
bab20768e1fd
patch 8.2.0325: ex_getln.c code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19517
diff
changeset
|
73 |
bab20768e1fd
patch 8.2.0325: ex_getln.c code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19517
diff
changeset
|
74 " Test for freeing an entry at the beginning of the history list |
bab20768e1fd
patch 8.2.0325: ex_getln.c code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19517
diff
changeset
|
75 for i in range(1, 4) |
bab20768e1fd
patch 8.2.0325: ex_getln.c code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19517
diff
changeset
|
76 call histadd(a:hist, 'text_' . i) |
bab20768e1fd
patch 8.2.0325: ex_getln.c code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19517
diff
changeset
|
77 endfor |
bab20768e1fd
patch 8.2.0325: ex_getln.c code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19517
diff
changeset
|
78 call histdel(a:hist, 1) |
bab20768e1fd
patch 8.2.0325: ex_getln.c code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19517
diff
changeset
|
79 call assert_equal('', histget(a:hist, 1)) |
bab20768e1fd
patch 8.2.0325: ex_getln.c code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19517
diff
changeset
|
80 call assert_equal('text_4', histget(a:hist, 4)) |
8406
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
81 endfunction |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
82 |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
83 function Test_History() |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
84 for h in ['cmd', ':', '', 'search', '/', '?', 'expr', '=', 'input', '@', 'debug', '>'] |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
85 call History_Tests(h) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
86 endfor |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
87 |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
88 " Negative tests |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
89 call assert_false(histdel('abc')) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
90 call assert_equal('', histget('abc')) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
91 call assert_fails('call histdel([])', 'E730:') |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
92 call assert_equal('', histget(10)) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
93 call assert_fails('call histget([])', 'E730:') |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
94 call assert_equal(-1, histnr('abc')) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
95 call assert_fails('call histnr([])', 'E730:') |
19517
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
96 call assert_fails('history xyz', 'E488:') |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
97 call assert_fails('history ,abc', 'E488:') |
22375
595ea7f099cd
patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents:
19581
diff
changeset
|
98 call assert_fails('call histdel(":", "\\%(")', 'E53:') |
8406
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
99 endfunction |
10565
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
100 |
25771
7dbd3a65a04b
patch 8.2.3421: a bit of code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
101 function Test_history_truncates_long_entry() |
7dbd3a65a04b
patch 8.2.3421: a bit of code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
102 " History entry short enough to fit on the screen should not be truncated. |
7dbd3a65a04b
patch 8.2.3421: a bit of code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
103 call histadd(':', 'echo x' .. repeat('y', &columns - 17) .. 'z') |
7dbd3a65a04b
patch 8.2.3421: a bit of code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
104 let a = execute('history : -1') |
7dbd3a65a04b
patch 8.2.3421: a bit of code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
105 |
7dbd3a65a04b
patch 8.2.3421: a bit of code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
106 call assert_match("^\n # cmd history\n" |
7dbd3a65a04b
patch 8.2.3421: a bit of code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
107 \ .. "> *\\d\\+ echo x" .. repeat('y', &columns - 17) .. 'z$', a) |
7dbd3a65a04b
patch 8.2.3421: a bit of code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
108 |
7dbd3a65a04b
patch 8.2.3421: a bit of code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
109 " Long history entry should be truncated to fit on the screen, with, '...' |
7dbd3a65a04b
patch 8.2.3421: a bit of code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
110 " inserted in the string to indicate the that there is truncation. |
7dbd3a65a04b
patch 8.2.3421: a bit of code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
111 call histadd(':', 'echo x' .. repeat('y', &columns - 16) .. 'z') |
7dbd3a65a04b
patch 8.2.3421: a bit of code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
112 let a = execute('history : -1') |
7dbd3a65a04b
patch 8.2.3421: a bit of code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
113 call assert_match("^\n # cmd history\n" |
7dbd3a65a04b
patch 8.2.3421: a bit of code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
114 \ .. "> *\\d\\+ echo xy\\+\.\.\.y\\+z$", a) |
7dbd3a65a04b
patch 8.2.3421: a bit of code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
115 endfunction |
7dbd3a65a04b
patch 8.2.3421: a bit of code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
116 |
10565
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
117 function Test_Search_history_window() |
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
118 new |
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
119 call setline(1, ['a', 'b', 'a', 'b']) |
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
120 1 |
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
121 call feedkeys("/a\<CR>", 'xt') |
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
122 call assert_equal('a', getline('.')) |
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
123 1 |
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
124 call feedkeys("/b\<CR>", 'xt') |
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
125 call assert_equal('b', getline('.')) |
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
126 1 |
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
127 " select the previous /a command |
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
128 call feedkeys("q/kk\<CR>", 'x!') |
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
129 call assert_equal('a', getline('.')) |
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
130 call assert_equal('a', @/) |
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
131 bwipe! |
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
132 endfunc |
15097
1946487c74ba
patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
10565
diff
changeset
|
133 |
19570
43c04edcafec
patch 8.2.0342: some code in ex_getln.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19536
diff
changeset
|
134 " Test for :history command option completion |
15097
1946487c74ba
patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
10565
diff
changeset
|
135 function Test_history_completion() |
1946487c74ba
patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
10565
diff
changeset
|
136 call feedkeys(":history \<C-A>\<C-B>\"\<CR>", 'tx') |
1946487c74ba
patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
10565
diff
changeset
|
137 call assert_equal('"history / : = > ? @ all cmd debug expr input search', @:) |
1946487c74ba
patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
10565
diff
changeset
|
138 endfunc |
19517
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
139 |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
140 " Test for increasing the 'history' option value |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
141 func Test_history_size() |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
142 let save_histsz = &history |
19570
43c04edcafec
patch 8.2.0342: some code in ex_getln.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19536
diff
changeset
|
143 set history=10 |
43c04edcafec
patch 8.2.0342: some code in ex_getln.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19536
diff
changeset
|
144 call histadd(':', 'ls') |
19517
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
145 call histdel(':') |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
146 for i in range(1, 5) |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
147 call histadd(':', 'cmd' .. i) |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
148 endfor |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
149 call assert_equal(5, histnr(':')) |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
150 call assert_equal('cmd5', histget(':', -1)) |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
151 |
19536
bab20768e1fd
patch 8.2.0325: ex_getln.c code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19517
diff
changeset
|
152 set history=15 |
19517
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
153 for i in range(6, 10) |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
154 call histadd(':', 'cmd' .. i) |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
155 endfor |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
156 call assert_equal(10, histnr(':')) |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
157 call assert_equal('cmd1', histget(':', 1)) |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
158 call assert_equal('cmd10', histget(':', -1)) |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
159 |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
160 set history=5 |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
161 call histadd(':', 'abc') |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
162 call assert_equal('', histget(':', 6)) |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
163 call assert_equal('', histget(':', 12)) |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
164 call assert_equal('cmd7', histget(':', 7)) |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
165 call assert_equal('abc', histget(':', -1)) |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
166 |
19536
bab20768e1fd
patch 8.2.0325: ex_getln.c code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19517
diff
changeset
|
167 " This test works only when the language is English |
bab20768e1fd
patch 8.2.0325: ex_getln.c code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19517
diff
changeset
|
168 if v:lang == "C" || v:lang =~ '^[Ee]n' |
bab20768e1fd
patch 8.2.0325: ex_getln.c code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19517
diff
changeset
|
169 set history=0 |
bab20768e1fd
patch 8.2.0325: ex_getln.c code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19517
diff
changeset
|
170 redir => v |
bab20768e1fd
patch 8.2.0325: ex_getln.c code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19517
diff
changeset
|
171 call feedkeys(":history\<CR>", 'xt') |
bab20768e1fd
patch 8.2.0325: ex_getln.c code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19517
diff
changeset
|
172 redir END |
bab20768e1fd
patch 8.2.0325: ex_getln.c code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19517
diff
changeset
|
173 call assert_equal(["'history' option is zero"], split(v, "\n")) |
bab20768e1fd
patch 8.2.0325: ex_getln.c code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19517
diff
changeset
|
174 endif |
bab20768e1fd
patch 8.2.0325: ex_getln.c code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19517
diff
changeset
|
175 |
19517
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
176 let &history=save_histsz |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
177 endfunc |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
178 |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
179 " Test for recalling old search patterns in / |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
180 func Test_history_search() |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
181 call histdel('/') |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
182 let g:pat = [] |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
183 func SavePat() |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
184 call add(g:pat, getcmdline()) |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
185 return '' |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
186 endfunc |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
187 cnoremap <F2> <C-\>eSavePat()<CR> |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
188 call histadd('/', 'pat1') |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
189 call histadd('/', 'pat2') |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
190 let @/ = '' |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
191 call feedkeys("/\<Up>\<F2>\<Up>\<F2>\<Down>\<Down>\<F2>\<Esc>", 'xt') |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
192 call assert_equal(['pat2', 'pat1', ''], g:pat) |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
193 cunmap <F2> |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
194 delfunc SavePat |
19570
43c04edcafec
patch 8.2.0342: some code in ex_getln.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19536
diff
changeset
|
195 |
19581
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
196 " Search for a pattern that is not present in the history |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
197 call assert_beeps('call feedkeys("/a1b2\<Up>\<CR>", "xt")') |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
198 |
19570
43c04edcafec
patch 8.2.0342: some code in ex_getln.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19536
diff
changeset
|
199 " Recall patterns with 'history' set to 0 |
43c04edcafec
patch 8.2.0342: some code in ex_getln.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19536
diff
changeset
|
200 set history=0 |
43c04edcafec
patch 8.2.0342: some code in ex_getln.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19536
diff
changeset
|
201 let @/ = 'abc' |
43c04edcafec
patch 8.2.0342: some code in ex_getln.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19536
diff
changeset
|
202 let cmd = 'call feedkeys("/\<Up>\<Down>\<S-Up>\<S-Down>\<CR>", "xt")' |
43c04edcafec
patch 8.2.0342: some code in ex_getln.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19536
diff
changeset
|
203 call assert_fails(cmd, 'E486:') |
43c04edcafec
patch 8.2.0342: some code in ex_getln.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19536
diff
changeset
|
204 set history& |
19581
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
205 |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
206 " Recall patterns till the end of history |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
207 set history=4 |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
208 call histadd('/', 'pat') |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
209 call histdel('/') |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
210 call histadd('/', 'pat1') |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
211 call histadd('/', 'pat2') |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
212 call assert_beeps('call feedkeys("/\<Up>\<Up>\<Up>\<C-U>\<cr>", "xt")') |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
213 call assert_beeps('call feedkeys("/\<Down><cr>", "xt")') |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
214 |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
215 " Test for wrapping around the history list |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
216 for i in range(3, 7) |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
217 call histadd('/', 'pat' .. i) |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
218 endfor |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
219 let upcmd = "\<up>\<up>\<up>\<up>\<up>" |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
220 let downcmd = "\<down>\<down>\<down>\<down>\<down>" |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
221 try |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
222 call feedkeys("/" .. upcmd .. "\<cr>", 'xt') |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
223 catch /E486:/ |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
224 endtry |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
225 call assert_equal('pat4', @/) |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
226 try |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
227 call feedkeys("/" .. upcmd .. downcmd .. "\<cr>", 'xt') |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
228 catch /E486:/ |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
229 endtry |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
230 call assert_equal('pat4', @/) |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
231 |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
232 " Test for changing the search command separator in the history |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
233 call assert_fails('call feedkeys("/def/\<cr>", "xt")', 'E486:') |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
234 call assert_fails('call feedkeys("?\<up>\<cr>", "xt")', 'E486:') |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
235 call assert_equal('def?', histget('/', -1)) |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
236 |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
237 call assert_fails('call feedkeys("/ghi?\<cr>", "xt")', 'E486:') |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
238 call assert_fails('call feedkeys("?\<up>\<cr>", "xt")', 'E486:') |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
239 call assert_equal('ghi\?', histget('/', -1)) |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
240 |
848dc460adf0
patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19570
diff
changeset
|
241 set history& |
19517
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
242 endfunc |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
243 |
19536
bab20768e1fd
patch 8.2.0325: ex_getln.c code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19517
diff
changeset
|
244 " Test for making sure the key value is not stored in history |
bab20768e1fd
patch 8.2.0325: ex_getln.c code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19517
diff
changeset
|
245 func Test_history_crypt_key() |
bab20768e1fd
patch 8.2.0325: ex_getln.c code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19517
diff
changeset
|
246 CheckFeature cryptv |
33420
aa7cd2253130
patch 9.0.1968: cmdline completion should consider key option
Christian Brabandt <cb@256bit.org>
parents:
25771
diff
changeset
|
247 |
19536
bab20768e1fd
patch 8.2.0325: ex_getln.c code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19517
diff
changeset
|
248 call feedkeys(":set bs=2 key=abc ts=8\<CR>", 'xt') |
bab20768e1fd
patch 8.2.0325: ex_getln.c code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19517
diff
changeset
|
249 call assert_equal('set bs=2 key= ts=8', histget(':')) |
33420
aa7cd2253130
patch 9.0.1968: cmdline completion should consider key option
Christian Brabandt <cb@256bit.org>
parents:
25771
diff
changeset
|
250 |
aa7cd2253130
patch 9.0.1968: cmdline completion should consider key option
Christian Brabandt <cb@256bit.org>
parents:
25771
diff
changeset
|
251 call assert_fails("call feedkeys(':set bs=2 key-=abc ts=8\<CR>', 'xt')") |
aa7cd2253130
patch 9.0.1968: cmdline completion should consider key option
Christian Brabandt <cb@256bit.org>
parents:
25771
diff
changeset
|
252 call assert_equal('set bs=2 key-= ts=8', histget(':')) |
aa7cd2253130
patch 9.0.1968: cmdline completion should consider key option
Christian Brabandt <cb@256bit.org>
parents:
25771
diff
changeset
|
253 |
19536
bab20768e1fd
patch 8.2.0325: ex_getln.c code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19517
diff
changeset
|
254 set key& bs& ts& |
bab20768e1fd
patch 8.2.0325: ex_getln.c code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19517
diff
changeset
|
255 endfunc |
bab20768e1fd
patch 8.2.0325: ex_getln.c code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19517
diff
changeset
|
256 |
19517
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
257 " vim: shiftwidth=2 sts=2 expandtab |