Mercurial > vim
comparison src/testdir/test_cmdline.vim @ 29997:98f5a0618a77 v9.0.0336
patch 9.0.0336: tests are flaky because of using a common file name
Commit: https://github.com/vim/vim/commit/61abe7d8f827ec31f098e8abcdf58846b956ef16
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Aug 30 21:46:08 2022 +0100
patch 9.0.0336: tests are flaky because of using a common file name
Problem: Tests are flaky because of using a common file name.
Solution: Rename files and directories to be more unique.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 30 Aug 2022 23:00:05 +0200 |
parents | d891115c0aea |
children | 578e71f924fe |
comparison
equal
deleted
inserted
replaced
29996:e37754a13778 | 29997:98f5a0618a77 |
---|---|
1033 " completion for short version of the :s command | 1033 " completion for short version of the :s command |
1034 call feedkeys(":sI \<C-A>\<C-B>\"\<CR>", 'xt') | 1034 call feedkeys(":sI \<C-A>\<C-B>\"\<CR>", 'xt') |
1035 call assert_equal("\"sI \<C-A>", @:) | 1035 call assert_equal("\"sI \<C-A>", @:) |
1036 | 1036 |
1037 " completion for :write command | 1037 " completion for :write command |
1038 call mkdir('Xdir') | 1038 call mkdir('Xcwdir') |
1039 call writefile(['one'], 'Xdir/Xfile1') | 1039 call writefile(['one'], 'Xcwdir/Xfile1') |
1040 let save_cwd = getcwd() | 1040 let save_cwd = getcwd() |
1041 cd Xdir | 1041 cd Xcwdir |
1042 call feedkeys(":w >> \<C-A>\<C-B>\"\<CR>", 'xt') | 1042 call feedkeys(":w >> \<C-A>\<C-B>\"\<CR>", 'xt') |
1043 call assert_equal("\"w >> Xfile1", @:) | 1043 call assert_equal("\"w >> Xfile1", @:) |
1044 call chdir(save_cwd) | 1044 call chdir(save_cwd) |
1045 call delete('Xdir', 'rf') | 1045 call delete('Xcwdir', 'rf') |
1046 | 1046 |
1047 " completion for :w ! and :r ! commands | 1047 " completion for :w ! and :r ! commands |
1048 call feedkeys(":w !invalid_xyz_cmd\<C-A>\<C-B>\"\<CR>", 'xt') | 1048 call feedkeys(":w !invalid_xyz_cmd\<C-A>\<C-B>\"\<CR>", 'xt') |
1049 call assert_equal("\"w !invalid_xyz_cmd", @:) | 1049 call assert_equal("\"w !invalid_xyz_cmd", @:) |
1050 call feedkeys(":r !invalid_xyz_cmd\<C-A>\<C-B>\"\<CR>", 'xt') | 1050 call feedkeys(":r !invalid_xyz_cmd\<C-A>\<C-B>\"\<CR>", 'xt') |
1119 " completion of autocmd group after comma | 1119 " completion of autocmd group after comma |
1120 call feedkeys(":doautocmd BufNew,BufEn\<C-A>\<C-B>\"\<CR>", 'xt') | 1120 call feedkeys(":doautocmd BufNew,BufEn\<C-A>\<C-B>\"\<CR>", 'xt') |
1121 call assert_equal("\"doautocmd BufNew,BufEnter", @:) | 1121 call assert_equal("\"doautocmd BufNew,BufEnter", @:) |
1122 | 1122 |
1123 " completion of file name in :doautocmd | 1123 " completion of file name in :doautocmd |
1124 call writefile([], 'Xfile1') | 1124 call writefile([], 'Xvarfile1') |
1125 call writefile([], 'Xfile2') | 1125 call writefile([], 'Xvarfile2') |
1126 call feedkeys(":doautocmd BufEnter Xfi\<C-A>\<C-B>\"\<CR>", 'xt') | 1126 call feedkeys(":doautocmd BufEnter Xvarfi\<C-A>\<C-B>\"\<CR>", 'xt') |
1127 call assert_equal("\"doautocmd BufEnter Xfile1 Xfile2", @:) | 1127 call assert_equal("\"doautocmd BufEnter Xvarfile1 Xvarfile2", @:) |
1128 call delete('Xfile1') | 1128 call delete('Xvarfile1') |
1129 call delete('Xfile2') | 1129 call delete('Xvarfile2') |
1130 | 1130 |
1131 " completion for the :augroup command | 1131 " completion for the :augroup command |
1132 augroup XTest.test | 1132 augroup XTest.test |
1133 augroup END | 1133 augroup END |
1134 call feedkeys(":augroup X\<C-A>\<C-B>\"\<CR>", 'xt') | 1134 call feedkeys(":augroup X\<C-A>\<C-B>\"\<CR>", 'xt') |
1601 %bwipe! | 1601 %bwipe! |
1602 endfunc | 1602 endfunc |
1603 | 1603 |
1604 " Test for using ~ for home directory in cmdline completion matches | 1604 " Test for using ~ for home directory in cmdline completion matches |
1605 func Test_cmdline_expand_home() | 1605 func Test_cmdline_expand_home() |
1606 call mkdir('Xdir') | 1606 call mkdir('Xexpdir') |
1607 call writefile([], 'Xdir/Xfile1') | 1607 call writefile([], 'Xexpdir/Xfile1') |
1608 call writefile([], 'Xdir/Xfile2') | 1608 call writefile([], 'Xexpdir/Xfile2') |
1609 cd Xdir | 1609 cd Xexpdir |
1610 let save_HOME = $HOME | 1610 let save_HOME = $HOME |
1611 let $HOME = getcwd() | 1611 let $HOME = getcwd() |
1612 call feedkeys(":e ~/\<C-A>\<C-B>\"\<CR>", 'xt') | 1612 call feedkeys(":e ~/\<C-A>\<C-B>\"\<CR>", 'xt') |
1613 call assert_equal('"e ~/Xfile1 ~/Xfile2', @:) | 1613 call assert_equal('"e ~/Xfile1 ~/Xfile2', @:) |
1614 let $HOME = save_HOME | 1614 let $HOME = save_HOME |
1615 cd .. | 1615 cd .. |
1616 call delete('Xdir', 'rf') | 1616 call delete('Xexpdir', 'rf') |
1617 endfunc | 1617 endfunc |
1618 | 1618 |
1619 " Test for using CTRL-\ CTRL-G in the command line to go back to normal mode | 1619 " Test for using CTRL-\ CTRL-G in the command line to go back to normal mode |
1620 " or insert mode (when 'insertmode' is set) | 1620 " or insert mode (when 'insertmode' is set) |
1621 func Test_cmdline_ctrl_g() | 1621 func Test_cmdline_ctrl_g() |
1732 call Wildmode_tests() | 1732 call Wildmode_tests() |
1733 let &encoding = save_encoding | 1733 let &encoding = save_encoding |
1734 endfunc | 1734 endfunc |
1735 | 1735 |
1736 func Test_custom_complete_autoload() | 1736 func Test_custom_complete_autoload() |
1737 call mkdir('Xdir/autoload', 'p') | 1737 call mkdir('Xcustdir/autoload', 'p') |
1738 let save_rtp = &rtp | 1738 let save_rtp = &rtp |
1739 exe 'set rtp=' .. getcwd() .. '/Xdir' | 1739 exe 'set rtp=' .. getcwd() .. '/Xcustdir' |
1740 let lines =<< trim END | 1740 let lines =<< trim END |
1741 func vim8#Complete(a, c, p) | 1741 func vim8#Complete(a, c, p) |
1742 return "oneA\noneB\noneC" | 1742 return "oneA\noneB\noneC" |
1743 endfunc | 1743 endfunc |
1744 END | 1744 END |
1745 call writefile(lines, 'Xdir/autoload/vim8.vim') | 1745 call writefile(lines, 'Xcustdir/autoload/vim8.vim') |
1746 | 1746 |
1747 command -nargs=1 -complete=custom,vim8#Complete MyCmd | 1747 command -nargs=1 -complete=custom,vim8#Complete MyCmd |
1748 set nowildmenu | 1748 set nowildmenu |
1749 set wildmode=full,list | 1749 set wildmode=full,list |
1750 call feedkeys(":MyCmd \<C-A>\<C-B>\"\<CR>", 'xt') | 1750 call feedkeys(":MyCmd \<C-A>\<C-B>\"\<CR>", 'xt') |
1751 call assert_equal('"MyCmd oneA oneB oneC', @:) | 1751 call assert_equal('"MyCmd oneA oneB oneC', @:) |
1752 | 1752 |
1753 let &rtp = save_rtp | 1753 let &rtp = save_rtp |
1754 set wildmode& wildmenu& | 1754 set wildmode& wildmenu& |
1755 delcommand MyCmd | 1755 delcommand MyCmd |
1756 call delete('Xdir', 'rf') | 1756 call delete('Xcustdir', 'rf') |
1757 endfunc | 1757 endfunc |
1758 | 1758 |
1759 " Test for interrupting the command-line completion | 1759 " Test for interrupting the command-line completion |
1760 func Test_interrupt_compl() | 1760 func Test_interrupt_compl() |
1761 func F(lead, cmdl, p) | 1761 func F(lead, cmdl, p) |
2036 augroup END | 2036 augroup END |
2037 endfunc | 2037 endfunc |
2038 | 2038 |
2039 " Test for the 'suffixes' option | 2039 " Test for the 'suffixes' option |
2040 func Test_suffixes_opt() | 2040 func Test_suffixes_opt() |
2041 call writefile([], 'Xfile') | 2041 call writefile([], 'Xsuffile') |
2042 call writefile([], 'Xfile.c') | 2042 call writefile([], 'Xsuffile.c') |
2043 call writefile([], 'Xfile.o') | 2043 call writefile([], 'Xsuffile.o') |
2044 set suffixes= | 2044 set suffixes= |
2045 call feedkeys(":e Xfi*\<C-A>\<C-B>\"\<CR>", 'xt') | 2045 call feedkeys(":e Xsuffi*\<C-A>\<C-B>\"\<CR>", 'xt') |
2046 call assert_equal('"e Xfile Xfile.c Xfile.o', @:) | 2046 call assert_equal('"e Xsuffile Xsuffile.c Xsuffile.o', @:) |
2047 call feedkeys(":e Xfi*\<Tab>\<Tab>\<C-B>\"\<CR>", 'xt') | 2047 call feedkeys(":e Xsuffi*\<Tab>\<Tab>\<C-B>\"\<CR>", 'xt') |
2048 call assert_equal('"e Xfile.c', @:) | 2048 call assert_equal('"e Xsuffile.c', @:) |
2049 set suffixes=.c | 2049 set suffixes=.c |
2050 call feedkeys(":e Xfi*\<C-A>\<C-B>\"\<CR>", 'xt') | 2050 call feedkeys(":e Xsuffi*\<C-A>\<C-B>\"\<CR>", 'xt') |
2051 call assert_equal('"e Xfile Xfile.o Xfile.c', @:) | 2051 call assert_equal('"e Xsuffile Xsuffile.o Xsuffile.c', @:) |
2052 call feedkeys(":e Xfi*\<Tab>\<Tab>\<C-B>\"\<CR>", 'xt') | 2052 call feedkeys(":e Xsuffi*\<Tab>\<Tab>\<C-B>\"\<CR>", 'xt') |
2053 call assert_equal('"e Xfile.o', @:) | 2053 call assert_equal('"e Xsuffile.o', @:) |
2054 set suffixes=,, | 2054 set suffixes=,, |
2055 call feedkeys(":e Xfi*\<C-A>\<C-B>\"\<CR>", 'xt') | 2055 call feedkeys(":e Xsuffi*\<C-A>\<C-B>\"\<CR>", 'xt') |
2056 call assert_equal('"e Xfile.c Xfile.o Xfile', @:) | 2056 call assert_equal('"e Xsuffile.c Xsuffile.o Xsuffile', @:) |
2057 call feedkeys(":e Xfi*\<Tab>\<Tab>\<C-B>\"\<CR>", 'xt') | 2057 call feedkeys(":e Xsuffi*\<Tab>\<Tab>\<C-B>\"\<CR>", 'xt') |
2058 call assert_equal('"e Xfile.o', @:) | 2058 call assert_equal('"e Xsuffile.o', @:) |
2059 set suffixes& | 2059 set suffixes& |
2060 " Test for getcompletion() with different patterns | 2060 " Test for getcompletion() with different patterns |
2061 call assert_equal(['Xfile', 'Xfile.c', 'Xfile.o'], getcompletion('Xfile', 'file')) | 2061 call assert_equal(['Xsuffile', 'Xsuffile.c', 'Xsuffile.o'], getcompletion('Xsuffile', 'file')) |
2062 call assert_equal(['Xfile'], getcompletion('Xfile$', 'file')) | 2062 call assert_equal(['Xsuffile'], getcompletion('Xsuffile$', 'file')) |
2063 call delete('Xfile') | 2063 call delete('Xsuffile') |
2064 call delete('Xfile.c') | 2064 call delete('Xsuffile.c') |
2065 call delete('Xfile.o') | 2065 call delete('Xsuffile.o') |
2066 endfunc | 2066 endfunc |
2067 | 2067 |
2068 " Test for using a popup menu for the command line completion matches | 2068 " Test for using a popup menu for the command line completion matches |
2069 " (wildoptions=pum) | 2069 " (wildoptions=pum) |
2070 func Test_wildmenu_pum() | 2070 func Test_wildmenu_pum() |
2160 | 2160 |
2161 call term_sendkeys(buf, " \<Tab>") | 2161 call term_sendkeys(buf, " \<Tab>") |
2162 call VerifyScreenDump(buf, 'Test_wildmenu_pum_13', {}) | 2162 call VerifyScreenDump(buf, 'Test_wildmenu_pum_13', {}) |
2163 | 2163 |
2164 " Directory name completion | 2164 " Directory name completion |
2165 call mkdir('Xdir/XdirA/XdirB', 'p') | 2165 call mkdir('Xnamedir/XdirA/XdirB', 'p') |
2166 call writefile([], 'Xdir/XfileA') | 2166 call writefile([], 'Xnamedir/XfileA') |
2167 call writefile([], 'Xdir/XdirA/XfileB') | 2167 call writefile([], 'Xnamedir/XdirA/XfileB') |
2168 call writefile([], 'Xdir/XdirA/XdirB/XfileC') | 2168 call writefile([], 'Xnamedir/XdirA/XdirB/XfileC') |
2169 | 2169 |
2170 call term_sendkeys(buf, "\<C-U>e Xdi\<Tab>\<Tab>") | 2170 call term_sendkeys(buf, "\<C-U>e Xnamedi\<Tab>\<Tab>") |
2171 call VerifyScreenDump(buf, 'Test_wildmenu_pum_14', {}) | 2171 call VerifyScreenDump(buf, 'Test_wildmenu_pum_14', {}) |
2172 | 2172 |
2173 " Pressing <Right> on a directory name should go into that directory | 2173 " Pressing <Right> on a directory name should go into that directory |
2174 call term_sendkeys(buf, "\<Right>") | 2174 call term_sendkeys(buf, "\<Right>") |
2175 call VerifyScreenDump(buf, 'Test_wildmenu_pum_15', {}) | 2175 call VerifyScreenDump(buf, 'Test_wildmenu_pum_15', {}) |
2240 call VerifyScreenDump(buf, 'Test_wildmenu_pum_30', {}) | 2240 call VerifyScreenDump(buf, 'Test_wildmenu_pum_30', {}) |
2241 call term_sendkeys(buf, "s") | 2241 call term_sendkeys(buf, "s") |
2242 call VerifyScreenDump(buf, 'Test_wildmenu_pum_31', {}) | 2242 call VerifyScreenDump(buf, 'Test_wildmenu_pum_31', {}) |
2243 | 2243 |
2244 " Tests a directory name contained full-width characters. | 2244 " Tests a directory name contained full-width characters. |
2245 call mkdir('Xdir/あいう', 'p') | 2245 call mkdir('Xnamedir/あいう', 'p') |
2246 call writefile([], 'Xdir/あいう/abc') | 2246 call writefile([], 'Xnamedir/あいう/abc') |
2247 call writefile([], 'Xdir/あいう/xyz') | 2247 call writefile([], 'Xnamedir/あいう/xyz') |
2248 call writefile([], 'Xdir/あいう/123') | 2248 call writefile([], 'Xnamedir/あいう/123') |
2249 | 2249 |
2250 call term_sendkeys(buf, "\<C-U>set wildmode&\<CR>") | 2250 call term_sendkeys(buf, "\<C-U>set wildmode&\<CR>") |
2251 call term_sendkeys(buf, ":\<C-U>e Xdir/あいう/\<Tab>") | 2251 call term_sendkeys(buf, ":\<C-U>e Xnamedir/あいう/\<Tab>") |
2252 call VerifyScreenDump(buf, 'Test_wildmenu_pum_32', {}) | 2252 call VerifyScreenDump(buf, 'Test_wildmenu_pum_32', {}) |
2253 | 2253 |
2254 " Pressing <C-A> when the popup menu is displayed should list all the | 2254 " Pressing <C-A> when the popup menu is displayed should list all the |
2255 " matches and pressing a key after that should remove the popup menu | 2255 " matches and pressing a key after that should remove the popup menu |
2256 call term_sendkeys(buf, "\<C-U>set wildmode=full\<CR>") | 2256 call term_sendkeys(buf, "\<C-U>set wildmode=full\<CR>") |
2268 call term_sendkeys(buf, "\<End>\<C-U>Tcmd \<Tab>\<C-A>\<Left>\<Left>") | 2268 call term_sendkeys(buf, "\<End>\<C-U>Tcmd \<Tab>\<C-A>\<Left>\<Left>") |
2269 call VerifyScreenDump(buf, 'Test_wildmenu_pum_35', {}) | 2269 call VerifyScreenDump(buf, 'Test_wildmenu_pum_35', {}) |
2270 | 2270 |
2271 " After using <C-A> to expand all the filename matches, pressing <Up> | 2271 " After using <C-A> to expand all the filename matches, pressing <Up> |
2272 " should not open the popup menu again. | 2272 " should not open the popup menu again. |
2273 call term_sendkeys(buf, "\<C-E>\<C-U>:cd Xdir/XdirA\<CR>") | 2273 call term_sendkeys(buf, "\<C-E>\<C-U>:cd Xnamedir/XdirA\<CR>") |
2274 call term_sendkeys(buf, ":e \<Tab>\<C-A>\<Up>") | 2274 call term_sendkeys(buf, ":e \<Tab>\<C-A>\<Up>") |
2275 call VerifyScreenDump(buf, 'Test_wildmenu_pum_36', {}) | 2275 call VerifyScreenDump(buf, 'Test_wildmenu_pum_36', {}) |
2276 call term_sendkeys(buf, "\<C-E>\<C-U>:cd -\<CR>") | 2276 call term_sendkeys(buf, "\<C-E>\<C-U>:cd -\<CR>") |
2277 | 2277 |
2278 " After using <C-A> to expand all the matches, pressing <S-Tab> used to | 2278 " After using <C-A> to expand all the matches, pressing <S-Tab> used to |
2329 call VerifyScreenDump(buf, 'Test_wildmenu_pum_50', {}) | 2329 call VerifyScreenDump(buf, 'Test_wildmenu_pum_50', {}) |
2330 | 2330 |
2331 call term_sendkeys(buf, "\<C-U>\<CR>") | 2331 call term_sendkeys(buf, "\<C-U>\<CR>") |
2332 call StopVimInTerminal(buf) | 2332 call StopVimInTerminal(buf) |
2333 call delete('Xtest') | 2333 call delete('Xtest') |
2334 call delete('Xdir', 'rf') | 2334 call delete('Xnamedir', 'rf') |
2335 endfunc | 2335 endfunc |
2336 | 2336 |
2337 " Test for wildmenumode() with the cmdline popup menu | 2337 " Test for wildmenumode() with the cmdline popup menu |
2338 func Test_wildmenumode_with_pum() | 2338 func Test_wildmenumode_with_pum() |
2339 set wildmenu | 2339 set wildmenu |