aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-07-12 08:05:22 +0800
committerGitHub <noreply@github.com>2024-07-12 08:05:22 +0800
commitbcb17689da4fef9059f0c0fae2f1493969b0a78c (patch)
tree6625e078592d6139f2ebdd1de699e4f28b62050d /test
parenta5de650f0eb93a848831f1ba631485437a82d57b (diff)
parent83f42aa450582594f0be044c9f0710809ef0f93d (diff)
downloadrneovim-bcb17689da4fef9059f0c0fae2f1493969b0a78c.tar.gz
rneovim-bcb17689da4fef9059f0c0fae2f1493969b0a78c.tar.bz2
rneovim-bcb17689da4fef9059f0c0fae2f1493969b0a78c.zip
Merge pull request #29669 from zeertzjq/vim-9.1.0568
vim-patch:partial:9.0.{0323,0418},9.1.0568
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/test_cd.vim49
-rw-r--r--test/old/testdir/test_cmdline.vim3
2 files changed, 26 insertions, 26 deletions
diff --git a/test/old/testdir/test_cd.vim b/test/old/testdir/test_cd.vim
index cffba99451..dd92fc6c38 100644
--- a/test/old/testdir/test_cd.vim
+++ b/test/old/testdir/test_cd.vim
@@ -58,22 +58,21 @@ func Test_cd_minus()
call writefile(v:errors, 'Xresult')
qall!
[SCRIPT]
- call writefile(lines, 'Xscript')
+ call writefile(lines, 'Xscript', 'D')
if RunVim([], [], '--clean -S Xscript')
call assert_equal([], readfile('Xresult'))
endif
- call delete('Xscript')
call delete('Xresult')
endfunc
" Test for chdir()
func Test_chdir_func()
let topdir = getcwd()
- call mkdir('Xdir/y/z', 'p')
+ call mkdir('Xchdir/y/z', 'pR')
" Create a few tabpages and windows with different directories
new
- cd Xdir
+ cd Xchdir
tabnew
tcd y
below new
@@ -81,22 +80,22 @@ func Test_chdir_func()
lcd z
tabfirst
- call assert_match('^\[global\] .*/Xdir$', trim(execute('verbose pwd')))
+ call assert_match('^\[global\] .*/Xchdir$', trim(execute('verbose pwd')))
call chdir('..')
call assert_equal('y', fnamemodify(getcwd(1, 2), ':t'))
call assert_equal('z', fnamemodify(3->getcwd(2), ':t'))
tabnext | wincmd t
call assert_match('^\[tabpage\] .*/y$', trim(execute('verbose pwd')))
eval '..'->chdir()
- call assert_equal('Xdir', fnamemodify(getcwd(1, 2), ':t'))
- call assert_equal('Xdir', fnamemodify(getcwd(2, 2), ':t'))
+ call assert_equal('Xchdir', fnamemodify(getcwd(1, 2), ':t'))
+ call assert_equal('Xchdir', fnamemodify(getcwd(2, 2), ':t'))
call assert_equal('z', fnamemodify(getcwd(3, 2), ':t'))
call assert_equal('testdir', fnamemodify(getcwd(1, 1), ':t'))
3wincmd w
call assert_match('^\[window\] .*/z$', trim(execute('verbose pwd')))
call chdir('..')
- call assert_equal('Xdir', fnamemodify(getcwd(1, 2), ':t'))
- call assert_equal('Xdir', fnamemodify(getcwd(2, 2), ':t'))
+ call assert_equal('Xchdir', fnamemodify(getcwd(1, 2), ':t'))
+ call assert_equal('Xchdir', fnamemodify(getcwd(2, 2), ':t'))
call assert_equal('y', fnamemodify(getcwd(3, 2), ':t'))
call assert_equal('testdir', fnamemodify(getcwd(1, 1), ':t'))
@@ -110,20 +109,19 @@ func Test_chdir_func()
only | tabonly
call chdir(topdir)
- call delete('Xdir', 'rf')
endfunc
" Test for changing to the previous directory '-'
func Test_prev_dir()
let topdir = getcwd()
- call mkdir('Xdir/a/b/c', 'p')
+ call mkdir('Xprevdir/a/b/c', 'pR')
" Create a few tabpages and windows with different directories
new | only
tabnew | new
tabnew
tabfirst
- cd Xdir
+ cd Xprevdir
tabnext | wincmd t
tcd a
wincmd w
@@ -143,7 +141,7 @@ func Test_prev_dir()
" Check the directory of all the windows
tabfirst
- call assert_equal('Xdir', fnamemodify(getcwd(), ':t'))
+ call assert_equal('Xprevdir', fnamemodify(getcwd(), ':t'))
tabnext | wincmd t
call assert_equal('a', fnamemodify(getcwd(), ':t'))
wincmd w
@@ -163,7 +161,7 @@ func Test_prev_dir()
" Check the directory of all the windows
tabfirst
- call assert_equal('Xdir', fnamemodify(getcwd(), ':t'))
+ call assert_equal('Xprevdir', fnamemodify(getcwd(), ':t'))
tabnext | wincmd t
call assert_equal('a', fnamemodify(getcwd(), ':t'))
wincmd w
@@ -173,7 +171,6 @@ func Test_prev_dir()
only | tabonly
call chdir(topdir)
- call delete('Xdir', 'rf')
endfunc
func Test_lcd_split()
@@ -201,22 +198,26 @@ func Test_cd_from_non_existing_dir()
endfunc
func Test_cd_completion()
- call mkdir('XComplDir1', 'p')
- call mkdir('XComplDir2', 'p')
- call writefile([], 'XComplFile')
+ call mkdir('XComplDir1', 'D')
+ call mkdir('XComplDir2', 'D')
+ call mkdir('sub/XComplDir3', 'pD')
+ call writefile([], 'XComplFile', 'D')
for cmd in ['cd', 'chdir', 'lcd', 'lchdir', 'tcd', 'tchdir']
call feedkeys(':' .. cmd .. " XCompl\<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"' .. cmd .. ' XComplDir1/ XComplDir2/', @:)
endfor
- call delete('XComplDir1', 'd')
- call delete('XComplDir2', 'd')
- call delete('XComplFile')
+ set cdpath+=sub
+ for cmd in ['cd', 'chdir', 'lcd', 'lchdir', 'tcd', 'tchdir']
+ call feedkeys(':' .. cmd .. " XCompl\<C-A>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"' .. cmd .. ' XComplDir1/ XComplDir2/ XComplDir3/', @:)
+ endfor
+ set cdpath&
endfunc
func Test_cd_unknown_dir()
- call mkdir('Xa')
+ call mkdir('Xa', 'R')
cd Xa
call writefile(['text'], 'Xb.txt')
edit Xa/Xb.txt
@@ -229,7 +230,6 @@ func Test_cd_unknown_dir()
bwipe!
exe "bwipe! " .. first_buf
- call delete('Xa', 'rf')
endfunc
func Test_getcwd_actual_dir()
@@ -237,7 +237,7 @@ func Test_getcwd_actual_dir()
CheckOption autochdir
let startdir = getcwd()
- call mkdir('Xactual')
+ call mkdir('Xactual', 'R')
call test_autochdir()
set autochdir
edit Xactual/file.txt
@@ -251,7 +251,6 @@ func Test_getcwd_actual_dir()
set noautochdir
bwipe!
call chdir(startdir)
- call delete('Xactual', 'rf')
endfunc
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/test/old/testdir/test_cmdline.vim b/test/old/testdir/test_cmdline.vim
index 24811d49db..d00b5bbf46 100644
--- a/test/old/testdir/test_cmdline.vim
+++ b/test/old/testdir/test_cmdline.vim
@@ -645,7 +645,8 @@ func Test_getcompletion()
unlet g:cmdline_compl_params
" For others test if the name is recognized.
- let names = ['buffer', 'environment', 'file_in_path', 'mapping', 'tag', 'tag_listfiles', 'user']
+ let names = ['buffer', 'environment', 'file_in_path', 'dir_in_path', 'mapping', 'tag',
+ \ 'tag_listfiles', 'user']
if has('cmdline_hist')
call add(names, 'history')
endif