Mercurial > vim
annotate src/testdir/test_cmdline.vim @ 15380:f62d6bd18a49 v8.1.0698
patch 8.1.0698: clearing the window is used too often
commit https://github.com/vim/vim/commit/bf3250a8ad39797e3ccdac82d20c6f19533419e4
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 6 17:25:29 2019 +0100
patch 8.1.0698: clearing the window is used too often
Problem: Clearing the window is used too often, causing the command line
to be cleared when opening a tab. (Miroslav Ko?k?r)
Solution: Use NOT_VALID instead of CLEAR. (suggested by Jason Franklin,
closes #630) Also do this for a few other places where clearing
the screen isn't really needed.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 06 Jan 2019 17:30:05 +0100 |
parents | de8dc397cd2a |
children | 2dcaa860e3fc |
rev | line source |
---|---|
9280
f92cfcd7fda2
commit https://github.com/vim/vim/commit/ae3150ec8d9da4a244acffebea55416946ca23d3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Tests for editing the command line. |
f92cfcd7fda2
commit https://github.com/vim/vim/commit/ae3150ec8d9da4a244acffebea55416946ca23d3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
f92cfcd7fda2
commit https://github.com/vim/vim/commit/ae3150ec8d9da4a244acffebea55416946ca23d3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 func Test_complete_tab() |
f92cfcd7fda2
commit https://github.com/vim/vim/commit/ae3150ec8d9da4a244acffebea55416946ca23d3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 call writefile(['testfile'], 'Xtestfile') |
f92cfcd7fda2
commit https://github.com/vim/vim/commit/ae3150ec8d9da4a244acffebea55416946ca23d3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 call feedkeys(":e Xtest\t\r", "tx") |
f92cfcd7fda2
commit https://github.com/vim/vim/commit/ae3150ec8d9da4a244acffebea55416946ca23d3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 call assert_equal('testfile', getline(1)) |
f92cfcd7fda2
commit https://github.com/vim/vim/commit/ae3150ec8d9da4a244acffebea55416946ca23d3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 call delete('Xtestfile') |
f92cfcd7fda2
commit https://github.com/vim/vim/commit/ae3150ec8d9da4a244acffebea55416946ca23d3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 endfunc |
f92cfcd7fda2
commit https://github.com/vim/vim/commit/ae3150ec8d9da4a244acffebea55416946ca23d3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 |
f92cfcd7fda2
commit https://github.com/vim/vim/commit/ae3150ec8d9da4a244acffebea55416946ca23d3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 func Test_complete_list() |
f92cfcd7fda2
commit https://github.com/vim/vim/commit/ae3150ec8d9da4a244acffebea55416946ca23d3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 " We can't see the output, but at least we check the code runs properly. |
f92cfcd7fda2
commit https://github.com/vim/vim/commit/ae3150ec8d9da4a244acffebea55416946ca23d3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 call feedkeys(":e test\<C-D>\r", "tx") |
f92cfcd7fda2
commit https://github.com/vim/vim/commit/ae3150ec8d9da4a244acffebea55416946ca23d3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 call assert_equal('test', expand('%:t')) |
f92cfcd7fda2
commit https://github.com/vim/vim/commit/ae3150ec8d9da4a244acffebea55416946ca23d3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 endfunc |
f92cfcd7fda2
commit https://github.com/vim/vim/commit/ae3150ec8d9da4a244acffebea55416946ca23d3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 |
f92cfcd7fda2
commit https://github.com/vim/vim/commit/ae3150ec8d9da4a244acffebea55416946ca23d3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 func Test_complete_wildmenu() |
f92cfcd7fda2
commit https://github.com/vim/vim/commit/ae3150ec8d9da4a244acffebea55416946ca23d3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 call writefile(['testfile1'], 'Xtestfile1') |
f92cfcd7fda2
commit https://github.com/vim/vim/commit/ae3150ec8d9da4a244acffebea55416946ca23d3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 call writefile(['testfile2'], 'Xtestfile2') |
f92cfcd7fda2
commit https://github.com/vim/vim/commit/ae3150ec8d9da4a244acffebea55416946ca23d3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 set wildmenu |
f92cfcd7fda2
commit https://github.com/vim/vim/commit/ae3150ec8d9da4a244acffebea55416946ca23d3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 call feedkeys(":e Xtest\t\t\r", "tx") |
f92cfcd7fda2
commit https://github.com/vim/vim/commit/ae3150ec8d9da4a244acffebea55416946ca23d3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 call assert_equal('testfile2', getline(1)) |
f92cfcd7fda2
commit https://github.com/vim/vim/commit/ae3150ec8d9da4a244acffebea55416946ca23d3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 |
f92cfcd7fda2
commit https://github.com/vim/vim/commit/ae3150ec8d9da4a244acffebea55416946ca23d3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 call delete('Xtestfile1') |
f92cfcd7fda2
commit https://github.com/vim/vim/commit/ae3150ec8d9da4a244acffebea55416946ca23d3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 call delete('Xtestfile2') |
f92cfcd7fda2
commit https://github.com/vim/vim/commit/ae3150ec8d9da4a244acffebea55416946ca23d3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 set nowildmenu |
f92cfcd7fda2
commit https://github.com/vim/vim/commit/ae3150ec8d9da4a244acffebea55416946ca23d3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 endfunc |
9460
cdffa812f9d1
commit https://github.com/vim/vim/commit/aa4d73235bf4deee167aa5314b89ae3d3db334b7
Christian Brabandt <cb@256bit.org>
parents:
9280
diff
changeset
|
27 |
11026
fa69f6272692
patch 8.0.0402: :map completion does not have <special>
Christian Brabandt <cb@256bit.org>
parents:
10869
diff
changeset
|
28 func Test_map_completion() |
fa69f6272692
patch 8.0.0402: :map completion does not have <special>
Christian Brabandt <cb@256bit.org>
parents:
10869
diff
changeset
|
29 if !has('cmdline_compl') |
fa69f6272692
patch 8.0.0402: :map completion does not have <special>
Christian Brabandt <cb@256bit.org>
parents:
10869
diff
changeset
|
30 return |
fa69f6272692
patch 8.0.0402: :map completion does not have <special>
Christian Brabandt <cb@256bit.org>
parents:
10869
diff
changeset
|
31 endif |
fa69f6272692
patch 8.0.0402: :map completion does not have <special>
Christian Brabandt <cb@256bit.org>
parents:
10869
diff
changeset
|
32 call feedkeys(":map <unique> <si\<Tab>\<Home>\"\<CR>", 'xt') |
fa69f6272692
patch 8.0.0402: :map completion does not have <special>
Christian Brabandt <cb@256bit.org>
parents:
10869
diff
changeset
|
33 call assert_equal('"map <unique> <silent>', getreg(':')) |
fa69f6272692
patch 8.0.0402: :map completion does not have <special>
Christian Brabandt <cb@256bit.org>
parents:
10869
diff
changeset
|
34 call feedkeys(":map <script> <un\<Tab>\<Home>\"\<CR>", 'xt') |
fa69f6272692
patch 8.0.0402: :map completion does not have <special>
Christian Brabandt <cb@256bit.org>
parents:
10869
diff
changeset
|
35 call assert_equal('"map <script> <unique>', getreg(':')) |
fa69f6272692
patch 8.0.0402: :map completion does not have <special>
Christian Brabandt <cb@256bit.org>
parents:
10869
diff
changeset
|
36 call feedkeys(":map <expr> <sc\<Tab>\<Home>\"\<CR>", 'xt') |
fa69f6272692
patch 8.0.0402: :map completion does not have <special>
Christian Brabandt <cb@256bit.org>
parents:
10869
diff
changeset
|
37 call assert_equal('"map <expr> <script>', getreg(':')) |
fa69f6272692
patch 8.0.0402: :map completion does not have <special>
Christian Brabandt <cb@256bit.org>
parents:
10869
diff
changeset
|
38 call feedkeys(":map <buffer> <e\<Tab>\<Home>\"\<CR>", 'xt') |
fa69f6272692
patch 8.0.0402: :map completion does not have <special>
Christian Brabandt <cb@256bit.org>
parents:
10869
diff
changeset
|
39 call assert_equal('"map <buffer> <expr>', getreg(':')) |
fa69f6272692
patch 8.0.0402: :map completion does not have <special>
Christian Brabandt <cb@256bit.org>
parents:
10869
diff
changeset
|
40 call feedkeys(":map <nowait> <b\<Tab>\<Home>\"\<CR>", 'xt') |
fa69f6272692
patch 8.0.0402: :map completion does not have <special>
Christian Brabandt <cb@256bit.org>
parents:
10869
diff
changeset
|
41 call assert_equal('"map <nowait> <buffer>', getreg(':')) |
fa69f6272692
patch 8.0.0402: :map completion does not have <special>
Christian Brabandt <cb@256bit.org>
parents:
10869
diff
changeset
|
42 call feedkeys(":map <special> <no\<Tab>\<Home>\"\<CR>", 'xt') |
fa69f6272692
patch 8.0.0402: :map completion does not have <special>
Christian Brabandt <cb@256bit.org>
parents:
10869
diff
changeset
|
43 call assert_equal('"map <special> <nowait>', getreg(':')) |
fa69f6272692
patch 8.0.0402: :map completion does not have <special>
Christian Brabandt <cb@256bit.org>
parents:
10869
diff
changeset
|
44 call feedkeys(":map <silent> <sp\<Tab>\<Home>\"\<CR>", 'xt') |
fa69f6272692
patch 8.0.0402: :map completion does not have <special>
Christian Brabandt <cb@256bit.org>
parents:
10869
diff
changeset
|
45 call assert_equal('"map <silent> <special>', getreg(':')) |
fa69f6272692
patch 8.0.0402: :map completion does not have <special>
Christian Brabandt <cb@256bit.org>
parents:
10869
diff
changeset
|
46 endfunc |
fa69f6272692
patch 8.0.0402: :map completion does not have <special>
Christian Brabandt <cb@256bit.org>
parents:
10869
diff
changeset
|
47 |
10660
715836a72361
patch 8.0.0220: completion of highlight names misses a few values
Christian Brabandt <cb@256bit.org>
parents:
10656
diff
changeset
|
48 func Test_match_completion() |
715836a72361
patch 8.0.0220: completion of highlight names misses a few values
Christian Brabandt <cb@256bit.org>
parents:
10656
diff
changeset
|
49 if !has('cmdline_compl') |
715836a72361
patch 8.0.0220: completion of highlight names misses a few values
Christian Brabandt <cb@256bit.org>
parents:
10656
diff
changeset
|
50 return |
715836a72361
patch 8.0.0220: completion of highlight names misses a few values
Christian Brabandt <cb@256bit.org>
parents:
10656
diff
changeset
|
51 endif |
715836a72361
patch 8.0.0220: completion of highlight names misses a few values
Christian Brabandt <cb@256bit.org>
parents:
10656
diff
changeset
|
52 hi Aardig ctermfg=green |
715836a72361
patch 8.0.0220: completion of highlight names misses a few values
Christian Brabandt <cb@256bit.org>
parents:
10656
diff
changeset
|
53 call feedkeys(":match \<Tab>\<Home>\"\<CR>", 'xt') |
715836a72361
patch 8.0.0220: completion of highlight names misses a few values
Christian Brabandt <cb@256bit.org>
parents:
10656
diff
changeset
|
54 call assert_equal('"match Aardig', getreg(':')) |
715836a72361
patch 8.0.0220: completion of highlight names misses a few values
Christian Brabandt <cb@256bit.org>
parents:
10656
diff
changeset
|
55 call feedkeys(":match \<S-Tab>\<Home>\"\<CR>", 'xt') |
715836a72361
patch 8.0.0220: completion of highlight names misses a few values
Christian Brabandt <cb@256bit.org>
parents:
10656
diff
changeset
|
56 call assert_equal('"match none', getreg(':')) |
715836a72361
patch 8.0.0220: completion of highlight names misses a few values
Christian Brabandt <cb@256bit.org>
parents:
10656
diff
changeset
|
57 endfunc |
715836a72361
patch 8.0.0220: completion of highlight names misses a few values
Christian Brabandt <cb@256bit.org>
parents:
10656
diff
changeset
|
58 |
715836a72361
patch 8.0.0220: completion of highlight names misses a few values
Christian Brabandt <cb@256bit.org>
parents:
10656
diff
changeset
|
59 func Test_highlight_completion() |
715836a72361
patch 8.0.0220: completion of highlight names misses a few values
Christian Brabandt <cb@256bit.org>
parents:
10656
diff
changeset
|
60 if !has('cmdline_compl') |
715836a72361
patch 8.0.0220: completion of highlight names misses a few values
Christian Brabandt <cb@256bit.org>
parents:
10656
diff
changeset
|
61 return |
715836a72361
patch 8.0.0220: completion of highlight names misses a few values
Christian Brabandt <cb@256bit.org>
parents:
10656
diff
changeset
|
62 endif |
715836a72361
patch 8.0.0220: completion of highlight names misses a few values
Christian Brabandt <cb@256bit.org>
parents:
10656
diff
changeset
|
63 hi Aardig ctermfg=green |
715836a72361
patch 8.0.0220: completion of highlight names misses a few values
Christian Brabandt <cb@256bit.org>
parents:
10656
diff
changeset
|
64 call feedkeys(":hi \<Tab>\<Home>\"\<CR>", 'xt') |
715836a72361
patch 8.0.0220: completion of highlight names misses a few values
Christian Brabandt <cb@256bit.org>
parents:
10656
diff
changeset
|
65 call assert_equal('"hi Aardig', getreg(':')) |
11354
129077fb57e6
patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents:
11323
diff
changeset
|
66 call feedkeys(":hi default \<Tab>\<Home>\"\<CR>", 'xt') |
129077fb57e6
patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents:
11323
diff
changeset
|
67 call assert_equal('"hi default Aardig', getreg(':')) |
129077fb57e6
patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents:
11323
diff
changeset
|
68 call feedkeys(":hi clear Aa\<Tab>\<Home>\"\<CR>", 'xt') |
129077fb57e6
patch 8.0.0562: not enough test coverage for syntax commands
Christian Brabandt <cb@256bit.org>
parents:
11323
diff
changeset
|
69 call assert_equal('"hi clear Aardig', getreg(':')) |
10660
715836a72361
patch 8.0.0220: completion of highlight names misses a few values
Christian Brabandt <cb@256bit.org>
parents:
10656
diff
changeset
|
70 call feedkeys(":hi li\<S-Tab>\<Home>\"\<CR>", 'xt') |
715836a72361
patch 8.0.0220: completion of highlight names misses a few values
Christian Brabandt <cb@256bit.org>
parents:
10656
diff
changeset
|
71 call assert_equal('"hi link', getreg(':')) |
715836a72361
patch 8.0.0220: completion of highlight names misses a few values
Christian Brabandt <cb@256bit.org>
parents:
10656
diff
changeset
|
72 call feedkeys(":hi d\<S-Tab>\<Home>\"\<CR>", 'xt') |
715836a72361
patch 8.0.0220: completion of highlight names misses a few values
Christian Brabandt <cb@256bit.org>
parents:
10656
diff
changeset
|
73 call assert_equal('"hi default', getreg(':')) |
715836a72361
patch 8.0.0220: completion of highlight names misses a few values
Christian Brabandt <cb@256bit.org>
parents:
10656
diff
changeset
|
74 call feedkeys(":hi c\<S-Tab>\<Home>\"\<CR>", 'xt') |
715836a72361
patch 8.0.0220: completion of highlight names misses a few values
Christian Brabandt <cb@256bit.org>
parents:
10656
diff
changeset
|
75 call assert_equal('"hi clear', getreg(':')) |
11254
918942a3b0ef
patch 8.0.0513: getting name of cleared highlight group is wrong
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
76 |
918942a3b0ef
patch 8.0.0513: getting name of cleared highlight group is wrong
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
77 " A cleared group does not show up in completions. |
918942a3b0ef
patch 8.0.0513: getting name of cleared highlight group is wrong
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
78 hi Anders ctermfg=green |
918942a3b0ef
patch 8.0.0513: getting name of cleared highlight group is wrong
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
79 call assert_equal(['Aardig', 'Anders'], getcompletion('A', 'highlight')) |
918942a3b0ef
patch 8.0.0513: getting name of cleared highlight group is wrong
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
80 hi clear Aardig |
918942a3b0ef
patch 8.0.0513: getting name of cleared highlight group is wrong
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
81 call assert_equal(['Anders'], getcompletion('A', 'highlight')) |
918942a3b0ef
patch 8.0.0513: getting name of cleared highlight group is wrong
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
82 hi clear Anders |
918942a3b0ef
patch 8.0.0513: getting name of cleared highlight group is wrong
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
83 call assert_equal([], getcompletion('A', 'highlight')) |
10660
715836a72361
patch 8.0.0220: completion of highlight names misses a few values
Christian Brabandt <cb@256bit.org>
parents:
10656
diff
changeset
|
84 endfunc |
715836a72361
patch 8.0.0220: completion of highlight names misses a few values
Christian Brabandt <cb@256bit.org>
parents:
10656
diff
changeset
|
85 |
10656
4762bd300564
patch 8.0.0218: no completion for :cexpr and similar commands
Christian Brabandt <cb@256bit.org>
parents:
10480
diff
changeset
|
86 func Test_expr_completion() |
10660
715836a72361
patch 8.0.0220: completion of highlight names misses a few values
Christian Brabandt <cb@256bit.org>
parents:
10656
diff
changeset
|
87 if !has('cmdline_compl') |
10656
4762bd300564
patch 8.0.0218: no completion for :cexpr and similar commands
Christian Brabandt <cb@256bit.org>
parents:
10480
diff
changeset
|
88 return |
4762bd300564
patch 8.0.0218: no completion for :cexpr and similar commands
Christian Brabandt <cb@256bit.org>
parents:
10480
diff
changeset
|
89 endif |
4762bd300564
patch 8.0.0218: no completion for :cexpr and similar commands
Christian Brabandt <cb@256bit.org>
parents:
10480
diff
changeset
|
90 for cmd in [ |
4762bd300564
patch 8.0.0218: no completion for :cexpr and similar commands
Christian Brabandt <cb@256bit.org>
parents:
10480
diff
changeset
|
91 \ 'let a = ', |
4762bd300564
patch 8.0.0218: no completion for :cexpr and similar commands
Christian Brabandt <cb@256bit.org>
parents:
10480
diff
changeset
|
92 \ 'if', |
4762bd300564
patch 8.0.0218: no completion for :cexpr and similar commands
Christian Brabandt <cb@256bit.org>
parents:
10480
diff
changeset
|
93 \ 'elseif', |
4762bd300564
patch 8.0.0218: no completion for :cexpr and similar commands
Christian Brabandt <cb@256bit.org>
parents:
10480
diff
changeset
|
94 \ 'while', |
4762bd300564
patch 8.0.0218: no completion for :cexpr and similar commands
Christian Brabandt <cb@256bit.org>
parents:
10480
diff
changeset
|
95 \ 'for', |
4762bd300564
patch 8.0.0218: no completion for :cexpr and similar commands
Christian Brabandt <cb@256bit.org>
parents:
10480
diff
changeset
|
96 \ 'echo', |
4762bd300564
patch 8.0.0218: no completion for :cexpr and similar commands
Christian Brabandt <cb@256bit.org>
parents:
10480
diff
changeset
|
97 \ 'echon', |
4762bd300564
patch 8.0.0218: no completion for :cexpr and similar commands
Christian Brabandt <cb@256bit.org>
parents:
10480
diff
changeset
|
98 \ 'execute', |
4762bd300564
patch 8.0.0218: no completion for :cexpr and similar commands
Christian Brabandt <cb@256bit.org>
parents:
10480
diff
changeset
|
99 \ 'echomsg', |
4762bd300564
patch 8.0.0218: no completion for :cexpr and similar commands
Christian Brabandt <cb@256bit.org>
parents:
10480
diff
changeset
|
100 \ 'echoerr', |
4762bd300564
patch 8.0.0218: no completion for :cexpr and similar commands
Christian Brabandt <cb@256bit.org>
parents:
10480
diff
changeset
|
101 \ 'call', |
4762bd300564
patch 8.0.0218: no completion for :cexpr and similar commands
Christian Brabandt <cb@256bit.org>
parents:
10480
diff
changeset
|
102 \ 'return', |
4762bd300564
patch 8.0.0218: no completion for :cexpr and similar commands
Christian Brabandt <cb@256bit.org>
parents:
10480
diff
changeset
|
103 \ 'cexpr', |
4762bd300564
patch 8.0.0218: no completion for :cexpr and similar commands
Christian Brabandt <cb@256bit.org>
parents:
10480
diff
changeset
|
104 \ 'caddexpr', |
4762bd300564
patch 8.0.0218: no completion for :cexpr and similar commands
Christian Brabandt <cb@256bit.org>
parents:
10480
diff
changeset
|
105 \ 'cgetexpr', |
4762bd300564
patch 8.0.0218: no completion for :cexpr and similar commands
Christian Brabandt <cb@256bit.org>
parents:
10480
diff
changeset
|
106 \ 'lexpr', |
4762bd300564
patch 8.0.0218: no completion for :cexpr and similar commands
Christian Brabandt <cb@256bit.org>
parents:
10480
diff
changeset
|
107 \ 'laddexpr', |
4762bd300564
patch 8.0.0218: no completion for :cexpr and similar commands
Christian Brabandt <cb@256bit.org>
parents:
10480
diff
changeset
|
108 \ 'lgetexpr'] |
4762bd300564
patch 8.0.0218: no completion for :cexpr and similar commands
Christian Brabandt <cb@256bit.org>
parents:
10480
diff
changeset
|
109 call feedkeys(":" . cmd . " getl\<Tab>\<Home>\"\<CR>", 'xt') |
4762bd300564
patch 8.0.0218: no completion for :cexpr and similar commands
Christian Brabandt <cb@256bit.org>
parents:
10480
diff
changeset
|
110 call assert_equal('"' . cmd . ' getline(', getreg(':')) |
4762bd300564
patch 8.0.0218: no completion for :cexpr and similar commands
Christian Brabandt <cb@256bit.org>
parents:
10480
diff
changeset
|
111 endfor |
4762bd300564
patch 8.0.0218: no completion for :cexpr and similar commands
Christian Brabandt <cb@256bit.org>
parents:
10480
diff
changeset
|
112 endfunc |
4762bd300564
patch 8.0.0218: no completion for :cexpr and similar commands
Christian Brabandt <cb@256bit.org>
parents:
10480
diff
changeset
|
113 |
9460
cdffa812f9d1
commit https://github.com/vim/vim/commit/aa4d73235bf4deee167aa5314b89ae3d3db334b7
Christian Brabandt <cb@256bit.org>
parents:
9280
diff
changeset
|
114 func Test_getcompletion() |
9462
7384c0cfad13
commit https://github.com/vim/vim/commit/0d3e24be5686c0710aa3c6671e4c626d6cb21a5f
Christian Brabandt <cb@256bit.org>
parents:
9460
diff
changeset
|
115 if !has('cmdline_compl') |
7384c0cfad13
commit https://github.com/vim/vim/commit/0d3e24be5686c0710aa3c6671e4c626d6cb21a5f
Christian Brabandt <cb@256bit.org>
parents:
9460
diff
changeset
|
116 return |
7384c0cfad13
commit https://github.com/vim/vim/commit/0d3e24be5686c0710aa3c6671e4c626d6cb21a5f
Christian Brabandt <cb@256bit.org>
parents:
9460
diff
changeset
|
117 endif |
9460
cdffa812f9d1
commit https://github.com/vim/vim/commit/aa4d73235bf4deee167aa5314b89ae3d3db334b7
Christian Brabandt <cb@256bit.org>
parents:
9280
diff
changeset
|
118 let groupcount = len(getcompletion('', 'event')) |
cdffa812f9d1
commit https://github.com/vim/vim/commit/aa4d73235bf4deee167aa5314b89ae3d3db334b7
Christian Brabandt <cb@256bit.org>
parents:
9280
diff
changeset
|
119 call assert_true(groupcount > 0) |
cdffa812f9d1
commit https://github.com/vim/vim/commit/aa4d73235bf4deee167aa5314b89ae3d3db334b7
Christian Brabandt <cb@256bit.org>
parents:
9280
diff
changeset
|
120 let matchcount = len(getcompletion('File', 'event')) |
cdffa812f9d1
commit https://github.com/vim/vim/commit/aa4d73235bf4deee167aa5314b89ae3d3db334b7
Christian Brabandt <cb@256bit.org>
parents:
9280
diff
changeset
|
121 call assert_true(matchcount > 0) |
cdffa812f9d1
commit https://github.com/vim/vim/commit/aa4d73235bf4deee167aa5314b89ae3d3db334b7
Christian Brabandt <cb@256bit.org>
parents:
9280
diff
changeset
|
122 call assert_true(groupcount > matchcount) |
cdffa812f9d1
commit https://github.com/vim/vim/commit/aa4d73235bf4deee167aa5314b89ae3d3db334b7
Christian Brabandt <cb@256bit.org>
parents:
9280
diff
changeset
|
123 |
9462
7384c0cfad13
commit https://github.com/vim/vim/commit/0d3e24be5686c0710aa3c6671e4c626d6cb21a5f
Christian Brabandt <cb@256bit.org>
parents:
9460
diff
changeset
|
124 if has('menu') |
7384c0cfad13
commit https://github.com/vim/vim/commit/0d3e24be5686c0710aa3c6671e4c626d6cb21a5f
Christian Brabandt <cb@256bit.org>
parents:
9460
diff
changeset
|
125 source $VIMRUNTIME/menu.vim |
7384c0cfad13
commit https://github.com/vim/vim/commit/0d3e24be5686c0710aa3c6671e4c626d6cb21a5f
Christian Brabandt <cb@256bit.org>
parents:
9460
diff
changeset
|
126 let matchcount = len(getcompletion('', 'menu')) |
7384c0cfad13
commit https://github.com/vim/vim/commit/0d3e24be5686c0710aa3c6671e4c626d6cb21a5f
Christian Brabandt <cb@256bit.org>
parents:
9460
diff
changeset
|
127 call assert_true(matchcount > 0) |
7384c0cfad13
commit https://github.com/vim/vim/commit/0d3e24be5686c0710aa3c6671e4c626d6cb21a5f
Christian Brabandt <cb@256bit.org>
parents:
9460
diff
changeset
|
128 call assert_equal(['File.'], getcompletion('File', 'menu')) |
7384c0cfad13
commit https://github.com/vim/vim/commit/0d3e24be5686c0710aa3c6671e4c626d6cb21a5f
Christian Brabandt <cb@256bit.org>
parents:
9460
diff
changeset
|
129 call assert_true(matchcount > 0) |
7384c0cfad13
commit https://github.com/vim/vim/commit/0d3e24be5686c0710aa3c6671e4c626d6cb21a5f
Christian Brabandt <cb@256bit.org>
parents:
9460
diff
changeset
|
130 let matchcount = len(getcompletion('File.', 'menu')) |
7384c0cfad13
commit https://github.com/vim/vim/commit/0d3e24be5686c0710aa3c6671e4c626d6cb21a5f
Christian Brabandt <cb@256bit.org>
parents:
9460
diff
changeset
|
131 call assert_true(matchcount > 0) |
7384c0cfad13
commit https://github.com/vim/vim/commit/0d3e24be5686c0710aa3c6671e4c626d6cb21a5f
Christian Brabandt <cb@256bit.org>
parents:
9460
diff
changeset
|
132 endif |
9460
cdffa812f9d1
commit https://github.com/vim/vim/commit/aa4d73235bf4deee167aa5314b89ae3d3db334b7
Christian Brabandt <cb@256bit.org>
parents:
9280
diff
changeset
|
133 |
9577
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
134 let l = getcompletion('v:n', 'var') |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
135 call assert_true(index(l, 'v:null') >= 0) |
9672
6255ff1ea003
commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
Christian Brabandt <cb@256bit.org>
parents:
9638
diff
changeset
|
136 let l = getcompletion('v:notexists', 'var') |
6255ff1ea003
commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
Christian Brabandt <cb@256bit.org>
parents:
9638
diff
changeset
|
137 call assert_equal([], l) |
9577
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
138 |
13551
1fd0f8392946
patch 8.0.1649: no completion for argument list commands
Christian Brabandt <cb@256bit.org>
parents:
12706
diff
changeset
|
139 args a.c b.c |
1fd0f8392946
patch 8.0.1649: no completion for argument list commands
Christian Brabandt <cb@256bit.org>
parents:
12706
diff
changeset
|
140 let l = getcompletion('', 'arglist') |
1fd0f8392946
patch 8.0.1649: no completion for argument list commands
Christian Brabandt <cb@256bit.org>
parents:
12706
diff
changeset
|
141 call assert_equal(['a.c', 'b.c'], l) |
1fd0f8392946
patch 8.0.1649: no completion for argument list commands
Christian Brabandt <cb@256bit.org>
parents:
12706
diff
changeset
|
142 %argdelete |
1fd0f8392946
patch 8.0.1649: no completion for argument list commands
Christian Brabandt <cb@256bit.org>
parents:
12706
diff
changeset
|
143 |
9577
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
144 let l = getcompletion('', 'augroup') |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
145 call assert_true(index(l, 'END') >= 0) |
9672
6255ff1ea003
commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
Christian Brabandt <cb@256bit.org>
parents:
9638
diff
changeset
|
146 let l = getcompletion('blahblah', 'augroup') |
6255ff1ea003
commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
Christian Brabandt <cb@256bit.org>
parents:
9638
diff
changeset
|
147 call assert_equal([], l) |
9577
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
148 |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
149 let l = getcompletion('', 'behave') |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
150 call assert_true(index(l, 'mswin') >= 0) |
9672
6255ff1ea003
commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
Christian Brabandt <cb@256bit.org>
parents:
9638
diff
changeset
|
151 let l = getcompletion('not', 'behave') |
6255ff1ea003
commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
Christian Brabandt <cb@256bit.org>
parents:
9638
diff
changeset
|
152 call assert_equal([], l) |
9577
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
153 |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
154 let l = getcompletion('', 'color') |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
155 call assert_true(index(l, 'default') >= 0) |
9672
6255ff1ea003
commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
Christian Brabandt <cb@256bit.org>
parents:
9638
diff
changeset
|
156 let l = getcompletion('dirty', 'color') |
6255ff1ea003
commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
Christian Brabandt <cb@256bit.org>
parents:
9638
diff
changeset
|
157 call assert_equal([], l) |
9577
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
158 |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
159 let l = getcompletion('', 'command') |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
160 call assert_true(index(l, 'sleep') >= 0) |
9672
6255ff1ea003
commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
Christian Brabandt <cb@256bit.org>
parents:
9638
diff
changeset
|
161 let l = getcompletion('awake', 'command') |
6255ff1ea003
commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
Christian Brabandt <cb@256bit.org>
parents:
9638
diff
changeset
|
162 call assert_equal([], l) |
9577
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
163 |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
164 let l = getcompletion('', 'dir') |
9672
6255ff1ea003
commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
Christian Brabandt <cb@256bit.org>
parents:
9638
diff
changeset
|
165 call assert_true(index(l, 'samples/') >= 0) |
6255ff1ea003
commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
Christian Brabandt <cb@256bit.org>
parents:
9638
diff
changeset
|
166 let l = getcompletion('NoMatch', 'dir') |
6255ff1ea003
commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
Christian Brabandt <cb@256bit.org>
parents:
9638
diff
changeset
|
167 call assert_equal([], l) |
9577
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
168 |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
169 let l = getcompletion('exe', 'expression') |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
170 call assert_true(index(l, 'executable(') >= 0) |
9672
6255ff1ea003
commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
Christian Brabandt <cb@256bit.org>
parents:
9638
diff
changeset
|
171 let l = getcompletion('kill', 'expression') |
6255ff1ea003
commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
Christian Brabandt <cb@256bit.org>
parents:
9638
diff
changeset
|
172 call assert_equal([], l) |
9577
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
173 |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
174 let l = getcompletion('tag', 'function') |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
175 call assert_true(index(l, 'taglist(') >= 0) |
9672
6255ff1ea003
commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
Christian Brabandt <cb@256bit.org>
parents:
9638
diff
changeset
|
176 let l = getcompletion('paint', 'function') |
6255ff1ea003
commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
Christian Brabandt <cb@256bit.org>
parents:
9638
diff
changeset
|
177 call assert_equal([], l) |
9577
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
178 |
9638
af0d98d8836e
commit https://github.com/vim/vim/commit/b49edc11a1872fa99befa9a4a8ea6c8537868038
Christian Brabandt <cb@256bit.org>
parents:
9577
diff
changeset
|
179 let Flambda = {-> 'hello'} |
af0d98d8836e
commit https://github.com/vim/vim/commit/b49edc11a1872fa99befa9a4a8ea6c8537868038
Christian Brabandt <cb@256bit.org>
parents:
9577
diff
changeset
|
180 let l = getcompletion('', 'function') |
af0d98d8836e
commit https://github.com/vim/vim/commit/b49edc11a1872fa99befa9a4a8ea6c8537868038
Christian Brabandt <cb@256bit.org>
parents:
9577
diff
changeset
|
181 let l = filter(l, {i, v -> v =~ 'lambda'}) |
9672
6255ff1ea003
commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
Christian Brabandt <cb@256bit.org>
parents:
9638
diff
changeset
|
182 call assert_equal([], l) |
9638
af0d98d8836e
commit https://github.com/vim/vim/commit/b49edc11a1872fa99befa9a4a8ea6c8537868038
Christian Brabandt <cb@256bit.org>
parents:
9577
diff
changeset
|
183 |
9577
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
184 let l = getcompletion('run', 'file') |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
185 call assert_true(index(l, 'runtest.vim') >= 0) |
9672
6255ff1ea003
commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
Christian Brabandt <cb@256bit.org>
parents:
9638
diff
changeset
|
186 let l = getcompletion('walk', 'file') |
6255ff1ea003
commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
Christian Brabandt <cb@256bit.org>
parents:
9638
diff
changeset
|
187 call assert_equal([], l) |
9861
74f67cb4f7e1
commit https://github.com/vim/vim/commit/e9d58a6459687a1228b5aa85bd7b31f8f1e528a8
Christian Brabandt <cb@256bit.org>
parents:
9774
diff
changeset
|
188 set wildignore=*.vim |
74f67cb4f7e1
commit https://github.com/vim/vim/commit/e9d58a6459687a1228b5aa85bd7b31f8f1e528a8
Christian Brabandt <cb@256bit.org>
parents:
9774
diff
changeset
|
189 let l = getcompletion('run', 'file', 1) |
74f67cb4f7e1
commit https://github.com/vim/vim/commit/e9d58a6459687a1228b5aa85bd7b31f8f1e528a8
Christian Brabandt <cb@256bit.org>
parents:
9774
diff
changeset
|
190 call assert_true(index(l, 'runtest.vim') < 0) |
74f67cb4f7e1
commit https://github.com/vim/vim/commit/e9d58a6459687a1228b5aa85bd7b31f8f1e528a8
Christian Brabandt <cb@256bit.org>
parents:
9774
diff
changeset
|
191 set wildignore& |
9577
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
192 |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
193 let l = getcompletion('ha', 'filetype') |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
194 call assert_true(index(l, 'hamster') >= 0) |
9672
6255ff1ea003
commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
Christian Brabandt <cb@256bit.org>
parents:
9638
diff
changeset
|
195 let l = getcompletion('horse', 'filetype') |
6255ff1ea003
commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
Christian Brabandt <cb@256bit.org>
parents:
9638
diff
changeset
|
196 call assert_equal([], l) |
9577
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
197 |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
198 let l = getcompletion('z', 'syntax') |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
199 call assert_true(index(l, 'zimbu') >= 0) |
9672
6255ff1ea003
commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
Christian Brabandt <cb@256bit.org>
parents:
9638
diff
changeset
|
200 let l = getcompletion('emacs', 'syntax') |
6255ff1ea003
commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
Christian Brabandt <cb@256bit.org>
parents:
9638
diff
changeset
|
201 call assert_equal([], l) |
9577
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
202 |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
203 let l = getcompletion('jikes', 'compiler') |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
204 call assert_true(index(l, 'jikes') >= 0) |
9672
6255ff1ea003
commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
Christian Brabandt <cb@256bit.org>
parents:
9638
diff
changeset
|
205 let l = getcompletion('break', 'compiler') |
6255ff1ea003
commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
Christian Brabandt <cb@256bit.org>
parents:
9638
diff
changeset
|
206 call assert_equal([], l) |
9577
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
207 |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
208 let l = getcompletion('last', 'help') |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
209 call assert_true(index(l, ':tablast') >= 0) |
9672
6255ff1ea003
commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
Christian Brabandt <cb@256bit.org>
parents:
9638
diff
changeset
|
210 let l = getcompletion('giveup', 'help') |
6255ff1ea003
commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
Christian Brabandt <cb@256bit.org>
parents:
9638
diff
changeset
|
211 call assert_equal([], l) |
9577
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
212 |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
213 let l = getcompletion('time', 'option') |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
214 call assert_true(index(l, 'timeoutlen') >= 0) |
9672
6255ff1ea003
commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
Christian Brabandt <cb@256bit.org>
parents:
9638
diff
changeset
|
215 let l = getcompletion('space', 'option') |
6255ff1ea003
commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
Christian Brabandt <cb@256bit.org>
parents:
9638
diff
changeset
|
216 call assert_equal([], l) |
9577
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
217 |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
218 let l = getcompletion('er', 'highlight') |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
219 call assert_true(index(l, 'ErrorMsg') >= 0) |
9672
6255ff1ea003
commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
Christian Brabandt <cb@256bit.org>
parents:
9638
diff
changeset
|
220 let l = getcompletion('dark', 'highlight') |
6255ff1ea003
commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
Christian Brabandt <cb@256bit.org>
parents:
9638
diff
changeset
|
221 call assert_equal([], l) |
9577
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
222 |
10275
6d8b2da002e9
commit https://github.com/vim/vim/commit/9e507ca8a3e1535e62de4bd86374b0fcd18ef5b8
Christian Brabandt <cb@256bit.org>
parents:
10007
diff
changeset
|
223 let l = getcompletion('', 'messages') |
6d8b2da002e9
commit https://github.com/vim/vim/commit/9e507ca8a3e1535e62de4bd86374b0fcd18ef5b8
Christian Brabandt <cb@256bit.org>
parents:
10007
diff
changeset
|
224 call assert_true(index(l, 'clear') >= 0) |
6d8b2da002e9
commit https://github.com/vim/vim/commit/9e507ca8a3e1535e62de4bd86374b0fcd18ef5b8
Christian Brabandt <cb@256bit.org>
parents:
10007
diff
changeset
|
225 let l = getcompletion('not', 'messages') |
6d8b2da002e9
commit https://github.com/vim/vim/commit/9e507ca8a3e1535e62de4bd86374b0fcd18ef5b8
Christian Brabandt <cb@256bit.org>
parents:
10007
diff
changeset
|
226 call assert_equal([], l) |
6d8b2da002e9
commit https://github.com/vim/vim/commit/9e507ca8a3e1535e62de4bd86374b0fcd18ef5b8
Christian Brabandt <cb@256bit.org>
parents:
10007
diff
changeset
|
227 |
11995
7df3dd3c0ac1
patch 8.0.0878: no completion for :mapclear
Christian Brabandt <cb@256bit.org>
parents:
11354
diff
changeset
|
228 let l = getcompletion('', 'mapclear') |
7df3dd3c0ac1
patch 8.0.0878: no completion for :mapclear
Christian Brabandt <cb@256bit.org>
parents:
11354
diff
changeset
|
229 call assert_true(index(l, '<buffer>') >= 0) |
7df3dd3c0ac1
patch 8.0.0878: no completion for :mapclear
Christian Brabandt <cb@256bit.org>
parents:
11354
diff
changeset
|
230 let l = getcompletion('not', 'mapclear') |
7df3dd3c0ac1
patch 8.0.0878: no completion for :mapclear
Christian Brabandt <cb@256bit.org>
parents:
11354
diff
changeset
|
231 call assert_equal([], l) |
7df3dd3c0ac1
patch 8.0.0878: no completion for :mapclear
Christian Brabandt <cb@256bit.org>
parents:
11354
diff
changeset
|
232 |
13998
c3f9c37160e7
patch 8.1.0017: shell command completion has duplicates
Christian Brabandt <cb@256bit.org>
parents:
13890
diff
changeset
|
233 let l = getcompletion('.', 'shellcmd') |
14417
5d9b450e7827
patch 8.1.0223: completing shell command finds sub-directories in $PATH
Christian Brabandt <cb@256bit.org>
parents:
14167
diff
changeset
|
234 call assert_equal(['./', '../'], filter(l, 'v:val =~ "\\./"')) |
13998
c3f9c37160e7
patch 8.1.0017: shell command completion has duplicates
Christian Brabandt <cb@256bit.org>
parents:
13890
diff
changeset
|
235 call assert_equal(-1, match(l[2:], '^\.\.\?/$')) |
c3f9c37160e7
patch 8.1.0017: shell command completion has duplicates
Christian Brabandt <cb@256bit.org>
parents:
13890
diff
changeset
|
236 let root = has('win32') ? 'C:\\' : '/' |
c3f9c37160e7
patch 8.1.0017: shell command completion has duplicates
Christian Brabandt <cb@256bit.org>
parents:
13890
diff
changeset
|
237 let l = getcompletion(root, 'shellcmd') |
c3f9c37160e7
patch 8.1.0017: shell command completion has duplicates
Christian Brabandt <cb@256bit.org>
parents:
13890
diff
changeset
|
238 let expected = map(filter(glob(root . '*', 0, 1), |
c3f9c37160e7
patch 8.1.0017: shell command completion has duplicates
Christian Brabandt <cb@256bit.org>
parents:
13890
diff
changeset
|
239 \ 'isdirectory(v:val) || executable(v:val)'), 'isdirectory(v:val) ? v:val . ''/'' : v:val') |
c3f9c37160e7
patch 8.1.0017: shell command completion has duplicates
Christian Brabandt <cb@256bit.org>
parents:
13890
diff
changeset
|
240 call assert_equal(expected, l) |
c3f9c37160e7
patch 8.1.0017: shell command completion has duplicates
Christian Brabandt <cb@256bit.org>
parents:
13890
diff
changeset
|
241 |
9766
be9b5f8c3fd9
commit https://github.com/vim/vim/commit/b650b9878e9f0ac6bb1b61230095ad9ab3850a33
Christian Brabandt <cb@256bit.org>
parents:
9672
diff
changeset
|
242 if has('cscope') |
be9b5f8c3fd9
commit https://github.com/vim/vim/commit/b650b9878e9f0ac6bb1b61230095ad9ab3850a33
Christian Brabandt <cb@256bit.org>
parents:
9672
diff
changeset
|
243 let l = getcompletion('', 'cscope') |
be9b5f8c3fd9
commit https://github.com/vim/vim/commit/b650b9878e9f0ac6bb1b61230095ad9ab3850a33
Christian Brabandt <cb@256bit.org>
parents:
9672
diff
changeset
|
244 let cmds = ['add', 'find', 'help', 'kill', 'reset', 'show'] |
be9b5f8c3fd9
commit https://github.com/vim/vim/commit/b650b9878e9f0ac6bb1b61230095ad9ab3850a33
Christian Brabandt <cb@256bit.org>
parents:
9672
diff
changeset
|
245 call assert_equal(cmds, l) |
be9b5f8c3fd9
commit https://github.com/vim/vim/commit/b650b9878e9f0ac6bb1b61230095ad9ab3850a33
Christian Brabandt <cb@256bit.org>
parents:
9672
diff
changeset
|
246 " using cmdline completion must not change the result |
be9b5f8c3fd9
commit https://github.com/vim/vim/commit/b650b9878e9f0ac6bb1b61230095ad9ab3850a33
Christian Brabandt <cb@256bit.org>
parents:
9672
diff
changeset
|
247 call feedkeys(":cscope find \<c-d>\<c-c>", 'xt') |
be9b5f8c3fd9
commit https://github.com/vim/vim/commit/b650b9878e9f0ac6bb1b61230095ad9ab3850a33
Christian Brabandt <cb@256bit.org>
parents:
9672
diff
changeset
|
248 let l = getcompletion('', 'cscope') |
be9b5f8c3fd9
commit https://github.com/vim/vim/commit/b650b9878e9f0ac6bb1b61230095ad9ab3850a33
Christian Brabandt <cb@256bit.org>
parents:
9672
diff
changeset
|
249 call assert_equal(cmds, l) |
be9b5f8c3fd9
commit https://github.com/vim/vim/commit/b650b9878e9f0ac6bb1b61230095ad9ab3850a33
Christian Brabandt <cb@256bit.org>
parents:
9672
diff
changeset
|
250 let keys = ['a', 'c', 'd', 'e', 'f', 'g', 'i', 's', 't'] |
be9b5f8c3fd9
commit https://github.com/vim/vim/commit/b650b9878e9f0ac6bb1b61230095ad9ab3850a33
Christian Brabandt <cb@256bit.org>
parents:
9672
diff
changeset
|
251 let l = getcompletion('find ', 'cscope') |
be9b5f8c3fd9
commit https://github.com/vim/vim/commit/b650b9878e9f0ac6bb1b61230095ad9ab3850a33
Christian Brabandt <cb@256bit.org>
parents:
9672
diff
changeset
|
252 call assert_equal(keys, l) |
be9b5f8c3fd9
commit https://github.com/vim/vim/commit/b650b9878e9f0ac6bb1b61230095ad9ab3850a33
Christian Brabandt <cb@256bit.org>
parents:
9672
diff
changeset
|
253 endif |
be9b5f8c3fd9
commit https://github.com/vim/vim/commit/b650b9878e9f0ac6bb1b61230095ad9ab3850a33
Christian Brabandt <cb@256bit.org>
parents:
9672
diff
changeset
|
254 |
9774
5385e72e1ac2
commit https://github.com/vim/vim/commit/7522f6982197f83a5c0f6e9af07fb713934f824a
Christian Brabandt <cb@256bit.org>
parents:
9766
diff
changeset
|
255 if has('signs') |
5385e72e1ac2
commit https://github.com/vim/vim/commit/7522f6982197f83a5c0f6e9af07fb713934f824a
Christian Brabandt <cb@256bit.org>
parents:
9766
diff
changeset
|
256 sign define Testing linehl=Comment |
5385e72e1ac2
commit https://github.com/vim/vim/commit/7522f6982197f83a5c0f6e9af07fb713934f824a
Christian Brabandt <cb@256bit.org>
parents:
9766
diff
changeset
|
257 let l = getcompletion('', 'sign') |
5385e72e1ac2
commit https://github.com/vim/vim/commit/7522f6982197f83a5c0f6e9af07fb713934f824a
Christian Brabandt <cb@256bit.org>
parents:
9766
diff
changeset
|
258 let cmds = ['define', 'jump', 'list', 'place', 'undefine', 'unplace'] |
5385e72e1ac2
commit https://github.com/vim/vim/commit/7522f6982197f83a5c0f6e9af07fb713934f824a
Christian Brabandt <cb@256bit.org>
parents:
9766
diff
changeset
|
259 call assert_equal(cmds, l) |
5385e72e1ac2
commit https://github.com/vim/vim/commit/7522f6982197f83a5c0f6e9af07fb713934f824a
Christian Brabandt <cb@256bit.org>
parents:
9766
diff
changeset
|
260 " using cmdline completion must not change the result |
5385e72e1ac2
commit https://github.com/vim/vim/commit/7522f6982197f83a5c0f6e9af07fb713934f824a
Christian Brabandt <cb@256bit.org>
parents:
9766
diff
changeset
|
261 call feedkeys(":sign list \<c-d>\<c-c>", 'xt') |
5385e72e1ac2
commit https://github.com/vim/vim/commit/7522f6982197f83a5c0f6e9af07fb713934f824a
Christian Brabandt <cb@256bit.org>
parents:
9766
diff
changeset
|
262 let l = getcompletion('', 'sign') |
5385e72e1ac2
commit https://github.com/vim/vim/commit/7522f6982197f83a5c0f6e9af07fb713934f824a
Christian Brabandt <cb@256bit.org>
parents:
9766
diff
changeset
|
263 call assert_equal(cmds, l) |
5385e72e1ac2
commit https://github.com/vim/vim/commit/7522f6982197f83a5c0f6e9af07fb713934f824a
Christian Brabandt <cb@256bit.org>
parents:
9766
diff
changeset
|
264 let l = getcompletion('list ', 'sign') |
5385e72e1ac2
commit https://github.com/vim/vim/commit/7522f6982197f83a5c0f6e9af07fb713934f824a
Christian Brabandt <cb@256bit.org>
parents:
9766
diff
changeset
|
265 call assert_equal(['Testing'], l) |
5385e72e1ac2
commit https://github.com/vim/vim/commit/7522f6982197f83a5c0f6e9af07fb713934f824a
Christian Brabandt <cb@256bit.org>
parents:
9766
diff
changeset
|
266 endif |
5385e72e1ac2
commit https://github.com/vim/vim/commit/7522f6982197f83a5c0f6e9af07fb713934f824a
Christian Brabandt <cb@256bit.org>
parents:
9766
diff
changeset
|
267 |
9577
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
268 " For others test if the name is recognized. |
13998
c3f9c37160e7
patch 8.1.0017: shell command completion has duplicates
Christian Brabandt <cb@256bit.org>
parents:
13890
diff
changeset
|
269 let names = ['buffer', 'environment', 'file_in_path', 'mapping', 'tag', 'tag_listfiles', 'user'] |
9577
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
270 if has('cmdline_hist') |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
271 call add(names, 'history') |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
272 endif |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
273 if has('gettext') |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
274 call add(names, 'locale') |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
275 endif |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
276 if has('profile') |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
277 call add(names, 'syntime') |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
278 endif |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
279 |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
280 set tags=Xtags |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
281 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", "word\tfile\tcmd"], 'Xtags') |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
282 |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
283 for name in names |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
284 let matchcount = len(getcompletion('', name)) |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
285 call assert_true(matchcount >= 0, 'No matches for ' . name) |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
286 endfor |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
287 |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
288 call delete('Xtags') |
e3b6a4a87684
commit https://github.com/vim/vim/commit/c1fb763184c8ae82300357867fa2070aa94366e9
Christian Brabandt <cb@256bit.org>
parents:
9462
diff
changeset
|
289 |
9460
cdffa812f9d1
commit https://github.com/vim/vim/commit/aa4d73235bf4deee167aa5314b89ae3d3db334b7
Christian Brabandt <cb@256bit.org>
parents:
9280
diff
changeset
|
290 call assert_fails('call getcompletion("", "burp")', 'E475:') |
cdffa812f9d1
commit https://github.com/vim/vim/commit/aa4d73235bf4deee167aa5314b89ae3d3db334b7
Christian Brabandt <cb@256bit.org>
parents:
9280
diff
changeset
|
291 endfunc |
10002
ff0b4216f026
commit https://github.com/vim/vim/commit/73d4e4c8922f6f4d256f910a18f47c0c3a48c28b
Christian Brabandt <cb@256bit.org>
parents:
9861
diff
changeset
|
292 |
14417
5d9b450e7827
patch 8.1.0223: completing shell command finds sub-directories in $PATH
Christian Brabandt <cb@256bit.org>
parents:
14167
diff
changeset
|
293 func Test_shellcmd_completion() |
5d9b450e7827
patch 8.1.0223: completing shell command finds sub-directories in $PATH
Christian Brabandt <cb@256bit.org>
parents:
14167
diff
changeset
|
294 let save_path = $PATH |
5d9b450e7827
patch 8.1.0223: completing shell command finds sub-directories in $PATH
Christian Brabandt <cb@256bit.org>
parents:
14167
diff
changeset
|
295 |
5d9b450e7827
patch 8.1.0223: completing shell command finds sub-directories in $PATH
Christian Brabandt <cb@256bit.org>
parents:
14167
diff
changeset
|
296 call mkdir('Xpathdir/Xpathsubdir', 'p') |
5d9b450e7827
patch 8.1.0223: completing shell command finds sub-directories in $PATH
Christian Brabandt <cb@256bit.org>
parents:
14167
diff
changeset
|
297 call writefile([''], 'Xpathdir/Xfile.exe') |
5d9b450e7827
patch 8.1.0223: completing shell command finds sub-directories in $PATH
Christian Brabandt <cb@256bit.org>
parents:
14167
diff
changeset
|
298 call setfperm('Xpathdir/Xfile.exe', 'rwx------') |
5d9b450e7827
patch 8.1.0223: completing shell command finds sub-directories in $PATH
Christian Brabandt <cb@256bit.org>
parents:
14167
diff
changeset
|
299 |
5d9b450e7827
patch 8.1.0223: completing shell command finds sub-directories in $PATH
Christian Brabandt <cb@256bit.org>
parents:
14167
diff
changeset
|
300 " Set PATH to example directory without trailing slash. |
5d9b450e7827
patch 8.1.0223: completing shell command finds sub-directories in $PATH
Christian Brabandt <cb@256bit.org>
parents:
14167
diff
changeset
|
301 let $PATH = getcwd() . '/Xpathdir' |
5d9b450e7827
patch 8.1.0223: completing shell command finds sub-directories in $PATH
Christian Brabandt <cb@256bit.org>
parents:
14167
diff
changeset
|
302 |
5d9b450e7827
patch 8.1.0223: completing shell command finds sub-directories in $PATH
Christian Brabandt <cb@256bit.org>
parents:
14167
diff
changeset
|
303 " Test for the ":!<TAB>" case. Previously, this would include subdirs of |
5d9b450e7827
patch 8.1.0223: completing shell command finds sub-directories in $PATH
Christian Brabandt <cb@256bit.org>
parents:
14167
diff
changeset
|
304 " dirs in the PATH, even though they won't be executed. We check that only |
5d9b450e7827
patch 8.1.0223: completing shell command finds sub-directories in $PATH
Christian Brabandt <cb@256bit.org>
parents:
14167
diff
changeset
|
305 " subdirs of the PWD and executables from the PATH are included in the |
5d9b450e7827
patch 8.1.0223: completing shell command finds sub-directories in $PATH
Christian Brabandt <cb@256bit.org>
parents:
14167
diff
changeset
|
306 " suggestions. |
5d9b450e7827
patch 8.1.0223: completing shell command finds sub-directories in $PATH
Christian Brabandt <cb@256bit.org>
parents:
14167
diff
changeset
|
307 let actual = getcompletion('X', 'shellcmd') |
5d9b450e7827
patch 8.1.0223: completing shell command finds sub-directories in $PATH
Christian Brabandt <cb@256bit.org>
parents:
14167
diff
changeset
|
308 let expected = map(filter(glob('*', 0, 1), 'isdirectory(v:val) && v:val[0] == "X"'), 'v:val . "/"') |
5d9b450e7827
patch 8.1.0223: completing shell command finds sub-directories in $PATH
Christian Brabandt <cb@256bit.org>
parents:
14167
diff
changeset
|
309 call insert(expected, 'Xfile.exe') |
5d9b450e7827
patch 8.1.0223: completing shell command finds sub-directories in $PATH
Christian Brabandt <cb@256bit.org>
parents:
14167
diff
changeset
|
310 call assert_equal(expected, actual) |
5d9b450e7827
patch 8.1.0223: completing shell command finds sub-directories in $PATH
Christian Brabandt <cb@256bit.org>
parents:
14167
diff
changeset
|
311 |
5d9b450e7827
patch 8.1.0223: completing shell command finds sub-directories in $PATH
Christian Brabandt <cb@256bit.org>
parents:
14167
diff
changeset
|
312 call delete('Xpathdir', 'rf') |
5d9b450e7827
patch 8.1.0223: completing shell command finds sub-directories in $PATH
Christian Brabandt <cb@256bit.org>
parents:
14167
diff
changeset
|
313 let $PATH = save_path |
5d9b450e7827
patch 8.1.0223: completing shell command finds sub-directories in $PATH
Christian Brabandt <cb@256bit.org>
parents:
14167
diff
changeset
|
314 endfunc |
5d9b450e7827
patch 8.1.0223: completing shell command finds sub-directories in $PATH
Christian Brabandt <cb@256bit.org>
parents:
14167
diff
changeset
|
315 |
10002
ff0b4216f026
commit https://github.com/vim/vim/commit/73d4e4c8922f6f4d256f910a18f47c0c3a48c28b
Christian Brabandt <cb@256bit.org>
parents:
9861
diff
changeset
|
316 func Test_expand_star_star() |
ff0b4216f026
commit https://github.com/vim/vim/commit/73d4e4c8922f6f4d256f910a18f47c0c3a48c28b
Christian Brabandt <cb@256bit.org>
parents:
9861
diff
changeset
|
317 call mkdir('a/b', 'p') |
ff0b4216f026
commit https://github.com/vim/vim/commit/73d4e4c8922f6f4d256f910a18f47c0c3a48c28b
Christian Brabandt <cb@256bit.org>
parents:
9861
diff
changeset
|
318 call writefile(['asdfasdf'], 'a/b/fileXname') |
ff0b4216f026
commit https://github.com/vim/vim/commit/73d4e4c8922f6f4d256f910a18f47c0c3a48c28b
Christian Brabandt <cb@256bit.org>
parents:
9861
diff
changeset
|
319 call feedkeys(":find **/fileXname\<Tab>\<CR>", 'xt') |
ff0b4216f026
commit https://github.com/vim/vim/commit/73d4e4c8922f6f4d256f910a18f47c0c3a48c28b
Christian Brabandt <cb@256bit.org>
parents:
9861
diff
changeset
|
320 call assert_equal('find a/b/fileXname', getreg(':')) |
10007
a4d4ee212dab
commit https://github.com/vim/vim/commit/1773ddfdcd106fa3bbf479c9b62ccde03c2a86ba
Christian Brabandt <cb@256bit.org>
parents:
10002
diff
changeset
|
321 bwipe! |
10002
ff0b4216f026
commit https://github.com/vim/vim/commit/73d4e4c8922f6f4d256f910a18f47c0c3a48c28b
Christian Brabandt <cb@256bit.org>
parents:
9861
diff
changeset
|
322 call delete('a', 'rf') |
ff0b4216f026
commit https://github.com/vim/vim/commit/73d4e4c8922f6f4d256f910a18f47c0c3a48c28b
Christian Brabandt <cb@256bit.org>
parents:
9861
diff
changeset
|
323 endfunc |
10452
3fab458a54ad
commit https://github.com/vim/vim/commit/21efc3633edb58809c5dd89b025d34d7002e731c
Christian Brabandt <cb@256bit.org>
parents:
10275
diff
changeset
|
324 |
3fab458a54ad
commit https://github.com/vim/vim/commit/21efc3633edb58809c5dd89b025d34d7002e731c
Christian Brabandt <cb@256bit.org>
parents:
10275
diff
changeset
|
325 func Test_paste_in_cmdline() |
3fab458a54ad
commit https://github.com/vim/vim/commit/21efc3633edb58809c5dd89b025d34d7002e731c
Christian Brabandt <cb@256bit.org>
parents:
10275
diff
changeset
|
326 let @a = "def" |
3fab458a54ad
commit https://github.com/vim/vim/commit/21efc3633edb58809c5dd89b025d34d7002e731c
Christian Brabandt <cb@256bit.org>
parents:
10275
diff
changeset
|
327 call feedkeys(":abc \<C-R>a ghi\<C-B>\"\<CR>", 'tx') |
3fab458a54ad
commit https://github.com/vim/vim/commit/21efc3633edb58809c5dd89b025d34d7002e731c
Christian Brabandt <cb@256bit.org>
parents:
10275
diff
changeset
|
328 call assert_equal('"abc def ghi', @:) |
3fab458a54ad
commit https://github.com/vim/vim/commit/21efc3633edb58809c5dd89b025d34d7002e731c
Christian Brabandt <cb@256bit.org>
parents:
10275
diff
changeset
|
329 |
3fab458a54ad
commit https://github.com/vim/vim/commit/21efc3633edb58809c5dd89b025d34d7002e731c
Christian Brabandt <cb@256bit.org>
parents:
10275
diff
changeset
|
330 new |
3fab458a54ad
commit https://github.com/vim/vim/commit/21efc3633edb58809c5dd89b025d34d7002e731c
Christian Brabandt <cb@256bit.org>
parents:
10275
diff
changeset
|
331 call setline(1, 'asdf.x /tmp/some verylongword a;b-c*d ') |
3fab458a54ad
commit https://github.com/vim/vim/commit/21efc3633edb58809c5dd89b025d34d7002e731c
Christian Brabandt <cb@256bit.org>
parents:
10275
diff
changeset
|
332 |
3fab458a54ad
commit https://github.com/vim/vim/commit/21efc3633edb58809c5dd89b025d34d7002e731c
Christian Brabandt <cb@256bit.org>
parents:
10275
diff
changeset
|
333 call feedkeys(":aaa \<C-R>\<C-W> bbb\<C-B>\"\<CR>", 'tx') |
3fab458a54ad
commit https://github.com/vim/vim/commit/21efc3633edb58809c5dd89b025d34d7002e731c
Christian Brabandt <cb@256bit.org>
parents:
10275
diff
changeset
|
334 call assert_equal('"aaa asdf bbb', @:) |
3fab458a54ad
commit https://github.com/vim/vim/commit/21efc3633edb58809c5dd89b025d34d7002e731c
Christian Brabandt <cb@256bit.org>
parents:
10275
diff
changeset
|
335 |
3fab458a54ad
commit https://github.com/vim/vim/commit/21efc3633edb58809c5dd89b025d34d7002e731c
Christian Brabandt <cb@256bit.org>
parents:
10275
diff
changeset
|
336 call feedkeys("ft:aaa \<C-R>\<C-F> bbb\<C-B>\"\<CR>", 'tx') |
3fab458a54ad
commit https://github.com/vim/vim/commit/21efc3633edb58809c5dd89b025d34d7002e731c
Christian Brabandt <cb@256bit.org>
parents:
10275
diff
changeset
|
337 call assert_equal('"aaa /tmp/some bbb', @:) |
3fab458a54ad
commit https://github.com/vim/vim/commit/21efc3633edb58809c5dd89b025d34d7002e731c
Christian Brabandt <cb@256bit.org>
parents:
10275
diff
changeset
|
338 |
13831
1f95ec5de238
patch 8.0.1787: cannot insert the whole cursor line
Christian Brabandt <cb@256bit.org>
parents:
13600
diff
changeset
|
339 call feedkeys(":aaa \<C-R>\<C-L> bbb\<C-B>\"\<CR>", 'tx') |
1f95ec5de238
patch 8.0.1787: cannot insert the whole cursor line
Christian Brabandt <cb@256bit.org>
parents:
13600
diff
changeset
|
340 call assert_equal('"aaa '.getline(1).' bbb', @:) |
1f95ec5de238
patch 8.0.1787: cannot insert the whole cursor line
Christian Brabandt <cb@256bit.org>
parents:
13600
diff
changeset
|
341 |
10452
3fab458a54ad
commit https://github.com/vim/vim/commit/21efc3633edb58809c5dd89b025d34d7002e731c
Christian Brabandt <cb@256bit.org>
parents:
10275
diff
changeset
|
342 set incsearch |
3fab458a54ad
commit https://github.com/vim/vim/commit/21efc3633edb58809c5dd89b025d34d7002e731c
Christian Brabandt <cb@256bit.org>
parents:
10275
diff
changeset
|
343 call feedkeys("fy:aaa veryl\<C-R>\<C-W> bbb\<C-B>\"\<CR>", 'tx') |
3fab458a54ad
commit https://github.com/vim/vim/commit/21efc3633edb58809c5dd89b025d34d7002e731c
Christian Brabandt <cb@256bit.org>
parents:
10275
diff
changeset
|
344 call assert_equal('"aaa verylongword bbb', @:) |
3fab458a54ad
commit https://github.com/vim/vim/commit/21efc3633edb58809c5dd89b025d34d7002e731c
Christian Brabandt <cb@256bit.org>
parents:
10275
diff
changeset
|
345 |
3fab458a54ad
commit https://github.com/vim/vim/commit/21efc3633edb58809c5dd89b025d34d7002e731c
Christian Brabandt <cb@256bit.org>
parents:
10275
diff
changeset
|
346 call feedkeys("f;:aaa \<C-R>\<C-A> bbb\<C-B>\"\<CR>", 'tx') |
3fab458a54ad
commit https://github.com/vim/vim/commit/21efc3633edb58809c5dd89b025d34d7002e731c
Christian Brabandt <cb@256bit.org>
parents:
10275
diff
changeset
|
347 call assert_equal('"aaa a;b-c*d bbb', @:) |
10464
ce8ef728a12e
commit https://github.com/vim/vim/commit/eaaa9bbda6ec0a8589a9b23720f95bffe01dc267
Christian Brabandt <cb@256bit.org>
parents:
10452
diff
changeset
|
348 |
ce8ef728a12e
commit https://github.com/vim/vim/commit/eaaa9bbda6ec0a8589a9b23720f95bffe01dc267
Christian Brabandt <cb@256bit.org>
parents:
10452
diff
changeset
|
349 call feedkeys(":\<C-\>etoupper(getline(1))\<CR>\<C-B>\"\<CR>", 'tx') |
ce8ef728a12e
commit https://github.com/vim/vim/commit/eaaa9bbda6ec0a8589a9b23720f95bffe01dc267
Christian Brabandt <cb@256bit.org>
parents:
10452
diff
changeset
|
350 call assert_equal('"ASDF.X /TMP/SOME VERYLONGWORD A;B-C*D ', @:) |
10452
3fab458a54ad
commit https://github.com/vim/vim/commit/21efc3633edb58809c5dd89b025d34d7002e731c
Christian Brabandt <cb@256bit.org>
parents:
10275
diff
changeset
|
351 bwipe! |
13600
75e35ebdb7a4
patch 8.0.1672: error during completion causes command to be cancelled
Christian Brabandt <cb@256bit.org>
parents:
13551
diff
changeset
|
352 |
75e35ebdb7a4
patch 8.0.1672: error during completion causes command to be cancelled
Christian Brabandt <cb@256bit.org>
parents:
13551
diff
changeset
|
353 " Error while typing a command used to cause that it was not executed |
75e35ebdb7a4
patch 8.0.1672: error during completion causes command to be cancelled
Christian Brabandt <cb@256bit.org>
parents:
13551
diff
changeset
|
354 " in the end. |
75e35ebdb7a4
patch 8.0.1672: error during completion causes command to be cancelled
Christian Brabandt <cb@256bit.org>
parents:
13551
diff
changeset
|
355 new |
75e35ebdb7a4
patch 8.0.1672: error during completion causes command to be cancelled
Christian Brabandt <cb@256bit.org>
parents:
13551
diff
changeset
|
356 try |
75e35ebdb7a4
patch 8.0.1672: error during completion causes command to be cancelled
Christian Brabandt <cb@256bit.org>
parents:
13551
diff
changeset
|
357 call feedkeys(":file \<C-R>%Xtestfile\<CR>", 'tx') |
75e35ebdb7a4
patch 8.0.1672: error during completion causes command to be cancelled
Christian Brabandt <cb@256bit.org>
parents:
13551
diff
changeset
|
358 catch /^Vim\%((\a\+)\)\=:E32/ |
75e35ebdb7a4
patch 8.0.1672: error during completion causes command to be cancelled
Christian Brabandt <cb@256bit.org>
parents:
13551
diff
changeset
|
359 " ignore error E32 |
75e35ebdb7a4
patch 8.0.1672: error during completion causes command to be cancelled
Christian Brabandt <cb@256bit.org>
parents:
13551
diff
changeset
|
360 endtry |
75e35ebdb7a4
patch 8.0.1672: error during completion causes command to be cancelled
Christian Brabandt <cb@256bit.org>
parents:
13551
diff
changeset
|
361 call assert_equal("Xtestfile", bufname("%")) |
75e35ebdb7a4
patch 8.0.1672: error during completion causes command to be cancelled
Christian Brabandt <cb@256bit.org>
parents:
13551
diff
changeset
|
362 bwipe! |
10452
3fab458a54ad
commit https://github.com/vim/vim/commit/21efc3633edb58809c5dd89b025d34d7002e731c
Christian Brabandt <cb@256bit.org>
parents:
10275
diff
changeset
|
363 endfunc |
10464
ce8ef728a12e
commit https://github.com/vim/vim/commit/eaaa9bbda6ec0a8589a9b23720f95bffe01dc267
Christian Brabandt <cb@256bit.org>
parents:
10452
diff
changeset
|
364 |
ce8ef728a12e
commit https://github.com/vim/vim/commit/eaaa9bbda6ec0a8589a9b23720f95bffe01dc267
Christian Brabandt <cb@256bit.org>
parents:
10452
diff
changeset
|
365 func Test_remove_char_in_cmdline() |
ce8ef728a12e
commit https://github.com/vim/vim/commit/eaaa9bbda6ec0a8589a9b23720f95bffe01dc267
Christian Brabandt <cb@256bit.org>
parents:
10452
diff
changeset
|
366 call feedkeys(":abc def\<S-Left>\<Del>\<C-B>\"\<CR>", 'tx') |
ce8ef728a12e
commit https://github.com/vim/vim/commit/eaaa9bbda6ec0a8589a9b23720f95bffe01dc267
Christian Brabandt <cb@256bit.org>
parents:
10452
diff
changeset
|
367 call assert_equal('"abc ef', @:) |
ce8ef728a12e
commit https://github.com/vim/vim/commit/eaaa9bbda6ec0a8589a9b23720f95bffe01dc267
Christian Brabandt <cb@256bit.org>
parents:
10452
diff
changeset
|
368 |
ce8ef728a12e
commit https://github.com/vim/vim/commit/eaaa9bbda6ec0a8589a9b23720f95bffe01dc267
Christian Brabandt <cb@256bit.org>
parents:
10452
diff
changeset
|
369 call feedkeys(":abc def\<S-Left>\<BS>\<C-B>\"\<CR>", 'tx') |
ce8ef728a12e
commit https://github.com/vim/vim/commit/eaaa9bbda6ec0a8589a9b23720f95bffe01dc267
Christian Brabandt <cb@256bit.org>
parents:
10452
diff
changeset
|
370 call assert_equal('"abcdef', @:) |
ce8ef728a12e
commit https://github.com/vim/vim/commit/eaaa9bbda6ec0a8589a9b23720f95bffe01dc267
Christian Brabandt <cb@256bit.org>
parents:
10452
diff
changeset
|
371 |
ce8ef728a12e
commit https://github.com/vim/vim/commit/eaaa9bbda6ec0a8589a9b23720f95bffe01dc267
Christian Brabandt <cb@256bit.org>
parents:
10452
diff
changeset
|
372 call feedkeys(":abc def ghi\<S-Left>\<C-W>\<C-B>\"\<CR>", 'tx') |
ce8ef728a12e
commit https://github.com/vim/vim/commit/eaaa9bbda6ec0a8589a9b23720f95bffe01dc267
Christian Brabandt <cb@256bit.org>
parents:
10452
diff
changeset
|
373 call assert_equal('"abc ghi', @:) |
ce8ef728a12e
commit https://github.com/vim/vim/commit/eaaa9bbda6ec0a8589a9b23720f95bffe01dc267
Christian Brabandt <cb@256bit.org>
parents:
10452
diff
changeset
|
374 |
ce8ef728a12e
commit https://github.com/vim/vim/commit/eaaa9bbda6ec0a8589a9b23720f95bffe01dc267
Christian Brabandt <cb@256bit.org>
parents:
10452
diff
changeset
|
375 call feedkeys(":abc def\<S-Left>\<C-U>\<C-B>\"\<CR>", 'tx') |
ce8ef728a12e
commit https://github.com/vim/vim/commit/eaaa9bbda6ec0a8589a9b23720f95bffe01dc267
Christian Brabandt <cb@256bit.org>
parents:
10452
diff
changeset
|
376 call assert_equal('"def', @:) |
ce8ef728a12e
commit https://github.com/vim/vim/commit/eaaa9bbda6ec0a8589a9b23720f95bffe01dc267
Christian Brabandt <cb@256bit.org>
parents:
10452
diff
changeset
|
377 endfunc |
10480
dc9326b58c33
commit https://github.com/vim/vim/commit/fe38b494fff56cd9b2fcaeef26a8fd7b6557d69c
Christian Brabandt <cb@256bit.org>
parents:
10464
diff
changeset
|
378 |
10869
f8ebfa168818
patch 8.0.0324: illegal memory access with a wrong yank range
Christian Brabandt <cb@256bit.org>
parents:
10867
diff
changeset
|
379 func Test_illegal_address1() |
10480
dc9326b58c33
commit https://github.com/vim/vim/commit/fe38b494fff56cd9b2fcaeef26a8fd7b6557d69c
Christian Brabandt <cb@256bit.org>
parents:
10464
diff
changeset
|
380 new |
dc9326b58c33
commit https://github.com/vim/vim/commit/fe38b494fff56cd9b2fcaeef26a8fd7b6557d69c
Christian Brabandt <cb@256bit.org>
parents:
10464
diff
changeset
|
381 2;'( |
dc9326b58c33
commit https://github.com/vim/vim/commit/fe38b494fff56cd9b2fcaeef26a8fd7b6557d69c
Christian Brabandt <cb@256bit.org>
parents:
10464
diff
changeset
|
382 2;') |
dc9326b58c33
commit https://github.com/vim/vim/commit/fe38b494fff56cd9b2fcaeef26a8fd7b6557d69c
Christian Brabandt <cb@256bit.org>
parents:
10464
diff
changeset
|
383 quit |
dc9326b58c33
commit https://github.com/vim/vim/commit/fe38b494fff56cd9b2fcaeef26a8fd7b6557d69c
Christian Brabandt <cb@256bit.org>
parents:
10464
diff
changeset
|
384 endfunc |
10694
fa6c4825a1c4
patch 8.0.0237: when 'wildoptions' is "tagfile" completion may not work
Christian Brabandt <cb@256bit.org>
parents:
10660
diff
changeset
|
385 |
10869
f8ebfa168818
patch 8.0.0324: illegal memory access with a wrong yank range
Christian Brabandt <cb@256bit.org>
parents:
10867
diff
changeset
|
386 func Test_illegal_address2() |
f8ebfa168818
patch 8.0.0324: illegal memory access with a wrong yank range
Christian Brabandt <cb@256bit.org>
parents:
10867
diff
changeset
|
387 call writefile(['c', 'x', ' x', '.', '1;y'], 'Xtest.vim') |
f8ebfa168818
patch 8.0.0324: illegal memory access with a wrong yank range
Christian Brabandt <cb@256bit.org>
parents:
10867
diff
changeset
|
388 new |
f8ebfa168818
patch 8.0.0324: illegal memory access with a wrong yank range
Christian Brabandt <cb@256bit.org>
parents:
10867
diff
changeset
|
389 source Xtest.vim |
f8ebfa168818
patch 8.0.0324: illegal memory access with a wrong yank range
Christian Brabandt <cb@256bit.org>
parents:
10867
diff
changeset
|
390 " Trigger calling validate_cursor() |
f8ebfa168818
patch 8.0.0324: illegal memory access with a wrong yank range
Christian Brabandt <cb@256bit.org>
parents:
10867
diff
changeset
|
391 diffsp Xtest.vim |
f8ebfa168818
patch 8.0.0324: illegal memory access with a wrong yank range
Christian Brabandt <cb@256bit.org>
parents:
10867
diff
changeset
|
392 quit! |
f8ebfa168818
patch 8.0.0324: illegal memory access with a wrong yank range
Christian Brabandt <cb@256bit.org>
parents:
10867
diff
changeset
|
393 bwipe! |
f8ebfa168818
patch 8.0.0324: illegal memory access with a wrong yank range
Christian Brabandt <cb@256bit.org>
parents:
10867
diff
changeset
|
394 call delete('Xtest.vim') |
f8ebfa168818
patch 8.0.0324: illegal memory access with a wrong yank range
Christian Brabandt <cb@256bit.org>
parents:
10867
diff
changeset
|
395 endfunc |
f8ebfa168818
patch 8.0.0324: illegal memory access with a wrong yank range
Christian Brabandt <cb@256bit.org>
parents:
10867
diff
changeset
|
396 |
10694
fa6c4825a1c4
patch 8.0.0237: when 'wildoptions' is "tagfile" completion may not work
Christian Brabandt <cb@256bit.org>
parents:
10660
diff
changeset
|
397 func Test_cmdline_complete_wildoptions() |
fa6c4825a1c4
patch 8.0.0237: when 'wildoptions' is "tagfile" completion may not work
Christian Brabandt <cb@256bit.org>
parents:
10660
diff
changeset
|
398 help |
fa6c4825a1c4
patch 8.0.0237: when 'wildoptions' is "tagfile" completion may not work
Christian Brabandt <cb@256bit.org>
parents:
10660
diff
changeset
|
399 call feedkeys(":tag /\<c-a>\<c-b>\"\<cr>", 'tx') |
fa6c4825a1c4
patch 8.0.0237: when 'wildoptions' is "tagfile" completion may not work
Christian Brabandt <cb@256bit.org>
parents:
10660
diff
changeset
|
400 let a = join(sort(split(@:)),' ') |
fa6c4825a1c4
patch 8.0.0237: when 'wildoptions' is "tagfile" completion may not work
Christian Brabandt <cb@256bit.org>
parents:
10660
diff
changeset
|
401 set wildoptions=tagfile |
fa6c4825a1c4
patch 8.0.0237: when 'wildoptions' is "tagfile" completion may not work
Christian Brabandt <cb@256bit.org>
parents:
10660
diff
changeset
|
402 call feedkeys(":tag /\<c-a>\<c-b>\"\<cr>", 'tx') |
fa6c4825a1c4
patch 8.0.0237: when 'wildoptions' is "tagfile" completion may not work
Christian Brabandt <cb@256bit.org>
parents:
10660
diff
changeset
|
403 let b = join(sort(split(@:)),' ') |
fa6c4825a1c4
patch 8.0.0237: when 'wildoptions' is "tagfile" completion may not work
Christian Brabandt <cb@256bit.org>
parents:
10660
diff
changeset
|
404 call assert_equal(a, b) |
fa6c4825a1c4
patch 8.0.0237: when 'wildoptions' is "tagfile" completion may not work
Christian Brabandt <cb@256bit.org>
parents:
10660
diff
changeset
|
405 bw! |
fa6c4825a1c4
patch 8.0.0237: when 'wildoptions' is "tagfile" completion may not work
Christian Brabandt <cb@256bit.org>
parents:
10660
diff
changeset
|
406 endfunc |
10817
cc8079703414
patch 8.0.0298: Ex command range with repeated search does not work
Christian Brabandt <cb@256bit.org>
parents:
10694
diff
changeset
|
407 |
11279
b19377368387
patch 8.0.0525: completion for user command argument not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
408 func Test_cmdline_complete_user_cmd() |
b19377368387
patch 8.0.0525: completion for user command argument not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
409 command! -complete=color -nargs=1 Foo : |
b19377368387
patch 8.0.0525: completion for user command argument not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
410 call feedkeys(":Foo \<Tab>\<Home>\"\<cr>", 'tx') |
b19377368387
patch 8.0.0525: completion for user command argument not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
411 call assert_equal('"Foo blue', @:) |
b19377368387
patch 8.0.0525: completion for user command argument not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
412 call feedkeys(":Foo b\<Tab>\<Home>\"\<cr>", 'tx') |
b19377368387
patch 8.0.0525: completion for user command argument not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
413 call assert_equal('"Foo blue', @:) |
b19377368387
patch 8.0.0525: completion for user command argument not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
414 delcommand Foo |
b19377368387
patch 8.0.0525: completion for user command argument not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
415 endfunc |
b19377368387
patch 8.0.0525: completion for user command argument not tested
Christian Brabandt <cb@256bit.org>
parents:
11254
diff
changeset
|
416 |
14135
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
417 func Test_cmdline_complete_user_names() |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
418 if has('unix') && executable('whoami') |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
419 let whoami = systemlist('whoami')[0] |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
420 let first_letter = whoami[0] |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
421 if len(first_letter) > 0 |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
422 " Trying completion of :e ~x where x is the first letter of |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
423 " the user name should complete to at least the user name. |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
424 call feedkeys(':e ~' . first_letter . "\<c-a>\<c-B>\"\<cr>", 'tx') |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
425 call assert_match('^"e \~.*\<' . whoami . '\>', @:) |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
426 endif |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
427 endif |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
428 if has('win32') |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
429 " Just in case: check that the system has an Administrator account. |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
430 let names = system('net user') |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
431 if names =~ 'Administrator' |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
432 " Trying completion of :e ~A should complete to Administrator. |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
433 call feedkeys(':e ~A' . "\<c-a>\<c-B>\"\<cr>", 'tx') |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
434 call assert_match('^"e \~Administrator', @:) |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
435 endif |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
436 endif |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
437 endfunc |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
438 |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
439 funct Test_cmdline_complete_languages() |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
440 let lang = substitute(execute('language messages'), '.*"\(.*\)"$', '\1', '') |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
441 |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
442 call feedkeys(":language \<c-a>\<c-b>\"\<cr>", 'tx') |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
443 call assert_match('^"language .*\<ctype\>.*\<messages\>.*\<time\>', @:) |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
444 |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
445 if has('unix') |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
446 " TODO: these tests don't work on Windows. lang appears to be 'C' |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
447 " but C does not appear in the completion. Why? |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
448 call assert_match('^"language .*\<' . lang . '\>', @:) |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
449 |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
450 call feedkeys(":language messages \<c-a>\<c-b>\"\<cr>", 'tx') |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
451 call assert_match('^"language .*\<' . lang . '\>', @:) |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
452 |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
453 call feedkeys(":language ctype \<c-a>\<c-b>\"\<cr>", 'tx') |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
454 call assert_match('^"language .*\<' . lang . '\>', @:) |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
455 |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
456 call feedkeys(":language time \<c-a>\<c-b>\"\<cr>", 'tx') |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
457 call assert_match('^"language .*\<' . lang . '\>', @:) |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
458 endif |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
459 endfunc |
ee649db58c41
patch 8.1.0085: no test for completing user name and language
Christian Brabandt <cb@256bit.org>
parents:
13998
diff
changeset
|
460 |
12706
9b882316aa63
patch 8.0.1231: expanding file name drops dash
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
461 func Test_cmdline_write_alternatefile() |
9b882316aa63
patch 8.0.1231: expanding file name drops dash
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
462 new |
9b882316aa63
patch 8.0.1231: expanding file name drops dash
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
463 call setline('.', ['one', 'two']) |
9b882316aa63
patch 8.0.1231: expanding file name drops dash
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
464 f foo.txt |
9b882316aa63
patch 8.0.1231: expanding file name drops dash
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
465 new |
9b882316aa63
patch 8.0.1231: expanding file name drops dash
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
466 f #-A |
9b882316aa63
patch 8.0.1231: expanding file name drops dash
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
467 call assert_equal('foo.txt-A', expand('%')) |
9b882316aa63
patch 8.0.1231: expanding file name drops dash
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
468 f #<-B.txt |
9b882316aa63
patch 8.0.1231: expanding file name drops dash
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
469 call assert_equal('foo-B.txt', expand('%')) |
9b882316aa63
patch 8.0.1231: expanding file name drops dash
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
470 f %< |
9b882316aa63
patch 8.0.1231: expanding file name drops dash
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
471 call assert_equal('foo-B', expand('%')) |
9b882316aa63
patch 8.0.1231: expanding file name drops dash
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
472 new |
9b882316aa63
patch 8.0.1231: expanding file name drops dash
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
473 call assert_fails('f #<', 'E95') |
9b882316aa63
patch 8.0.1231: expanding file name drops dash
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
474 bw! |
9b882316aa63
patch 8.0.1231: expanding file name drops dash
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
475 f foo-B.txt |
9b882316aa63
patch 8.0.1231: expanding file name drops dash
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
476 f %<-A |
9b882316aa63
patch 8.0.1231: expanding file name drops dash
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
477 call assert_equal('foo-B-A', expand('%')) |
9b882316aa63
patch 8.0.1231: expanding file name drops dash
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
478 bw! |
9b882316aa63
patch 8.0.1231: expanding file name drops dash
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
479 bw! |
9b882316aa63
patch 8.0.1231: expanding file name drops dash
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
480 endfunc |
9b882316aa63
patch 8.0.1231: expanding file name drops dash
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
481 |
10817
cc8079703414
patch 8.0.0298: Ex command range with repeated search does not work
Christian Brabandt <cb@256bit.org>
parents:
10694
diff
changeset
|
482 " using a leading backslash here |
cc8079703414
patch 8.0.0298: Ex command range with repeated search does not work
Christian Brabandt <cb@256bit.org>
parents:
10694
diff
changeset
|
483 set cpo+=C |
cc8079703414
patch 8.0.0298: Ex command range with repeated search does not work
Christian Brabandt <cb@256bit.org>
parents:
10694
diff
changeset
|
484 |
cc8079703414
patch 8.0.0298: Ex command range with repeated search does not work
Christian Brabandt <cb@256bit.org>
parents:
10694
diff
changeset
|
485 func Test_cmdline_search_range() |
cc8079703414
patch 8.0.0298: Ex command range with repeated search does not work
Christian Brabandt <cb@256bit.org>
parents:
10694
diff
changeset
|
486 new |
cc8079703414
patch 8.0.0298: Ex command range with repeated search does not work
Christian Brabandt <cb@256bit.org>
parents:
10694
diff
changeset
|
487 call setline(1, ['a', 'b', 'c', 'd']) |
cc8079703414
patch 8.0.0298: Ex command range with repeated search does not work
Christian Brabandt <cb@256bit.org>
parents:
10694
diff
changeset
|
488 /d |
cc8079703414
patch 8.0.0298: Ex command range with repeated search does not work
Christian Brabandt <cb@256bit.org>
parents:
10694
diff
changeset
|
489 1,\/s/b/B/ |
cc8079703414
patch 8.0.0298: Ex command range with repeated search does not work
Christian Brabandt <cb@256bit.org>
parents:
10694
diff
changeset
|
490 call assert_equal('B', getline(2)) |
cc8079703414
patch 8.0.0298: Ex command range with repeated search does not work
Christian Brabandt <cb@256bit.org>
parents:
10694
diff
changeset
|
491 |
cc8079703414
patch 8.0.0298: Ex command range with repeated search does not work
Christian Brabandt <cb@256bit.org>
parents:
10694
diff
changeset
|
492 /a |
cc8079703414
patch 8.0.0298: Ex command range with repeated search does not work
Christian Brabandt <cb@256bit.org>
parents:
10694
diff
changeset
|
493 $ |
cc8079703414
patch 8.0.0298: Ex command range with repeated search does not work
Christian Brabandt <cb@256bit.org>
parents:
10694
diff
changeset
|
494 \?,4s/c/C/ |
cc8079703414
patch 8.0.0298: Ex command range with repeated search does not work
Christian Brabandt <cb@256bit.org>
parents:
10694
diff
changeset
|
495 call assert_equal('C', getline(3)) |
cc8079703414
patch 8.0.0298: Ex command range with repeated search does not work
Christian Brabandt <cb@256bit.org>
parents:
10694
diff
changeset
|
496 |
cc8079703414
patch 8.0.0298: Ex command range with repeated search does not work
Christian Brabandt <cb@256bit.org>
parents:
10694
diff
changeset
|
497 call setline(1, ['a', 'b', 'c', 'd']) |
cc8079703414
patch 8.0.0298: Ex command range with repeated search does not work
Christian Brabandt <cb@256bit.org>
parents:
10694
diff
changeset
|
498 %s/c/c/ |
cc8079703414
patch 8.0.0298: Ex command range with repeated search does not work
Christian Brabandt <cb@256bit.org>
parents:
10694
diff
changeset
|
499 1,\&s/b/B/ |
cc8079703414
patch 8.0.0298: Ex command range with repeated search does not work
Christian Brabandt <cb@256bit.org>
parents:
10694
diff
changeset
|
500 call assert_equal('B', getline(2)) |
cc8079703414
patch 8.0.0298: Ex command range with repeated search does not work
Christian Brabandt <cb@256bit.org>
parents:
10694
diff
changeset
|
501 |
cc8079703414
patch 8.0.0298: Ex command range with repeated search does not work
Christian Brabandt <cb@256bit.org>
parents:
10694
diff
changeset
|
502 bwipe! |
cc8079703414
patch 8.0.0298: Ex command range with repeated search does not work
Christian Brabandt <cb@256bit.org>
parents:
10694
diff
changeset
|
503 endfunc |
cc8079703414
patch 8.0.0298: Ex command range with repeated search does not work
Christian Brabandt <cb@256bit.org>
parents:
10694
diff
changeset
|
504 |
10849
6ae12eba42b5
patch 8.0.0314: getcmd*() functions are not tested
Christian Brabandt <cb@256bit.org>
parents:
10817
diff
changeset
|
505 " Tests for getcmdline(), getcmdpos() and getcmdtype() |
6ae12eba42b5
patch 8.0.0314: getcmd*() functions are not tested
Christian Brabandt <cb@256bit.org>
parents:
10817
diff
changeset
|
506 func Check_cmdline(cmdtype) |
6ae12eba42b5
patch 8.0.0314: getcmd*() functions are not tested
Christian Brabandt <cb@256bit.org>
parents:
10817
diff
changeset
|
507 call assert_equal('MyCmd a', getcmdline()) |
6ae12eba42b5
patch 8.0.0314: getcmd*() functions are not tested
Christian Brabandt <cb@256bit.org>
parents:
10817
diff
changeset
|
508 call assert_equal(8, getcmdpos()) |
6ae12eba42b5
patch 8.0.0314: getcmd*() functions are not tested
Christian Brabandt <cb@256bit.org>
parents:
10817
diff
changeset
|
509 call assert_equal(a:cmdtype, getcmdtype()) |
6ae12eba42b5
patch 8.0.0314: getcmd*() functions are not tested
Christian Brabandt <cb@256bit.org>
parents:
10817
diff
changeset
|
510 return '' |
6ae12eba42b5
patch 8.0.0314: getcmd*() functions are not tested
Christian Brabandt <cb@256bit.org>
parents:
10817
diff
changeset
|
511 endfunc |
6ae12eba42b5
patch 8.0.0314: getcmd*() functions are not tested
Christian Brabandt <cb@256bit.org>
parents:
10817
diff
changeset
|
512 |
6ae12eba42b5
patch 8.0.0314: getcmd*() functions are not tested
Christian Brabandt <cb@256bit.org>
parents:
10817
diff
changeset
|
513 func Test_getcmdtype() |
6ae12eba42b5
patch 8.0.0314: getcmd*() functions are not tested
Christian Brabandt <cb@256bit.org>
parents:
10817
diff
changeset
|
514 call feedkeys(":MyCmd a\<C-R>=Check_cmdline(':')\<CR>\<Esc>", "xt") |
6ae12eba42b5
patch 8.0.0314: getcmd*() functions are not tested
Christian Brabandt <cb@256bit.org>
parents:
10817
diff
changeset
|
515 |
6ae12eba42b5
patch 8.0.0314: getcmd*() functions are not tested
Christian Brabandt <cb@256bit.org>
parents:
10817
diff
changeset
|
516 let cmdtype = '' |
6ae12eba42b5
patch 8.0.0314: getcmd*() functions are not tested
Christian Brabandt <cb@256bit.org>
parents:
10817
diff
changeset
|
517 debuggreedy |
6ae12eba42b5
patch 8.0.0314: getcmd*() functions are not tested
Christian Brabandt <cb@256bit.org>
parents:
10817
diff
changeset
|
518 call feedkeys(":debug echo 'test'\<CR>", "t") |
6ae12eba42b5
patch 8.0.0314: getcmd*() functions are not tested
Christian Brabandt <cb@256bit.org>
parents:
10817
diff
changeset
|
519 call feedkeys("let cmdtype = \<C-R>=string(getcmdtype())\<CR>\<CR>", "t") |
6ae12eba42b5
patch 8.0.0314: getcmd*() functions are not tested
Christian Brabandt <cb@256bit.org>
parents:
10817
diff
changeset
|
520 call feedkeys("cont\<CR>", "xt") |
6ae12eba42b5
patch 8.0.0314: getcmd*() functions are not tested
Christian Brabandt <cb@256bit.org>
parents:
10817
diff
changeset
|
521 0debuggreedy |
6ae12eba42b5
patch 8.0.0314: getcmd*() functions are not tested
Christian Brabandt <cb@256bit.org>
parents:
10817
diff
changeset
|
522 call assert_equal('>', cmdtype) |
6ae12eba42b5
patch 8.0.0314: getcmd*() functions are not tested
Christian Brabandt <cb@256bit.org>
parents:
10817
diff
changeset
|
523 |
6ae12eba42b5
patch 8.0.0314: getcmd*() functions are not tested
Christian Brabandt <cb@256bit.org>
parents:
10817
diff
changeset
|
524 call feedkeys("/MyCmd a\<C-R>=Check_cmdline('/')\<CR>\<Esc>", "xt") |
6ae12eba42b5
patch 8.0.0314: getcmd*() functions are not tested
Christian Brabandt <cb@256bit.org>
parents:
10817
diff
changeset
|
525 call feedkeys("?MyCmd a\<C-R>=Check_cmdline('?')\<CR>\<Esc>", "xt") |
6ae12eba42b5
patch 8.0.0314: getcmd*() functions are not tested
Christian Brabandt <cb@256bit.org>
parents:
10817
diff
changeset
|
526 |
6ae12eba42b5
patch 8.0.0314: getcmd*() functions are not tested
Christian Brabandt <cb@256bit.org>
parents:
10817
diff
changeset
|
527 call feedkeys(":call input('Answer?')\<CR>", "t") |
10867
9a5a4b36a1c1
patch 8.0.0323: one second pause when running cmdline test
Christian Brabandt <cb@256bit.org>
parents:
10849
diff
changeset
|
528 call feedkeys("MyCmd a\<C-R>=Check_cmdline('@')\<CR>\<C-C>", "xt") |
10849
6ae12eba42b5
patch 8.0.0314: getcmd*() functions are not tested
Christian Brabandt <cb@256bit.org>
parents:
10817
diff
changeset
|
529 |
6ae12eba42b5
patch 8.0.0314: getcmd*() functions are not tested
Christian Brabandt <cb@256bit.org>
parents:
10817
diff
changeset
|
530 call feedkeys(":insert\<CR>MyCmd a\<C-R>=Check_cmdline('-')\<CR>\<Esc>", "xt") |
6ae12eba42b5
patch 8.0.0314: getcmd*() functions are not tested
Christian Brabandt <cb@256bit.org>
parents:
10817
diff
changeset
|
531 |
6ae12eba42b5
patch 8.0.0314: getcmd*() functions are not tested
Christian Brabandt <cb@256bit.org>
parents:
10817
diff
changeset
|
532 cnoremap <expr> <F6> Check_cmdline('=') |
6ae12eba42b5
patch 8.0.0314: getcmd*() functions are not tested
Christian Brabandt <cb@256bit.org>
parents:
10817
diff
changeset
|
533 call feedkeys("a\<C-R>=MyCmd a\<F6>\<Esc>\<Esc>", "xt") |
6ae12eba42b5
patch 8.0.0314: getcmd*() functions are not tested
Christian Brabandt <cb@256bit.org>
parents:
10817
diff
changeset
|
534 cunmap <F6> |
6ae12eba42b5
patch 8.0.0314: getcmd*() functions are not tested
Christian Brabandt <cb@256bit.org>
parents:
10817
diff
changeset
|
535 endfunc |
6ae12eba42b5
patch 8.0.0314: getcmd*() functions are not tested
Christian Brabandt <cb@256bit.org>
parents:
10817
diff
changeset
|
536 |
14167
3ca818b65cde
patch 8.1.0101: no test for getcmdwintype()
Christian Brabandt <cb@256bit.org>
parents:
14135
diff
changeset
|
537 func Test_getcmdwintype() |
3ca818b65cde
patch 8.1.0101: no test for getcmdwintype()
Christian Brabandt <cb@256bit.org>
parents:
14135
diff
changeset
|
538 call feedkeys("q/:let a = getcmdwintype()\<CR>:q\<CR>", 'x!') |
3ca818b65cde
patch 8.1.0101: no test for getcmdwintype()
Christian Brabandt <cb@256bit.org>
parents:
14135
diff
changeset
|
539 call assert_equal('/', a) |
3ca818b65cde
patch 8.1.0101: no test for getcmdwintype()
Christian Brabandt <cb@256bit.org>
parents:
14135
diff
changeset
|
540 |
3ca818b65cde
patch 8.1.0101: no test for getcmdwintype()
Christian Brabandt <cb@256bit.org>
parents:
14135
diff
changeset
|
541 call feedkeys("q?:let a = getcmdwintype()\<CR>:q\<CR>", 'x!') |
3ca818b65cde
patch 8.1.0101: no test for getcmdwintype()
Christian Brabandt <cb@256bit.org>
parents:
14135
diff
changeset
|
542 call assert_equal('?', a) |
3ca818b65cde
patch 8.1.0101: no test for getcmdwintype()
Christian Brabandt <cb@256bit.org>
parents:
14135
diff
changeset
|
543 |
3ca818b65cde
patch 8.1.0101: no test for getcmdwintype()
Christian Brabandt <cb@256bit.org>
parents:
14135
diff
changeset
|
544 call feedkeys("q::let a = getcmdwintype()\<CR>:q\<CR>", 'x!') |
3ca818b65cde
patch 8.1.0101: no test for getcmdwintype()
Christian Brabandt <cb@256bit.org>
parents:
14135
diff
changeset
|
545 call assert_equal(':', a) |
3ca818b65cde
patch 8.1.0101: no test for getcmdwintype()
Christian Brabandt <cb@256bit.org>
parents:
14135
diff
changeset
|
546 |
3ca818b65cde
patch 8.1.0101: no test for getcmdwintype()
Christian Brabandt <cb@256bit.org>
parents:
14135
diff
changeset
|
547 call feedkeys(":\<C-F>:let a = getcmdwintype()\<CR>:q\<CR>", 'x!') |
3ca818b65cde
patch 8.1.0101: no test for getcmdwintype()
Christian Brabandt <cb@256bit.org>
parents:
14135
diff
changeset
|
548 call assert_equal(':', a) |
3ca818b65cde
patch 8.1.0101: no test for getcmdwintype()
Christian Brabandt <cb@256bit.org>
parents:
14135
diff
changeset
|
549 |
3ca818b65cde
patch 8.1.0101: no test for getcmdwintype()
Christian Brabandt <cb@256bit.org>
parents:
14135
diff
changeset
|
550 call assert_equal('', getcmdwintype()) |
3ca818b65cde
patch 8.1.0101: no test for getcmdwintype()
Christian Brabandt <cb@256bit.org>
parents:
14135
diff
changeset
|
551 endfunc |
3ca818b65cde
patch 8.1.0101: no test for getcmdwintype()
Christian Brabandt <cb@256bit.org>
parents:
14135
diff
changeset
|
552 |
11323
3e799a37ea22
patch 8.0.0547: extra line break in verbosefile
Christian Brabandt <cb@256bit.org>
parents:
11279
diff
changeset
|
553 func Test_verbosefile() |
3e799a37ea22
patch 8.0.0547: extra line break in verbosefile
Christian Brabandt <cb@256bit.org>
parents:
11279
diff
changeset
|
554 set verbosefile=Xlog |
3e799a37ea22
patch 8.0.0547: extra line break in verbosefile
Christian Brabandt <cb@256bit.org>
parents:
11279
diff
changeset
|
555 echomsg 'foo' |
3e799a37ea22
patch 8.0.0547: extra line break in verbosefile
Christian Brabandt <cb@256bit.org>
parents:
11279
diff
changeset
|
556 echomsg 'bar' |
3e799a37ea22
patch 8.0.0547: extra line break in verbosefile
Christian Brabandt <cb@256bit.org>
parents:
11279
diff
changeset
|
557 set verbosefile= |
3e799a37ea22
patch 8.0.0547: extra line break in verbosefile
Christian Brabandt <cb@256bit.org>
parents:
11279
diff
changeset
|
558 let log = readfile('Xlog') |
3e799a37ea22
patch 8.0.0547: extra line break in verbosefile
Christian Brabandt <cb@256bit.org>
parents:
11279
diff
changeset
|
559 call assert_match("foo\nbar", join(log, "\n")) |
3e799a37ea22
patch 8.0.0547: extra line break in verbosefile
Christian Brabandt <cb@256bit.org>
parents:
11279
diff
changeset
|
560 call delete('Xlog') |
3e799a37ea22
patch 8.0.0547: extra line break in verbosefile
Christian Brabandt <cb@256bit.org>
parents:
11279
diff
changeset
|
561 endfunc |
3e799a37ea22
patch 8.0.0547: extra line break in verbosefile
Christian Brabandt <cb@256bit.org>
parents:
11279
diff
changeset
|
562 |
13890
3aac8d62351c
patch 8.0.1816: no test for setcmdpos()
Christian Brabandt <cb@256bit.org>
parents:
13831
diff
changeset
|
563 func Test_setcmdpos() |
3aac8d62351c
patch 8.0.1816: no test for setcmdpos()
Christian Brabandt <cb@256bit.org>
parents:
13831
diff
changeset
|
564 func InsertTextAtPos(text, pos) |
3aac8d62351c
patch 8.0.1816: no test for setcmdpos()
Christian Brabandt <cb@256bit.org>
parents:
13831
diff
changeset
|
565 call assert_equal(0, setcmdpos(a:pos)) |
3aac8d62351c
patch 8.0.1816: no test for setcmdpos()
Christian Brabandt <cb@256bit.org>
parents:
13831
diff
changeset
|
566 return a:text |
3aac8d62351c
patch 8.0.1816: no test for setcmdpos()
Christian Brabandt <cb@256bit.org>
parents:
13831
diff
changeset
|
567 endfunc |
3aac8d62351c
patch 8.0.1816: no test for setcmdpos()
Christian Brabandt <cb@256bit.org>
parents:
13831
diff
changeset
|
568 |
3aac8d62351c
patch 8.0.1816: no test for setcmdpos()
Christian Brabandt <cb@256bit.org>
parents:
13831
diff
changeset
|
569 " setcmdpos() with position in the middle of the command line. |
3aac8d62351c
patch 8.0.1816: no test for setcmdpos()
Christian Brabandt <cb@256bit.org>
parents:
13831
diff
changeset
|
570 call feedkeys(":\"12\<C-R>=InsertTextAtPos('a', 3)\<CR>b\<CR>", 'xt') |
3aac8d62351c
patch 8.0.1816: no test for setcmdpos()
Christian Brabandt <cb@256bit.org>
parents:
13831
diff
changeset
|
571 call assert_equal('"1ab2', @:) |
3aac8d62351c
patch 8.0.1816: no test for setcmdpos()
Christian Brabandt <cb@256bit.org>
parents:
13831
diff
changeset
|
572 |
3aac8d62351c
patch 8.0.1816: no test for setcmdpos()
Christian Brabandt <cb@256bit.org>
parents:
13831
diff
changeset
|
573 call feedkeys(":\"12\<C-R>\<C-R>=InsertTextAtPos('a', 3)\<CR>b\<CR>", 'xt') |
3aac8d62351c
patch 8.0.1816: no test for setcmdpos()
Christian Brabandt <cb@256bit.org>
parents:
13831
diff
changeset
|
574 call assert_equal('"1b2a', @:) |
3aac8d62351c
patch 8.0.1816: no test for setcmdpos()
Christian Brabandt <cb@256bit.org>
parents:
13831
diff
changeset
|
575 |
3aac8d62351c
patch 8.0.1816: no test for setcmdpos()
Christian Brabandt <cb@256bit.org>
parents:
13831
diff
changeset
|
576 " setcmdpos() with position beyond the end of the command line. |
3aac8d62351c
patch 8.0.1816: no test for setcmdpos()
Christian Brabandt <cb@256bit.org>
parents:
13831
diff
changeset
|
577 call feedkeys(":\"12\<C-B>\<C-R>=InsertTextAtPos('a', 10)\<CR>b\<CR>", 'xt') |
3aac8d62351c
patch 8.0.1816: no test for setcmdpos()
Christian Brabandt <cb@256bit.org>
parents:
13831
diff
changeset
|
578 call assert_equal('"12ab', @:) |
3aac8d62351c
patch 8.0.1816: no test for setcmdpos()
Christian Brabandt <cb@256bit.org>
parents:
13831
diff
changeset
|
579 |
3aac8d62351c
patch 8.0.1816: no test for setcmdpos()
Christian Brabandt <cb@256bit.org>
parents:
13831
diff
changeset
|
580 " setcmdpos() returns 1 when not editing the command line. |
3aac8d62351c
patch 8.0.1816: no test for setcmdpos()
Christian Brabandt <cb@256bit.org>
parents:
13831
diff
changeset
|
581 call assert_equal(1, setcmdpos(3)) |
3aac8d62351c
patch 8.0.1816: no test for setcmdpos()
Christian Brabandt <cb@256bit.org>
parents:
13831
diff
changeset
|
582 endfunc |
3aac8d62351c
patch 8.0.1816: no test for setcmdpos()
Christian Brabandt <cb@256bit.org>
parents:
13831
diff
changeset
|
583 |
15320
de8dc397cd2a
patch 8.1.0668: no test for overstrike mode in the command line
Bram Moolenaar <Bram@vim.org>
parents:
14417
diff
changeset
|
584 func Test_cmdline_overstrike() |
de8dc397cd2a
patch 8.1.0668: no test for overstrike mode in the command line
Bram Moolenaar <Bram@vim.org>
parents:
14417
diff
changeset
|
585 let encodings = has('multi_byte') ? [ 'latin1', 'utf8' ] : [ 'latin1' ] |
de8dc397cd2a
patch 8.1.0668: no test for overstrike mode in the command line
Bram Moolenaar <Bram@vim.org>
parents:
14417
diff
changeset
|
586 let encoding_save = &encoding |
de8dc397cd2a
patch 8.1.0668: no test for overstrike mode in the command line
Bram Moolenaar <Bram@vim.org>
parents:
14417
diff
changeset
|
587 |
de8dc397cd2a
patch 8.1.0668: no test for overstrike mode in the command line
Bram Moolenaar <Bram@vim.org>
parents:
14417
diff
changeset
|
588 for e in encodings |
de8dc397cd2a
patch 8.1.0668: no test for overstrike mode in the command line
Bram Moolenaar <Bram@vim.org>
parents:
14417
diff
changeset
|
589 exe 'set encoding=' . e |
de8dc397cd2a
patch 8.1.0668: no test for overstrike mode in the command line
Bram Moolenaar <Bram@vim.org>
parents:
14417
diff
changeset
|
590 |
de8dc397cd2a
patch 8.1.0668: no test for overstrike mode in the command line
Bram Moolenaar <Bram@vim.org>
parents:
14417
diff
changeset
|
591 " Test overstrike in the middle of the command line. |
de8dc397cd2a
patch 8.1.0668: no test for overstrike mode in the command line
Bram Moolenaar <Bram@vim.org>
parents:
14417
diff
changeset
|
592 call feedkeys(":\"01234\<home>\<right>\<right>ab\<right>\<insert>cd\<enter>", 'xt') |
de8dc397cd2a
patch 8.1.0668: no test for overstrike mode in the command line
Bram Moolenaar <Bram@vim.org>
parents:
14417
diff
changeset
|
593 call assert_equal('"0ab1cd4', @:) |
de8dc397cd2a
patch 8.1.0668: no test for overstrike mode in the command line
Bram Moolenaar <Bram@vim.org>
parents:
14417
diff
changeset
|
594 |
de8dc397cd2a
patch 8.1.0668: no test for overstrike mode in the command line
Bram Moolenaar <Bram@vim.org>
parents:
14417
diff
changeset
|
595 " Test overstrike going beyond end of command line. |
de8dc397cd2a
patch 8.1.0668: no test for overstrike mode in the command line
Bram Moolenaar <Bram@vim.org>
parents:
14417
diff
changeset
|
596 call feedkeys(":\"01234\<home>\<right>\<right>ab\<right>\<insert>cdefgh\<enter>", 'xt') |
de8dc397cd2a
patch 8.1.0668: no test for overstrike mode in the command line
Bram Moolenaar <Bram@vim.org>
parents:
14417
diff
changeset
|
597 call assert_equal('"0ab1cdefgh', @:) |
de8dc397cd2a
patch 8.1.0668: no test for overstrike mode in the command line
Bram Moolenaar <Bram@vim.org>
parents:
14417
diff
changeset
|
598 |
de8dc397cd2a
patch 8.1.0668: no test for overstrike mode in the command line
Bram Moolenaar <Bram@vim.org>
parents:
14417
diff
changeset
|
599 " Test toggling insert/overstrike a few times. |
de8dc397cd2a
patch 8.1.0668: no test for overstrike mode in the command line
Bram Moolenaar <Bram@vim.org>
parents:
14417
diff
changeset
|
600 call feedkeys(":\"01234\<home>\<right>ab\<right>\<insert>cd\<right>\<insert>ef\<enter>", 'xt') |
de8dc397cd2a
patch 8.1.0668: no test for overstrike mode in the command line
Bram Moolenaar <Bram@vim.org>
parents:
14417
diff
changeset
|
601 call assert_equal('"ab0cd3ef4', @:) |
de8dc397cd2a
patch 8.1.0668: no test for overstrike mode in the command line
Bram Moolenaar <Bram@vim.org>
parents:
14417
diff
changeset
|
602 endfor |
de8dc397cd2a
patch 8.1.0668: no test for overstrike mode in the command line
Bram Moolenaar <Bram@vim.org>
parents:
14417
diff
changeset
|
603 |
de8dc397cd2a
patch 8.1.0668: no test for overstrike mode in the command line
Bram Moolenaar <Bram@vim.org>
parents:
14417
diff
changeset
|
604 if has('multi_byte') |
de8dc397cd2a
patch 8.1.0668: no test for overstrike mode in the command line
Bram Moolenaar <Bram@vim.org>
parents:
14417
diff
changeset
|
605 " Test overstrike with multi-byte characters. |
de8dc397cd2a
patch 8.1.0668: no test for overstrike mode in the command line
Bram Moolenaar <Bram@vim.org>
parents:
14417
diff
changeset
|
606 call feedkeys(":\"テキストエディタ\<home>\<right>\<right>ab\<right>\<insert>cd\<enter>", 'xt') |
de8dc397cd2a
patch 8.1.0668: no test for overstrike mode in the command line
Bram Moolenaar <Bram@vim.org>
parents:
14417
diff
changeset
|
607 call assert_equal('"テabキcdエディタ', @:) |
de8dc397cd2a
patch 8.1.0668: no test for overstrike mode in the command line
Bram Moolenaar <Bram@vim.org>
parents:
14417
diff
changeset
|
608 endif |
de8dc397cd2a
patch 8.1.0668: no test for overstrike mode in the command line
Bram Moolenaar <Bram@vim.org>
parents:
14417
diff
changeset
|
609 |
de8dc397cd2a
patch 8.1.0668: no test for overstrike mode in the command line
Bram Moolenaar <Bram@vim.org>
parents:
14417
diff
changeset
|
610 let &encoding = encoding_save |
de8dc397cd2a
patch 8.1.0668: no test for overstrike mode in the command line
Bram Moolenaar <Bram@vim.org>
parents:
14417
diff
changeset
|
611 endfunc |
de8dc397cd2a
patch 8.1.0668: no test for overstrike mode in the command line
Bram Moolenaar <Bram@vim.org>
parents:
14417
diff
changeset
|
612 |
10817
cc8079703414
patch 8.0.0298: Ex command range with repeated search does not work
Christian Brabandt <cb@256bit.org>
parents:
10694
diff
changeset
|
613 set cpo& |