Mercurial > vim
comparison src/testdir/test_cmdline.vim @ 30164:f7a2de8a4ddc v9.0.0418
patch 9.0.0418: manually deleting temp test files
Commit: https://github.com/vim/vim/commit/45bbaef0382c5468d9fac511775bd99ea7bf5b84
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Sep 8 16:39:22 2022 +0100
patch 9.0.0418: manually deleting temp test files
Problem: Manually deleting temp test files.
Solution: Use the 'D' flag of writefile() and mkdir().
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 08 Sep 2022 17:45:03 +0200 |
parents | f005dea14c8b |
children | 5928627f00e5 |
comparison
equal
deleted
inserted
replaced
30163:ac28d70ac476 | 30164:f7a2de8a4ddc |
---|---|
18 delfunc SaveLastScreenLine | 18 delfunc SaveLastScreenLine |
19 cunmap <F4> | 19 cunmap <F4> |
20 endfunc | 20 endfunc |
21 | 21 |
22 func Test_complete_tab() | 22 func Test_complete_tab() |
23 call writefile(['testfile'], 'Xtestfile') | 23 call writefile(['testfile'], 'Xtestfile', 'D') |
24 call feedkeys(":e Xtest\t\r", "tx") | 24 call feedkeys(":e Xtest\t\r", "tx") |
25 call assert_equal('testfile', getline(1)) | 25 call assert_equal('testfile', getline(1)) |
26 | 26 |
27 " Pressing <Tab> after '%' completes the current file, also on MS-Windows | 27 " Pressing <Tab> after '%' completes the current file, also on MS-Windows |
28 call feedkeys(":e %\t\r", "tx") | 28 call feedkeys(":e %\t\r", "tx") |
29 call assert_equal('e Xtestfile', @:) | 29 call assert_equal('e Xtestfile', @:) |
30 call delete('Xtestfile') | |
31 endfunc | 30 endfunc |
32 | 31 |
33 func Test_complete_list() | 32 func Test_complete_list() |
34 " We can't see the output, but at least we check the code runs properly. | 33 " We can't see the output, but at least we check the code runs properly. |
35 call feedkeys(":e test\<C-D>\r", "tx") | 34 call feedkeys(":e test\<C-D>\r", "tx") |
40 call feedkeys(":chistory \<C-D>\<C-B>\"\<CR>", 'xt') | 39 call feedkeys(":chistory \<C-D>\<C-B>\"\<CR>", 'xt') |
41 call assert_equal("\"chistory \<C-D>", @:) | 40 call assert_equal("\"chistory \<C-D>", @:) |
42 | 41 |
43 " Test for displaying the tail of the completion matches | 42 " Test for displaying the tail of the completion matches |
44 set wildmode=longest,full | 43 set wildmode=longest,full |
45 call mkdir('Xtest') | 44 call mkdir('Xtest', 'R') |
46 call writefile([], 'Xtest/a.c') | 45 call writefile([], 'Xtest/a.c') |
47 call writefile([], 'Xtest/a.h') | 46 call writefile([], 'Xtest/a.h') |
48 let g:Sline = '' | 47 let g:Sline = '' |
49 call feedkeys(":e Xtest/\<C-D>\<F4>\<C-B>\"\<CR>", 'xt') | 48 call feedkeys(":e Xtest/\<C-D>\<F4>\<C-B>\"\<CR>", 'xt') |
50 call assert_equal('a.c a.h', g:Sline) | 49 call assert_equal('a.c a.h', g:Sline) |
76 let g:Sline = '' | 75 let g:Sline = '' |
77 call feedkeys(":e Xtes[/\<C-D>\<F4>\<C-B>\"\<CR>", 'xt') | 76 call feedkeys(":e Xtes[/\<C-D>\<F4>\<C-B>\"\<CR>", 'xt') |
78 call assert_equal(':e Xtes[/', g:Sline) | 77 call assert_equal(':e Xtes[/', g:Sline) |
79 call assert_equal('"e Xtes[/', @:) | 78 call assert_equal('"e Xtes[/', @:) |
80 | 79 |
81 call delete('Xtest', 'rf') | |
82 set wildmode& | 80 set wildmode& |
83 endfunc | 81 endfunc |
84 | 82 |
85 func Test_complete_wildmenu() | 83 func Test_complete_wildmenu() |
86 call mkdir('Xwilddir1/Xdir2', 'p') | 84 call mkdir('Xwilddir1/Xdir2', 'pR') |
87 call writefile(['testfile1'], 'Xwilddir1/Xtestfile1') | 85 call writefile(['testfile1'], 'Xwilddir1/Xtestfile1') |
88 call writefile(['testfile2'], 'Xwilddir1/Xtestfile2') | 86 call writefile(['testfile2'], 'Xwilddir1/Xtestfile2') |
89 call writefile(['testfile3'], 'Xwilddir1/Xdir2/Xtestfile3') | 87 call writefile(['testfile3'], 'Xwilddir1/Xdir2/Xtestfile3') |
90 call writefile(['testfile3'], 'Xwilddir1/Xdir2/Xtestfile4') | 88 call writefile(['testfile3'], 'Xwilddir1/Xdir2/Xtestfile4') |
91 set wildmenu | 89 set wildmenu |
160 call feedkeys(":sign \<Tab>\<PageUp>\<Left>\<Right>\<C-A>\<C-B>\"\<CR>", 'tx') | 158 call feedkeys(":sign \<Tab>\<PageUp>\<Left>\<Right>\<C-A>\<C-B>\"\<CR>", 'tx') |
161 call assert_equal('"TestWildMenu', @:) | 159 call assert_equal('"TestWildMenu', @:) |
162 | 160 |
163 " cleanup | 161 " cleanup |
164 %bwipe | 162 %bwipe |
165 call delete('Xwilddir1', 'rf') | |
166 set nowildmenu | 163 set nowildmenu |
167 endfunc | 164 endfunc |
168 | 165 |
169 func Test_wildmenu_screendump() | 166 func Test_wildmenu_screendump() |
170 CheckScreendump | 167 CheckScreendump |
171 | 168 |
172 let lines =<< trim [SCRIPT] | 169 let lines =<< trim [SCRIPT] |
173 set wildmenu hlsearch | 170 set wildmenu hlsearch |
174 [SCRIPT] | 171 [SCRIPT] |
175 call writefile(lines, 'XTest_wildmenu') | 172 call writefile(lines, 'XTest_wildmenu', 'D') |
176 | 173 |
177 let buf = RunVimInTerminal('-S XTest_wildmenu', {'rows': 8}) | 174 let buf = RunVimInTerminal('-S XTest_wildmenu', {'rows': 8}) |
178 call term_sendkeys(buf, ":vim\<Tab>") | 175 call term_sendkeys(buf, ":vim\<Tab>") |
179 call VerifyScreenDump(buf, 'Test_wildmenu_1', {}) | 176 call VerifyScreenDump(buf, 'Test_wildmenu_1', {}) |
180 | 177 |
188 call VerifyScreenDump(buf, 'Test_wildmenu_4', {}) | 185 call VerifyScreenDump(buf, 'Test_wildmenu_4', {}) |
189 call term_sendkeys(buf, "\<Esc>") | 186 call term_sendkeys(buf, "\<Esc>") |
190 | 187 |
191 " clean up | 188 " clean up |
192 call StopVimInTerminal(buf) | 189 call StopVimInTerminal(buf) |
193 call delete('XTest_wildmenu') | |
194 endfunc | 190 endfunc |
195 | 191 |
196 func Test_redraw_in_autocmd() | 192 func Test_redraw_in_autocmd() |
197 CheckScreendump | 193 CheckScreendump |
198 | 194 |
199 let lines =<< trim END | 195 let lines =<< trim END |
200 set cmdheight=2 | 196 set cmdheight=2 |
201 autocmd CmdlineChanged * redraw | 197 autocmd CmdlineChanged * redraw |
202 END | 198 END |
203 call writefile(lines, 'XTest_redraw') | 199 call writefile(lines, 'XTest_redraw', 'D') |
204 | 200 |
205 let buf = RunVimInTerminal('-S XTest_redraw', {'rows': 8}) | 201 let buf = RunVimInTerminal('-S XTest_redraw', {'rows': 8}) |
206 call term_sendkeys(buf, ":for i in range(3)\<CR>") | 202 call term_sendkeys(buf, ":for i in range(3)\<CR>") |
207 call VerifyScreenDump(buf, 'Test_redraw_in_autocmd_1', {}) | 203 call VerifyScreenDump(buf, 'Test_redraw_in_autocmd_1', {}) |
208 | 204 |
210 call VerifyScreenDump(buf, 'Test_redraw_in_autocmd_2', {}) | 206 call VerifyScreenDump(buf, 'Test_redraw_in_autocmd_2', {}) |
211 | 207 |
212 " clean up | 208 " clean up |
213 call term_sendkeys(buf, "\<CR>") | 209 call term_sendkeys(buf, "\<CR>") |
214 call StopVimInTerminal(buf) | 210 call StopVimInTerminal(buf) |
215 call delete('XTest_redraw') | |
216 endfunc | 211 endfunc |
217 | 212 |
218 func Test_changing_cmdheight() | 213 func Test_changing_cmdheight() |
219 CheckScreendump | 214 CheckScreendump |
220 | 215 |
221 let lines =<< trim END | 216 let lines =<< trim END |
222 set cmdheight=1 laststatus=2 | 217 set cmdheight=1 laststatus=2 |
223 END | 218 END |
224 call writefile(lines, 'XTest_cmdheight') | 219 call writefile(lines, 'XTest_cmdheight', 'D') |
225 | 220 |
226 let buf = RunVimInTerminal('-S XTest_cmdheight', {'rows': 8}) | 221 let buf = RunVimInTerminal('-S XTest_cmdheight', {'rows': 8}) |
227 call term_sendkeys(buf, ":resize -3\<CR>") | 222 call term_sendkeys(buf, ":resize -3\<CR>") |
228 call VerifyScreenDump(buf, 'Test_changing_cmdheight_1', {}) | 223 call VerifyScreenDump(buf, 'Test_changing_cmdheight_1', {}) |
229 | 224 |
244 call term_sendkeys(buf, ":set cmdheight=1\<CR>") | 239 call term_sendkeys(buf, ":set cmdheight=1\<CR>") |
245 call VerifyScreenDump(buf, 'Test_changing_cmdheight_5', {}) | 240 call VerifyScreenDump(buf, 'Test_changing_cmdheight_5', {}) |
246 | 241 |
247 " clean up | 242 " clean up |
248 call StopVimInTerminal(buf) | 243 call StopVimInTerminal(buf) |
249 call delete('XTest_cmdheight') | |
250 endfunc | 244 endfunc |
251 | 245 |
252 func Test_map_completion() | 246 func Test_map_completion() |
253 call feedkeys(":map <unique> <si\<Tab>\<Home>\"\<CR>", 'xt') | 247 call feedkeys(":map <unique> <si\<Tab>\<Home>\"\<CR>", 'xt') |
254 call assert_equal('"map <unique> <silent>', getreg(':')) | 248 call assert_equal('"map <unique> <silent>', getreg(':')) |
453 set wildignore=*.vim | 447 set wildignore=*.vim |
454 let l = getcompletion('run', 'file', 1) | 448 let l = getcompletion('run', 'file', 1) |
455 call assert_true(index(l, 'runtest.vim') < 0) | 449 call assert_true(index(l, 'runtest.vim') < 0) |
456 set wildignore& | 450 set wildignore& |
457 " Directory name with space character | 451 " Directory name with space character |
458 call mkdir('Xdir with space') | 452 call mkdir('Xdir with space', 'D') |
459 call assert_equal(['Xdir with space/'], getcompletion('Xdir\ w', 'shellcmd')) | 453 call assert_equal(['Xdir with space/'], getcompletion('Xdir\ w', 'shellcmd')) |
460 call assert_equal(['./Xdir with space/'], getcompletion('./Xdir', 'shellcmd')) | 454 call assert_equal(['./Xdir with space/'], getcompletion('./Xdir', 'shellcmd')) |
461 call delete('Xdir with space', 'd') | |
462 | 455 |
463 let l = getcompletion('ha', 'filetype') | 456 let l = getcompletion('ha', 'filetype') |
464 call assert_true(index(l, 'hamster') >= 0) | 457 call assert_true(index(l, 'hamster') >= 0) |
465 let l = getcompletion('horse', 'filetype') | 458 let l = getcompletion('horse', 'filetype') |
466 call assert_equal([], l) | 459 call assert_equal([], l) |
579 if has('profile') | 572 if has('profile') |
580 call add(names, 'syntime') | 573 call add(names, 'syntime') |
581 endif | 574 endif |
582 | 575 |
583 set tags=Xtags | 576 set tags=Xtags |
584 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", "word\tfile\tcmd"], 'Xtags') | 577 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", "word\tfile\tcmd"], 'Xtags', 'D') |
585 | 578 |
586 for name in names | 579 for name in names |
587 let matchcount = len(getcompletion('', name)) | 580 let matchcount = len(getcompletion('', name)) |
588 call assert_true(matchcount >= 0, 'No matches for ' . name) | 581 call assert_true(matchcount >= 0, 'No matches for ' . name) |
589 endfor | 582 endfor |
590 | 583 |
591 call delete('Xtags') | |
592 set tags& | 584 set tags& |
593 | 585 |
594 edit a~b | 586 edit a~b |
595 enew | 587 enew |
596 call assert_equal(['a~b'], getcompletion('a~', 'buffer')) | 588 call assert_equal(['a~b'], getcompletion('a~', 'buffer')) |
631 export def Complete(..._): string | 623 export def Complete(..._): string |
632 return 'match' | 624 return 'match' |
633 enddef | 625 enddef |
634 echo this will cause an error | 626 echo this will cause an error |
635 END | 627 END |
636 call mkdir('Xdir/autoload', 'p') | 628 call mkdir('Xdir/autoload', 'pR') |
637 call writefile(lines, 'Xdir/autoload/script.vim') | 629 call writefile(lines, 'Xdir/autoload/script.vim') |
638 exe 'set rtp+=' .. getcwd() .. '/Xdir' | 630 exe 'set rtp+=' .. getcwd() .. '/Xdir' |
639 | 631 |
640 let lines =<< trim END | 632 let lines =<< trim END |
641 vim9script | 633 vim9script |
645 feedkeys(":Cmd \<Tab>", 'xt') | 637 feedkeys(":Cmd \<Tab>", 'xt') |
646 END | 638 END |
647 call v9.CheckScriptFailure(lines, 'E121: Undefined variable: this') | 639 call v9.CheckScriptFailure(lines, 'E121: Undefined variable: this') |
648 | 640 |
649 let &rtp = save_rtp | 641 let &rtp = save_rtp |
650 call delete('Xdir', 'rf') | |
651 endfunc | 642 endfunc |
652 | 643 |
653 func Test_fullcommand() | 644 func Test_fullcommand() |
654 let tests = { | 645 let tests = { |
655 \ '': '', | 646 \ '': '', |
696 endfunc | 687 endfunc |
697 | 688 |
698 func Test_shellcmd_completion() | 689 func Test_shellcmd_completion() |
699 let save_path = $PATH | 690 let save_path = $PATH |
700 | 691 |
701 call mkdir('Xpathdir/Xpathsubdir', 'p') | 692 call mkdir('Xpathdir/Xpathsubdir', 'pR') |
702 call writefile([''], 'Xpathdir/Xfile.exe') | 693 call writefile([''], 'Xpathdir/Xfile.exe') |
703 call setfperm('Xpathdir/Xfile.exe', 'rwx------') | 694 call setfperm('Xpathdir/Xfile.exe', 'rwx------') |
704 | 695 |
705 " Set PATH to example directory without trailing slash. | 696 " Set PATH to example directory without trailing slash. |
706 let $PATH = getcwd() . '/Xpathdir' | 697 let $PATH = getcwd() . '/Xpathdir' |
712 let actual = getcompletion('X', 'shellcmd') | 703 let actual = getcompletion('X', 'shellcmd') |
713 let expected = map(filter(glob('*', 0, 1), 'isdirectory(v:val) && v:val[0] == "X"'), 'v:val . "/"') | 704 let expected = map(filter(glob('*', 0, 1), 'isdirectory(v:val) && v:val[0] == "X"'), 'v:val . "/"') |
714 call insert(expected, 'Xfile.exe') | 705 call insert(expected, 'Xfile.exe') |
715 call assert_equal(expected, actual) | 706 call assert_equal(expected, actual) |
716 | 707 |
717 call delete('Xpathdir', 'rf') | |
718 let $PATH = save_path | 708 let $PATH = save_path |
719 endfunc | 709 endfunc |
720 | 710 |
721 func Test_expand_star_star() | 711 func Test_expand_star_star() |
722 call mkdir('a/b', 'p') | 712 call mkdir('a/b', 'pR') |
723 call writefile(['asdfasdf'], 'a/b/fileXname') | 713 call writefile(['asdfasdf'], 'a/b/fileXname') |
724 call feedkeys(":find **/fileXname\<Tab>\<CR>", 'xt') | 714 call feedkeys(":find **/fileXname\<Tab>\<CR>", 'xt') |
725 call assert_equal('find a/b/fileXname', @:) | 715 call assert_equal('find a/b/fileXname', @:) |
726 bwipe! | 716 bwipe! |
727 call delete('a', 'rf') | |
728 endfunc | 717 endfunc |
729 | 718 |
730 func Test_cmdline_paste() | 719 func Test_cmdline_paste() |
731 let @a = "def" | 720 let @a = "def" |
732 call feedkeys(":abc \<C-R>a ghi\<C-B>\"\<CR>", 'tx') | 721 call feedkeys(":abc \<C-R>a ghi\<C-B>\"\<CR>", 'tx') |
830 2;') | 819 2;') |
831 quit | 820 quit |
832 endfunc | 821 endfunc |
833 | 822 |
834 func Test_illegal_address2() | 823 func Test_illegal_address2() |
835 call writefile(['c', 'x', ' x', '.', '1;y'], 'Xtest.vim') | 824 call writefile(['c', 'x', ' x', '.', '1;y'], 'Xtest.vim', 'D') |
836 new | 825 new |
837 source Xtest.vim | 826 source Xtest.vim |
838 " Trigger calling validate_cursor() | 827 " Trigger calling validate_cursor() |
839 diffsp Xtest.vim | 828 diffsp Xtest.vim |
840 quit! | 829 quit! |
841 bwipe! | 830 bwipe! |
842 call delete('Xtest.vim') | |
843 endfunc | 831 endfunc |
844 | 832 |
845 func Test_mark_from_line_zero() | 833 func Test_mark_from_line_zero() |
846 " this was reading past the end of the first (empty) line | 834 " this was reading past the end of the first (empty) line |
847 new | 835 new |
1033 " completion for short version of the :s command | 1021 " completion for short version of the :s command |
1034 call feedkeys(":sI \<C-A>\<C-B>\"\<CR>", 'xt') | 1022 call feedkeys(":sI \<C-A>\<C-B>\"\<CR>", 'xt') |
1035 call assert_equal("\"sI \<C-A>", @:) | 1023 call assert_equal("\"sI \<C-A>", @:) |
1036 | 1024 |
1037 " completion for :write command | 1025 " completion for :write command |
1038 call mkdir('Xcwdir') | 1026 call mkdir('Xcwdir', 'R') |
1039 call writefile(['one'], 'Xcwdir/Xfile1') | 1027 call writefile(['one'], 'Xcwdir/Xfile1') |
1040 let save_cwd = getcwd() | 1028 let save_cwd = getcwd() |
1041 cd Xcwdir | 1029 cd Xcwdir |
1042 call feedkeys(":w >> \<C-A>\<C-B>\"\<CR>", 'xt') | 1030 call feedkeys(":w >> \<C-A>\<C-B>\"\<CR>", 'xt') |
1043 call assert_equal("\"w >> Xfile1", @:) | 1031 call assert_equal("\"w >> Xfile1", @:) |
1044 call chdir(save_cwd) | 1032 call chdir(save_cwd) |
1045 call delete('Xcwdir', 'rf') | |
1046 | 1033 |
1047 " completion for :w ! and :r ! commands | 1034 " completion for :w ! and :r ! commands |
1048 call feedkeys(":w !invalid_xyz_cmd\<C-A>\<C-B>\"\<CR>", 'xt') | 1035 call feedkeys(":w !invalid_xyz_cmd\<C-A>\<C-B>\"\<CR>", 'xt') |
1049 call assert_equal("\"w !invalid_xyz_cmd", @:) | 1036 call assert_equal("\"w !invalid_xyz_cmd", @:) |
1050 call feedkeys(":r !invalid_xyz_cmd\<C-A>\<C-B>\"\<CR>", 'xt') | 1037 call feedkeys(":r !invalid_xyz_cmd\<C-A>\<C-B>\"\<CR>", 'xt') |
1123 " completion of autocmd group after comma | 1110 " completion of autocmd group after comma |
1124 call feedkeys(":doautocmd BufNew,BufEn\<C-A>\<C-B>\"\<CR>", 'xt') | 1111 call feedkeys(":doautocmd BufNew,BufEn\<C-A>\<C-B>\"\<CR>", 'xt') |
1125 call assert_equal("\"doautocmd BufNew,BufEnter", @:) | 1112 call assert_equal("\"doautocmd BufNew,BufEnter", @:) |
1126 | 1113 |
1127 " completion of file name in :doautocmd | 1114 " completion of file name in :doautocmd |
1128 call writefile([], 'Xvarfile1') | 1115 call writefile([], 'Xvarfile1', 'D') |
1129 call writefile([], 'Xvarfile2') | 1116 call writefile([], 'Xvarfile2', 'D') |
1130 call feedkeys(":doautocmd BufEnter Xvarfi\<C-A>\<C-B>\"\<CR>", 'xt') | 1117 call feedkeys(":doautocmd BufEnter Xvarfi\<C-A>\<C-B>\"\<CR>", 'xt') |
1131 call assert_equal("\"doautocmd BufEnter Xvarfile1 Xvarfile2", @:) | 1118 call assert_equal("\"doautocmd BufEnter Xvarfile1 Xvarfile2", @:) |
1132 call delete('Xvarfile1') | |
1133 call delete('Xvarfile2') | |
1134 | 1119 |
1135 " completion for the :augroup command | 1120 " completion for the :augroup command |
1136 augroup XTest.test | 1121 augroup XTest.test |
1137 augroup END | 1122 augroup END |
1138 call feedkeys(":augroup X\<C-A>\<C-B>\"\<CR>", 'xt') | 1123 call feedkeys(":augroup X\<C-A>\<C-B>\"\<CR>", 'xt') |
1270 endfunc | 1255 endfunc |
1271 | 1256 |
1272 " Test for 'wildignorecase' | 1257 " Test for 'wildignorecase' |
1273 func Test_cmdline_wildignorecase() | 1258 func Test_cmdline_wildignorecase() |
1274 CheckUnix | 1259 CheckUnix |
1275 call writefile([], 'XTEST') | 1260 call writefile([], 'XTEST', 'D') |
1276 set wildignorecase | 1261 set wildignorecase |
1277 call feedkeys(":e xt\<Tab>\<C-B>\"\<CR>", 'xt') | 1262 call feedkeys(":e xt\<Tab>\<C-B>\"\<CR>", 'xt') |
1278 call assert_equal('"e XTEST', @:) | 1263 call assert_equal('"e XTEST', @:) |
1279 call assert_equal(['XTEST'], getcompletion('xt', 'file')) | 1264 call assert_equal(['XTEST'], getcompletion('xt', 'file')) |
1280 let g:Sline = '' | 1265 let g:Sline = '' |
1281 call feedkeys(":e xt\<C-d>\<F4>\<C-B>\"\<CR>", 'xt') | 1266 call feedkeys(":e xt\<C-d>\<F4>\<C-B>\"\<CR>", 'xt') |
1282 call assert_equal('"e xt', @:) | 1267 call assert_equal('"e xt', @:) |
1283 call assert_equal('XTEST', g:Sline) | 1268 call assert_equal('XTEST', g:Sline) |
1284 set wildignorecase& | 1269 set wildignorecase& |
1285 call delete('XTEST') | |
1286 endfunc | 1270 endfunc |
1287 | 1271 |
1288 func Test_cmdline_write_alternatefile() | 1272 func Test_cmdline_write_alternatefile() |
1289 new | 1273 new |
1290 call setline('.', ['one', 'two']) | 1274 call setline('.', ['one', 'two']) |
1406 echomsg 'bar' | 1390 echomsg 'bar' |
1407 set verbosefile= | 1391 set verbosefile= |
1408 let log = readfile('Xlog') | 1392 let log = readfile('Xlog') |
1409 call assert_match("foo\nbar", join(log, "\n")) | 1393 call assert_match("foo\nbar", join(log, "\n")) |
1410 call delete('Xlog') | 1394 call delete('Xlog') |
1411 call mkdir('Xdir') | 1395 |
1396 call mkdir('Xdir', 'D') | |
1412 call assert_fails('set verbosefile=Xdir', ['E484:.*Xdir', 'E474:']) | 1397 call assert_fails('set verbosefile=Xdir', ['E484:.*Xdir', 'E474:']) |
1413 call delete('Xdir', 'd') | |
1414 endfunc | 1398 endfunc |
1415 | 1399 |
1416 func Test_verbose_option() | 1400 func Test_verbose_option() |
1417 CheckScreendump | 1401 CheckScreendump |
1418 | 1402 |
1419 let lines =<< trim [SCRIPT] | 1403 let lines =<< trim [SCRIPT] |
1420 command DoSomething echo 'hello' |set ts=4 |let v = '123' |echo v | 1404 command DoSomething echo 'hello' |set ts=4 |let v = '123' |echo v |
1421 call feedkeys("\r", 't') " for the hit-enter prompt | 1405 call feedkeys("\r", 't') " for the hit-enter prompt |
1422 set verbose=20 | 1406 set verbose=20 |
1423 [SCRIPT] | 1407 [SCRIPT] |
1424 call writefile(lines, 'XTest_verbose') | 1408 call writefile(lines, 'XTest_verbose', 'D') |
1425 | 1409 |
1426 let buf = RunVimInTerminal('-S XTest_verbose', {'rows': 12}) | 1410 let buf = RunVimInTerminal('-S XTest_verbose', {'rows': 12}) |
1427 call TermWait(buf, 50) | 1411 call TermWait(buf, 50) |
1428 call term_sendkeys(buf, ":DoSomething\<CR>") | 1412 call term_sendkeys(buf, ":DoSomething\<CR>") |
1429 call VerifyScreenDump(buf, 'Test_verbose_option_1', {}) | 1413 call VerifyScreenDump(buf, 'Test_verbose_option_1', {}) |
1430 | 1414 |
1431 " clean up | 1415 " clean up |
1432 call StopVimInTerminal(buf) | 1416 call StopVimInTerminal(buf) |
1433 call delete('XTest_verbose') | |
1434 endfunc | 1417 endfunc |
1435 | 1418 |
1436 func Test_setcmdpos() | 1419 func Test_setcmdpos() |
1437 func InsertTextAtPos(text, pos) | 1420 func InsertTextAtPos(text, pos) |
1438 call assert_equal(0, setcmdpos(a:pos)) | 1421 call assert_equal(0, setcmdpos(a:pos)) |
1531 | 1514 |
1532 let lines =<< trim [SCRIPT] | 1515 let lines =<< trim [SCRIPT] |
1533 call setline(1, range(30)) | 1516 call setline(1, range(30)) |
1534 [SCRIPT] | 1517 [SCRIPT] |
1535 | 1518 |
1536 call writefile(lines, 'XtestCmdlineClearTabenter') | 1519 call writefile(lines, 'XtestCmdlineClearTabenter', 'D') |
1537 let buf = RunVimInTerminal('-S XtestCmdlineClearTabenter', #{rows: 10}) | 1520 let buf = RunVimInTerminal('-S XtestCmdlineClearTabenter', #{rows: 10}) |
1538 call TermWait(buf, 25) | 1521 call TermWait(buf, 25) |
1539 " in one tab make the command line higher with CTRL-W - | 1522 " in one tab make the command line higher with CTRL-W - |
1540 call term_sendkeys(buf, ":tabnew\<cr>\<C-w>-\<C-w>-gtgt") | 1523 call term_sendkeys(buf, ":tabnew\<cr>\<C-w>-\<C-w>-gtgt") |
1541 call VerifyScreenDump(buf, 'Test_cmdlineclear_tabenter', {}) | 1524 call VerifyScreenDump(buf, 'Test_cmdlineclear_tabenter', {}) |
1542 | 1525 |
1543 call StopVimInTerminal(buf) | 1526 call StopVimInTerminal(buf) |
1544 call delete('XtestCmdlineClearTabenter') | |
1545 endfunc | 1527 endfunc |
1546 | 1528 |
1547 " Test for expanding special keywords in cmdline | 1529 " Test for expanding special keywords in cmdline |
1548 func Test_cmdline_expand_special() | 1530 func Test_cmdline_expand_special() |
1549 %bwipe! | 1531 %bwipe! |
1550 call assert_fails('e #', 'E194:') | 1532 call assert_fails('e #', 'E194:') |
1551 call assert_fails('e <afile>', 'E495:') | 1533 call assert_fails('e <afile>', 'E495:') |
1552 call assert_fails('e <abuf>', 'E496:') | 1534 call assert_fails('e <abuf>', 'E496:') |
1553 call assert_fails('e <amatch>', 'E497:') | 1535 call assert_fails('e <amatch>', 'E497:') |
1554 | 1536 |
1555 call writefile([], 'Xfile.cpp') | 1537 call writefile([], 'Xfile.cpp', 'D') |
1556 call writefile([], 'Xfile.java') | 1538 call writefile([], 'Xfile.java', 'D') |
1557 new Xfile.cpp | 1539 new Xfile.cpp |
1558 call feedkeys(":e %:r\<C-A>\<C-B>\"\<CR>", 'xt') | 1540 call feedkeys(":e %:r\<C-A>\<C-B>\"\<CR>", 'xt') |
1559 call assert_equal('"e Xfile.cpp Xfile.java', @:) | 1541 call assert_equal('"e Xfile.cpp Xfile.java', @:) |
1560 close | 1542 close |
1561 call delete('Xfile.cpp') | |
1562 call delete('Xfile.java') | |
1563 endfunc | 1543 endfunc |
1564 | 1544 |
1565 " Test for backtick expression in the command line | 1545 " Test for backtick expression in the command line |
1566 func Test_cmd_backtick() | 1546 func Test_cmd_backtick() |
1567 %argd | 1547 %argd |
1591 call assert_equal(['! echo foo!'], readfile('Xfile.out')) | 1571 call assert_equal(['! echo foo!'], readfile('Xfile.out')) |
1592 call writefile(v:errors, 'Xresult') | 1572 call writefile(v:errors, 'Xresult') |
1593 call delete('Xfile.out') | 1573 call delete('Xfile.out') |
1594 qall! | 1574 qall! |
1595 [SCRIPT] | 1575 [SCRIPT] |
1596 call writefile(lines, 'Xscript') | 1576 call writefile(lines, 'Xscript', 'D') |
1597 if RunVim([], [], '--clean -S Xscript') | 1577 if RunVim([], [], '--clean -S Xscript') |
1598 call assert_equal([], readfile('Xresult')) | 1578 call assert_equal([], readfile('Xresult')) |
1599 endif | 1579 endif |
1600 call delete('Xscript') | |
1601 call delete('Xresult') | 1580 call delete('Xresult') |
1602 endfunc | 1581 endfunc |
1603 | 1582 |
1604 " Test error: "E135: *Filter* Autocommands must not change current buffer" | 1583 " Test error: "E135: *Filter* Autocommands must not change current buffer" |
1605 func Test_cmd_bang_E135() | 1584 func Test_cmd_bang_E135() |
1617 %bwipe! | 1596 %bwipe! |
1618 endfunc | 1597 endfunc |
1619 | 1598 |
1620 " Test for using ~ for home directory in cmdline completion matches | 1599 " Test for using ~ for home directory in cmdline completion matches |
1621 func Test_cmdline_expand_home() | 1600 func Test_cmdline_expand_home() |
1622 call mkdir('Xexpdir') | 1601 call mkdir('Xexpdir', 'R') |
1623 call writefile([], 'Xexpdir/Xfile1') | 1602 call writefile([], 'Xexpdir/Xfile1') |
1624 call writefile([], 'Xexpdir/Xfile2') | 1603 call writefile([], 'Xexpdir/Xfile2') |
1625 cd Xexpdir | 1604 cd Xexpdir |
1626 let save_HOME = $HOME | 1605 let save_HOME = $HOME |
1627 let $HOME = getcwd() | 1606 let $HOME = getcwd() |
1628 call feedkeys(":e ~/\<C-A>\<C-B>\"\<CR>", 'xt') | 1607 call feedkeys(":e ~/\<C-A>\<C-B>\"\<CR>", 'xt') |
1629 call assert_equal('"e ~/Xfile1 ~/Xfile2', @:) | 1608 call assert_equal('"e ~/Xfile1 ~/Xfile2', @:) |
1630 let $HOME = save_HOME | 1609 let $HOME = save_HOME |
1631 cd .. | 1610 cd .. |
1632 call delete('Xexpdir', 'rf') | |
1633 endfunc | 1611 endfunc |
1634 | 1612 |
1635 " Test for using CTRL-\ CTRL-G in the command line to go back to normal mode | 1613 " Test for using CTRL-\ CTRL-G in the command line to go back to normal mode |
1636 " or insert mode (when 'insertmode' is set) | 1614 " or insert mode (when 'insertmode' is set) |
1637 func Test_cmdline_ctrl_g() | 1615 func Test_cmdline_ctrl_g() |
1712 set wildmenu& | 1690 set wildmenu& |
1713 | 1691 |
1714 " Test for longest file name completion with 'fileignorecase' | 1692 " Test for longest file name completion with 'fileignorecase' |
1715 " On MS-Windows, file names are case insensitive. | 1693 " On MS-Windows, file names are case insensitive. |
1716 if has('unix') | 1694 if has('unix') |
1717 call writefile([], 'XTESTfoo') | 1695 call writefile([], 'XTESTfoo', 'D') |
1718 call writefile([], 'Xtestbar') | 1696 call writefile([], 'Xtestbar', 'D') |
1719 set nofileignorecase | 1697 set nofileignorecase |
1720 call feedkeys(":e XT\<Tab>\<C-B>\"\<CR>", 'xt') | 1698 call feedkeys(":e XT\<Tab>\<C-B>\"\<CR>", 'xt') |
1721 call assert_equal('"e XTESTfoo', @:) | 1699 call assert_equal('"e XTESTfoo', @:) |
1722 call feedkeys(":e Xt\<Tab>\<C-B>\"\<CR>", 'xt') | 1700 call feedkeys(":e Xt\<Tab>\<C-B>\"\<CR>", 'xt') |
1723 call assert_equal('"e Xtestbar', @:) | 1701 call assert_equal('"e Xtestbar', @:) |
1725 call feedkeys(":e XT\<Tab>\<C-B>\"\<CR>", 'xt') | 1703 call feedkeys(":e XT\<Tab>\<C-B>\"\<CR>", 'xt') |
1726 call assert_equal('"e Xtest', @:) | 1704 call assert_equal('"e Xtest', @:) |
1727 call feedkeys(":e Xt\<Tab>\<C-B>\"\<CR>", 'xt') | 1705 call feedkeys(":e Xt\<Tab>\<C-B>\"\<CR>", 'xt') |
1728 call assert_equal('"e Xtest', @:) | 1706 call assert_equal('"e Xtest', @:) |
1729 set fileignorecase& | 1707 set fileignorecase& |
1730 call delete('XTESTfoo') | |
1731 call delete('Xtestbar') | |
1732 endif | 1708 endif |
1733 | 1709 |
1734 %argdelete | 1710 %argdelete |
1735 delcommand MyCmd | 1711 delcommand MyCmd |
1736 delfunc T | 1712 delfunc T |
1748 call Wildmode_tests() | 1724 call Wildmode_tests() |
1749 let &encoding = save_encoding | 1725 let &encoding = save_encoding |
1750 endfunc | 1726 endfunc |
1751 | 1727 |
1752 func Test_custom_complete_autoload() | 1728 func Test_custom_complete_autoload() |
1753 call mkdir('Xcustdir/autoload', 'p') | 1729 call mkdir('Xcustdir/autoload', 'pR') |
1754 let save_rtp = &rtp | 1730 let save_rtp = &rtp |
1755 exe 'set rtp=' .. getcwd() .. '/Xcustdir' | 1731 exe 'set rtp=' .. getcwd() .. '/Xcustdir' |
1756 let lines =<< trim END | 1732 let lines =<< trim END |
1757 func vim8#Complete(a, c, p) | 1733 func vim8#Complete(a, c, p) |
1758 return "oneA\noneB\noneC" | 1734 return "oneA\noneB\noneC" |
1767 call assert_equal('"MyCmd oneA oneB oneC', @:) | 1743 call assert_equal('"MyCmd oneA oneB oneC', @:) |
1768 | 1744 |
1769 let &rtp = save_rtp | 1745 let &rtp = save_rtp |
1770 set wildmode& wildmenu& | 1746 set wildmode& wildmenu& |
1771 delcommand MyCmd | 1747 delcommand MyCmd |
1772 call delete('Xcustdir', 'rf') | |
1773 endfunc | 1748 endfunc |
1774 | 1749 |
1775 " Test for interrupting the command-line completion | 1750 " Test for interrupting the command-line completion |
1776 func Test_interrupt_compl() | 1751 func Test_interrupt_compl() |
1777 func F(lead, cmdl, p) | 1752 func F(lead, cmdl, p) |
1944 | 1919 |
1945 " Test for going up and down the directory tree using 'wildmenu' | 1920 " Test for going up and down the directory tree using 'wildmenu' |
1946 func Test_wildmenu_dirstack() | 1921 func Test_wildmenu_dirstack() |
1947 CheckUnix | 1922 CheckUnix |
1948 %bw! | 1923 %bw! |
1949 call mkdir('Xwildmenu/dir2/dir3/dir4', 'p') | 1924 call mkdir('Xwildmenu/dir2/dir3/dir4', 'pR') |
1950 call writefile([], 'Xwildmenu/file1_1.txt') | 1925 call writefile([], 'Xwildmenu/file1_1.txt') |
1951 call writefile([], 'Xwildmenu/file1_2.txt') | 1926 call writefile([], 'Xwildmenu/file1_2.txt') |
1952 call writefile([], 'Xwildmenu/dir2/file2_1.txt') | 1927 call writefile([], 'Xwildmenu/dir2/file2_1.txt') |
1953 call writefile([], 'Xwildmenu/dir2/file2_2.txt') | 1928 call writefile([], 'Xwildmenu/dir2/file2_2.txt') |
1954 call writefile([], 'Xwildmenu/dir2/dir3/file3_1.txt') | 1929 call writefile([], 'Xwildmenu/dir2/dir3/file3_1.txt') |
1972 call assert_equal('"e ../../dir3/dir4/file4_1.txt', @:) | 1947 call assert_equal('"e ../../dir3/dir4/file4_1.txt', @:) |
1973 cd - | 1948 cd - |
1974 call feedkeys(":e Xwildmenu/\<Tab>\<Down>\<Down>\<Down>\<C-B>\"\<CR>", 'xt') | 1949 call feedkeys(":e Xwildmenu/\<Tab>\<Down>\<Down>\<Down>\<C-B>\"\<CR>", 'xt') |
1975 call assert_equal('"e Xwildmenu/dir2/dir3/dir4/file4_1.txt', @:) | 1950 call assert_equal('"e Xwildmenu/dir2/dir3/dir4/file4_1.txt', @:) |
1976 | 1951 |
1977 call delete('Xwildmenu', 'rf') | |
1978 set wildmenu& | 1952 set wildmenu& |
1979 endfunc | 1953 endfunc |
1980 | 1954 |
1981 " Test for recalling newer or older cmdline from history with <Up>, <Down>, | 1955 " Test for recalling newer or older cmdline from history with <Up>, <Down>, |
1982 " <S-Up>, <S-Down>, <PageUp>, <PageDown>, <kPageUp>, <kPageDown>, <C-p>, or | 1956 " <S-Up>, <S-Down>, <PageUp>, <PageDown>, <kPageUp>, <kPageDown>, <C-p>, or |
2052 augroup END | 2026 augroup END |
2053 endfunc | 2027 endfunc |
2054 | 2028 |
2055 " Test for the 'suffixes' option | 2029 " Test for the 'suffixes' option |
2056 func Test_suffixes_opt() | 2030 func Test_suffixes_opt() |
2057 call writefile([], 'Xsuffile') | 2031 call writefile([], 'Xsuffile', 'D') |
2058 call writefile([], 'Xsuffile.c') | 2032 call writefile([], 'Xsuffile.c', 'D') |
2059 call writefile([], 'Xsuffile.o') | 2033 call writefile([], 'Xsuffile.o', 'D') |
2060 set suffixes= | 2034 set suffixes= |
2061 call feedkeys(":e Xsuffi*\<C-A>\<C-B>\"\<CR>", 'xt') | 2035 call feedkeys(":e Xsuffi*\<C-A>\<C-B>\"\<CR>", 'xt') |
2062 call assert_equal('"e Xsuffile Xsuffile.c Xsuffile.o', @:) | 2036 call assert_equal('"e Xsuffile Xsuffile.c Xsuffile.o', @:) |
2063 call feedkeys(":e Xsuffi*\<Tab>\<Tab>\<C-B>\"\<CR>", 'xt') | 2037 call feedkeys(":e Xsuffi*\<Tab>\<Tab>\<C-B>\"\<CR>", 'xt') |
2064 call assert_equal('"e Xsuffile.c', @:) | 2038 call assert_equal('"e Xsuffile.c', @:) |
2074 call assert_equal('"e Xsuffile.o', @:) | 2048 call assert_equal('"e Xsuffile.o', @:) |
2075 set suffixes& | 2049 set suffixes& |
2076 " Test for getcompletion() with different patterns | 2050 " Test for getcompletion() with different patterns |
2077 call assert_equal(['Xsuffile', 'Xsuffile.c', 'Xsuffile.o'], getcompletion('Xsuffile', 'file')) | 2051 call assert_equal(['Xsuffile', 'Xsuffile.c', 'Xsuffile.o'], getcompletion('Xsuffile', 'file')) |
2078 call assert_equal(['Xsuffile'], getcompletion('Xsuffile$', 'file')) | 2052 call assert_equal(['Xsuffile'], getcompletion('Xsuffile$', 'file')) |
2079 call delete('Xsuffile') | |
2080 call delete('Xsuffile.c') | |
2081 call delete('Xsuffile.o') | |
2082 endfunc | 2053 endfunc |
2083 | 2054 |
2084 " Test for using a popup menu for the command line completion matches | 2055 " Test for using a popup menu for the command line completion matches |
2085 " (wildoptions=pum) | 2056 " (wildoptions=pum) |
2086 func Test_wildmenu_pum() | 2057 func Test_wildmenu_pum() |
2118 func DoFeedKeys() | 2089 func DoFeedKeys() |
2119 let &wildcharm = char2nr("\t") | 2090 let &wildcharm = char2nr("\t") |
2120 call feedkeys(":edit $VIMRUNTIME/\<Tab>\<Left>\<C-U>ab\<Tab>") | 2091 call feedkeys(":edit $VIMRUNTIME/\<Tab>\<Left>\<C-U>ab\<Tab>") |
2121 endfunc | 2092 endfunc |
2122 [CODE] | 2093 [CODE] |
2123 call writefile(commands, 'Xtest') | 2094 call writefile(commands, 'Xtest', 'D') |
2124 | 2095 |
2125 let buf = RunVimInTerminal('-S Xtest', #{rows: 10}) | 2096 let buf = RunVimInTerminal('-S Xtest', #{rows: 10}) |
2126 | 2097 |
2127 call term_sendkeys(buf, ":sign \<Tab>") | 2098 call term_sendkeys(buf, ":sign \<Tab>") |
2128 call VerifyScreenDump(buf, 'Test_wildmenu_pum_01', {}) | 2099 call VerifyScreenDump(buf, 'Test_wildmenu_pum_01', {}) |
2256 call VerifyScreenDump(buf, 'Test_wildmenu_pum_30', {}) | 2227 call VerifyScreenDump(buf, 'Test_wildmenu_pum_30', {}) |
2257 call term_sendkeys(buf, "s") | 2228 call term_sendkeys(buf, "s") |
2258 call VerifyScreenDump(buf, 'Test_wildmenu_pum_31', {}) | 2229 call VerifyScreenDump(buf, 'Test_wildmenu_pum_31', {}) |
2259 | 2230 |
2260 " Tests a directory name contained full-width characters. | 2231 " Tests a directory name contained full-width characters. |
2261 call mkdir('Xnamedir/あいう', 'p') | 2232 call mkdir('Xnamedir/あいう', 'pR') |
2262 call writefile([], 'Xnamedir/あいう/abc') | 2233 call writefile([], 'Xnamedir/あいう/abc') |
2263 call writefile([], 'Xnamedir/あいう/xyz') | 2234 call writefile([], 'Xnamedir/あいう/xyz') |
2264 call writefile([], 'Xnamedir/あいう/123') | 2235 call writefile([], 'Xnamedir/あいう/123') |
2265 | 2236 |
2266 call term_sendkeys(buf, "\<C-U>set wildmode&\<CR>") | 2237 call term_sendkeys(buf, "\<C-U>set wildmode&\<CR>") |
2344 call term_sendkeys(buf, "\<PageUp>") | 2315 call term_sendkeys(buf, "\<PageUp>") |
2345 call VerifyScreenDump(buf, 'Test_wildmenu_pum_50', {}) | 2316 call VerifyScreenDump(buf, 'Test_wildmenu_pum_50', {}) |
2346 | 2317 |
2347 call term_sendkeys(buf, "\<C-U>\<CR>") | 2318 call term_sendkeys(buf, "\<C-U>\<CR>") |
2348 call StopVimInTerminal(buf) | 2319 call StopVimInTerminal(buf) |
2349 call delete('Xtest') | |
2350 call delete('Xnamedir', 'rf') | |
2351 endfunc | 2320 endfunc |
2352 | 2321 |
2353 " Test for wildmenumode() with the cmdline popup menu | 2322 " Test for wildmenumode() with the cmdline popup menu |
2354 func Test_wildmenumode_with_pum() | 2323 func Test_wildmenumode_with_pum() |
2355 set wildmenu | 2324 set wildmenu |
2376 return 'foo' | 2345 return 'foo' |
2377 endfunc | 2346 endfunc |
2378 set foldtext=MyFoldText() wildoptions=pum | 2347 set foldtext=MyFoldText() wildoptions=pum |
2379 normal ggzfj | 2348 normal ggzfj |
2380 END | 2349 END |
2381 call writefile(lines, 'Xpumfold') | 2350 call writefile(lines, 'Xpumfold', 'D') |
2382 let buf = RunVimInTerminal('-S Xpumfold', #{rows: 10}) | 2351 let buf = RunVimInTerminal('-S Xpumfold', #{rows: 10}) |
2383 call term_sendkeys(buf, ":set\<Tab>") | 2352 call term_sendkeys(buf, ":set\<Tab>") |
2384 call VerifyScreenDump(buf, 'Test_wildmenu_with_pum_foldexpr_1', {}) | 2353 call VerifyScreenDump(buf, 'Test_wildmenu_with_pum_foldexpr_1', {}) |
2385 | 2354 |
2386 call term_sendkeys(buf, "\<Esc>") | 2355 call term_sendkeys(buf, "\<Esc>") |
2387 call VerifyScreenDump(buf, 'Test_wildmenu_with_pum_foldexpr_2', {}) | 2356 call VerifyScreenDump(buf, 'Test_wildmenu_with_pum_foldexpr_2', {}) |
2388 | 2357 |
2389 call StopVimInTerminal(buf) | 2358 call StopVimInTerminal(buf) |
2390 call delete('Xpumfold') | |
2391 endfunc | 2359 endfunc |
2392 | 2360 |
2393 " Test for opening the cmdline completion popup menu from the terminal window. | 2361 " Test for opening the cmdline completion popup menu from the terminal window. |
2394 " The popup menu should be positioned correctly over the status line of the | 2362 " The popup menu should be positioned correctly over the status line of the |
2395 " bottom-most window. | 2363 " bottom-most window. |
2400 | 2368 |
2401 %bw! | 2369 %bw! |
2402 let cmds = ['set wildmenu wildoptions=pum'] | 2370 let cmds = ['set wildmenu wildoptions=pum'] |
2403 let pcmd = python .. ' -c "import sys; sys.stdout.write(sys.stdin.read())"' | 2371 let pcmd = python .. ' -c "import sys; sys.stdout.write(sys.stdin.read())"' |
2404 call add(cmds, "call term_start('" .. pcmd .. "')") | 2372 call add(cmds, "call term_start('" .. pcmd .. "')") |
2405 call writefile(cmds, 'Xtest') | 2373 call writefile(cmds, 'Xtest', 'D') |
2406 let buf = RunVimInTerminal('-S Xtest', #{rows: 10}) | 2374 let buf = RunVimInTerminal('-S Xtest', #{rows: 10}) |
2407 call term_sendkeys(buf, "\r\r\r") | 2375 call term_sendkeys(buf, "\r\r\r") |
2408 call term_wait(buf) | 2376 call term_wait(buf) |
2409 call term_sendkeys(buf, "\<C-W>:sign \<Tab>") | 2377 call term_sendkeys(buf, "\<C-W>:sign \<Tab>") |
2410 call term_wait(buf) | 2378 call term_wait(buf) |
2411 call VerifyScreenDump(buf, 'Test_wildmenu_pum_term_01', {}) | 2379 call VerifyScreenDump(buf, 'Test_wildmenu_pum_term_01', {}) |
2412 call term_wait(buf) | 2380 call term_wait(buf) |
2413 call StopVimInTerminal(buf) | 2381 call StopVimInTerminal(buf) |
2414 call delete('Xtest') | |
2415 endfunc | 2382 endfunc |
2416 | 2383 |
2417 " Test for completion after a :substitute command followed by a pipe (|) | 2384 " Test for completion after a :substitute command followed by a pipe (|) |
2418 " character | 2385 " character |
2419 func Test_cmdline_complete_substitute() | 2386 func Test_cmdline_complete_substitute() |
2509 | 2476 |
2510 " buffer name (full path) fuzzy completion | 2477 " buffer name (full path) fuzzy completion |
2511 func Test_fuzzy_completion_bufname_fullpath() | 2478 func Test_fuzzy_completion_bufname_fullpath() |
2512 CheckUnix | 2479 CheckUnix |
2513 set wildoptions& | 2480 set wildoptions& |
2514 call mkdir('Xcmd/Xstate/Xfile.js', 'p') | 2481 call mkdir('Xcmd/Xstate/Xfile.js', 'pR') |
2515 edit Xcmd/Xstate/Xfile.js | 2482 edit Xcmd/Xstate/Xfile.js |
2516 cd Xcmd/Xstate | 2483 cd Xcmd/Xstate |
2517 enew | 2484 enew |
2518 call feedkeys(":b CmdStateFile\<Tab>\<C-B>\"\<CR>", 'tx') | 2485 call feedkeys(":b CmdStateFile\<Tab>\<C-B>\"\<CR>", 'tx') |
2519 call assert_equal('"b CmdStateFile', @:) | 2486 call assert_equal('"b CmdStateFile', @:) |
2520 set wildoptions=fuzzy | 2487 set wildoptions=fuzzy |
2521 call feedkeys(":b CmdStateFile\<Tab>\<C-B>\"\<CR>", 'tx') | 2488 call feedkeys(":b CmdStateFile\<Tab>\<C-B>\"\<CR>", 'tx') |
2522 call assert_match('Xcmd/Xstate/Xfile.js$', @:) | 2489 call assert_match('Xcmd/Xstate/Xfile.js$', @:) |
2523 cd - | 2490 cd - |
2524 call delete('Xcmd', 'rf') | |
2525 set wildoptions& | 2491 set wildoptions& |
2526 endfunc | 2492 endfunc |
2527 | 2493 |
2528 " :behave suboptions fuzzy completion | 2494 " :behave suboptions fuzzy completion |
2529 func Test_fuzzy_completion_behave() | 2495 func Test_fuzzy_completion_behave() |
3026 call assert_equal(['expr', 'file', 'func', 'here'], getcompletion('', 'breakpoint')) | 2992 call assert_equal(['expr', 'file', 'func', 'here'], getcompletion('', 'breakpoint')) |
3027 let l = getcompletion('not', 'breakpoint') | 2993 let l = getcompletion('not', 'breakpoint') |
3028 call assert_equal([], l) | 2994 call assert_equal([], l) |
3029 | 2995 |
3030 " Test for :breakadd file [lnum] <file> | 2996 " Test for :breakadd file [lnum] <file> |
3031 call writefile([], 'Xscript') | 2997 call writefile([], 'Xscript', 'D') |
3032 call feedkeys(":breakadd file Xsc\<Tab>\<C-B>\"\<CR>", 'tx') | 2998 call feedkeys(":breakadd file Xsc\<Tab>\<C-B>\"\<CR>", 'tx') |
3033 call assert_equal("\"breakadd file Xscript", @:) | 2999 call assert_equal("\"breakadd file Xscript", @:) |
3034 call feedkeys(":breakadd file Xsc\<Tab>\<C-B>\"\<CR>", 'tx') | 3000 call feedkeys(":breakadd file Xsc\<Tab>\<C-B>\"\<CR>", 'tx') |
3035 call assert_equal("\"breakadd file Xscript", @:) | 3001 call assert_equal("\"breakadd file Xscript", @:) |
3036 call feedkeys(":breakadd file 20 Xsc\<Tab>\<C-B>\"\<CR>", 'tx') | 3002 call feedkeys(":breakadd file 20 Xsc\<Tab>\<C-B>\"\<CR>", 'tx') |
3045 call assert_equal("\"breakadd file 20x\t", @:) | 3011 call assert_equal("\"breakadd file 20x\t", @:) |
3046 call feedkeys(":breakadd file Xscript \<Tab>\<C-B>\"\<CR>", 'tx') | 3012 call feedkeys(":breakadd file Xscript \<Tab>\<C-B>\"\<CR>", 'tx') |
3047 call assert_equal("\"breakadd file Xscript ", @:) | 3013 call assert_equal("\"breakadd file Xscript ", @:) |
3048 call feedkeys(":breakadd file X1B2C3\<Tab>\<C-B>\"\<CR>", 'tx') | 3014 call feedkeys(":breakadd file X1B2C3\<Tab>\<C-B>\"\<CR>", 'tx') |
3049 call assert_equal("\"breakadd file X1B2C3", @:) | 3015 call assert_equal("\"breakadd file X1B2C3", @:) |
3050 call delete('Xscript') | |
3051 | 3016 |
3052 " Test for :breakadd func [lnum] <function> | 3017 " Test for :breakadd func [lnum] <function> |
3053 func Xbreak_func() | 3018 func Xbreak_func() |
3054 endfunc | 3019 endfunc |
3055 call feedkeys(":breakadd func Xbr\<Tab>\<C-B>\"\<CR>", 'tx') | 3020 call feedkeys(":breakadd func Xbr\<Tab>\<C-B>\"\<CR>", 'tx') |
3107 call assert_equal("\"breakdel here", @:) | 3072 call assert_equal("\"breakdel here", @:) |
3108 call feedkeys(":breakdel abc\<Tab>\<C-B>\"\<CR>", 'tx') | 3073 call feedkeys(":breakdel abc\<Tab>\<C-B>\"\<CR>", 'tx') |
3109 call assert_equal("\"breakdel abc", @:) | 3074 call assert_equal("\"breakdel abc", @:) |
3110 | 3075 |
3111 " Test for :breakdel file [lnum] <file> | 3076 " Test for :breakdel file [lnum] <file> |
3112 call writefile([], 'Xscript') | 3077 call writefile([], 'Xscript', 'D') |
3113 call feedkeys(":breakdel file Xsc\<Tab>\<C-B>\"\<CR>", 'tx') | 3078 call feedkeys(":breakdel file Xsc\<Tab>\<C-B>\"\<CR>", 'tx') |
3114 call assert_equal("\"breakdel file Xscript", @:) | 3079 call assert_equal("\"breakdel file Xscript", @:) |
3115 call feedkeys(":breakdel file Xsc\<Tab>\<C-B>\"\<CR>", 'tx') | 3080 call feedkeys(":breakdel file Xsc\<Tab>\<C-B>\"\<CR>", 'tx') |
3116 call assert_equal("\"breakdel file Xscript", @:) | 3081 call assert_equal("\"breakdel file Xscript", @:) |
3117 call feedkeys(":breakdel file 20 Xsc\<Tab>\<C-B>\"\<CR>", 'tx') | 3082 call feedkeys(":breakdel file 20 Xsc\<Tab>\<C-B>\"\<CR>", 'tx') |
3126 call assert_equal("\"breakdel file 20x\t", @:) | 3091 call assert_equal("\"breakdel file 20x\t", @:) |
3127 call feedkeys(":breakdel file Xscript \<Tab>\<C-B>\"\<CR>", 'tx') | 3092 call feedkeys(":breakdel file Xscript \<Tab>\<C-B>\"\<CR>", 'tx') |
3128 call assert_equal("\"breakdel file Xscript ", @:) | 3093 call assert_equal("\"breakdel file Xscript ", @:) |
3129 call feedkeys(":breakdel file X1B2C3\<Tab>\<C-B>\"\<CR>", 'tx') | 3094 call feedkeys(":breakdel file X1B2C3\<Tab>\<C-B>\"\<CR>", 'tx') |
3130 call assert_equal("\"breakdel file X1B2C3", @:) | 3095 call assert_equal("\"breakdel file X1B2C3", @:) |
3131 call delete('Xscript') | |
3132 | 3096 |
3133 " Test for :breakdel func [lnum] <function> | 3097 " Test for :breakdel func [lnum] <function> |
3134 func Xbreak_func() | 3098 func Xbreak_func() |
3135 endfunc | 3099 endfunc |
3136 call feedkeys(":breakdel func Xbr\<Tab>\<C-B>\"\<CR>", 'tx') | 3100 call feedkeys(":breakdel func Xbr\<Tab>\<C-B>\"\<CR>", 'tx') |
3163 endfunc | 3127 endfunc |
3164 | 3128 |
3165 " Test for :scriptnames argument completion | 3129 " Test for :scriptnames argument completion |
3166 func Test_cmdline_complete_scriptnames() | 3130 func Test_cmdline_complete_scriptnames() |
3167 set wildmenu | 3131 set wildmenu |
3168 call writefile(['let a = 1'], 'Xa1b2c3.vim') | 3132 call writefile(['let a = 1'], 'Xa1b2c3.vim', 'D') |
3169 source Xa1b2c3.vim | 3133 source Xa1b2c3.vim |
3170 call feedkeys(":script \<Tab>\<Left>\<Left>\<C-B>\"\<CR>", 'tx') | 3134 call feedkeys(":script \<Tab>\<Left>\<Left>\<C-B>\"\<CR>", 'tx') |
3171 call assert_match("\"script .*Xa1b2c3.vim$", @:) | 3135 call assert_match("\"script .*Xa1b2c3.vim$", @:) |
3172 call feedkeys(":script \<Tab>\<Left>\<Left>\<C-B>\"\<CR>", 'tx') | 3136 call feedkeys(":script \<Tab>\<Left>\<Left>\<C-B>\"\<CR>", 'tx') |
3173 call assert_match("\"script .*Xa1b2c3.vim$", @:) | 3137 call assert_match("\"script .*Xa1b2c3.vim$", @:) |
3183 call assert_equal([], getcompletion('Xa1b2', 'scriptnames')) | 3147 call assert_equal([], getcompletion('Xa1b2', 'scriptnames')) |
3184 new | 3148 new |
3185 call feedkeys(":script \<Tab>\<Left>\<Left>\<CR>", 'tx') | 3149 call feedkeys(":script \<Tab>\<Left>\<Left>\<CR>", 'tx') |
3186 call assert_equal('Xa1b2c3.vim', fnamemodify(@%, ':t')) | 3150 call assert_equal('Xa1b2c3.vim', fnamemodify(@%, ':t')) |
3187 bw! | 3151 bw! |
3188 call delete('Xa1b2c3.vim') | |
3189 set wildmenu& | 3152 set wildmenu& |
3190 endfunc | 3153 endfunc |
3191 | 3154 |
3192 " this was going over the end of IObuff | 3155 " this was going over the end of IObuff |
3193 func Test_report_error_with_composing() | 3156 func Test_report_error_with_composing() |
3257 | 3220 |
3258 let lines =<< trim END | 3221 let lines =<< trim END |
3259 set showtabline=2 | 3222 set showtabline=2 |
3260 autocmd CmdlineEnter * set tabline=foo | 3223 autocmd CmdlineEnter * set tabline=foo |
3261 END | 3224 END |
3262 call writefile(lines, 'Xcmdline_redraw_tabline') | 3225 call writefile(lines, 'Xcmdline_redraw_tabline', 'D') |
3263 let buf = RunVimInTerminal('-S Xcmdline_redraw_tabline', #{rows: 6}) | 3226 let buf = RunVimInTerminal('-S Xcmdline_redraw_tabline', #{rows: 6}) |
3264 call term_sendkeys(buf, ':') | 3227 call term_sendkeys(buf, ':') |
3265 call WaitForAssert({-> assert_match('^foo', term_getline(buf, 1))}) | 3228 call WaitForAssert({-> assert_match('^foo', term_getline(buf, 1))}) |
3266 | 3229 |
3267 call StopVimInTerminal(buf) | 3230 call StopVimInTerminal(buf) |
3268 call delete('Xcmdline_redraw_tabline') | |
3269 endfunc | 3231 endfunc |
3270 | 3232 |
3271 func Test_wildmenu_pum_disable_while_shown() | 3233 func Test_wildmenu_pum_disable_while_shown() |
3272 set wildoptions=pum | 3234 set wildoptions=pum |
3273 set wildmenu | 3235 set wildmenu |