mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 20:08:17 +00:00
test: partially port Vim patches 8.1.2278 and 8.2.1432
This commit is contained in:
@@ -22,7 +22,7 @@ func Test_set_filename()
|
|||||||
bwipe!
|
bwipe!
|
||||||
au! DirChanged
|
au! DirChanged
|
||||||
set noacd
|
set noacd
|
||||||
exe 'cd ' . cwd
|
call chdir(cwd)
|
||||||
call delete('samples/Xtest')
|
call delete('samples/Xtest')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
@@ -42,9 +42,7 @@ if has('timers')
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_cursorhold_insert_with_timer_interrupt()
|
func Test_cursorhold_insert_with_timer_interrupt()
|
||||||
if !has('job')
|
CheckFeature job
|
||||||
return
|
|
||||||
endif
|
|
||||||
" Need to move the cursor.
|
" Need to move the cursor.
|
||||||
call feedkeys("ggG", "xt")
|
call feedkeys("ggG", "xt")
|
||||||
|
|
||||||
@@ -551,9 +549,7 @@ endfunc
|
|||||||
|
|
||||||
func Test_OptionSet()
|
func Test_OptionSet()
|
||||||
CheckFunction test_override
|
CheckFunction test_override
|
||||||
if !has("eval") || !exists("+autochdir")
|
CheckOption autochdir
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
call test_override('starting', 1)
|
call test_override('starting', 1)
|
||||||
set nocp
|
set nocp
|
||||||
@@ -1334,14 +1330,14 @@ function s:Before_test_dirchanged()
|
|||||||
augroup END
|
augroup END
|
||||||
let s:li = []
|
let s:li = []
|
||||||
let s:dir_this = getcwd()
|
let s:dir_this = getcwd()
|
||||||
let s:dir_foo = s:dir_this . '/foo'
|
let s:dir_foo = s:dir_this . '/Xfoo'
|
||||||
call mkdir(s:dir_foo)
|
call mkdir(s:dir_foo)
|
||||||
let s:dir_bar = s:dir_this . '/bar'
|
let s:dir_bar = s:dir_this . '/Xbar'
|
||||||
call mkdir(s:dir_bar)
|
call mkdir(s:dir_bar)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
function s:After_test_dirchanged()
|
function s:After_test_dirchanged()
|
||||||
exe 'cd' s:dir_this
|
call chdir(s:dir_this)
|
||||||
call delete(s:dir_foo, 'd')
|
call delete(s:dir_foo, 'd')
|
||||||
call delete(s:dir_bar, 'd')
|
call delete(s:dir_bar, 'd')
|
||||||
augroup test_dirchanged
|
augroup test_dirchanged
|
||||||
@@ -1353,11 +1349,11 @@ function Test_dirchanged_global()
|
|||||||
call s:Before_test_dirchanged()
|
call s:Before_test_dirchanged()
|
||||||
autocmd test_dirchanged DirChanged global call add(s:li, "cd:")
|
autocmd test_dirchanged DirChanged global call add(s:li, "cd:")
|
||||||
autocmd test_dirchanged DirChanged global call add(s:li, expand("<afile>"))
|
autocmd test_dirchanged DirChanged global call add(s:li, expand("<afile>"))
|
||||||
exe 'cd' s:dir_foo
|
call chdir(s:dir_foo)
|
||||||
call assert_equal(["cd:", s:dir_foo], s:li)
|
call assert_equal(["cd:", s:dir_foo], s:li)
|
||||||
exe 'cd' s:dir_foo
|
call chdir(s:dir_foo)
|
||||||
call assert_equal(["cd:", s:dir_foo], s:li)
|
call assert_equal(["cd:", s:dir_foo], s:li)
|
||||||
exe 'lcd' s:dir_bar
|
exe 'lcd ' .. fnameescape(s:dir_bar)
|
||||||
call assert_equal(["cd:", s:dir_foo], s:li)
|
call assert_equal(["cd:", s:dir_foo], s:li)
|
||||||
call s:After_test_dirchanged()
|
call s:After_test_dirchanged()
|
||||||
endfunc
|
endfunc
|
||||||
@@ -1366,25 +1362,24 @@ function Test_dirchanged_local()
|
|||||||
call s:Before_test_dirchanged()
|
call s:Before_test_dirchanged()
|
||||||
autocmd test_dirchanged DirChanged window call add(s:li, "lcd:")
|
autocmd test_dirchanged DirChanged window call add(s:li, "lcd:")
|
||||||
autocmd test_dirchanged DirChanged window call add(s:li, expand("<afile>"))
|
autocmd test_dirchanged DirChanged window call add(s:li, expand("<afile>"))
|
||||||
exe 'cd' s:dir_foo
|
call chdir(s:dir_foo)
|
||||||
call assert_equal([], s:li)
|
call assert_equal([], s:li)
|
||||||
exe 'lcd' s:dir_bar
|
exe 'lcd ' .. fnameescape(s:dir_bar)
|
||||||
call assert_equal(["lcd:", s:dir_bar], s:li)
|
call assert_equal(["lcd:", s:dir_bar], s:li)
|
||||||
exe 'lcd' s:dir_bar
|
exe 'lcd ' .. fnameescape(s:dir_bar)
|
||||||
call assert_equal(["lcd:", s:dir_bar], s:li)
|
call assert_equal(["lcd:", s:dir_bar], s:li)
|
||||||
call s:After_test_dirchanged()
|
call s:After_test_dirchanged()
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
function Test_dirchanged_auto()
|
function Test_dirchanged_auto()
|
||||||
if !exists('+autochdir')
|
CheckFunction test_autochdir
|
||||||
return
|
CheckOption autochdir
|
||||||
endif
|
|
||||||
call s:Before_test_dirchanged()
|
call s:Before_test_dirchanged()
|
||||||
call test_autochdir()
|
call test_autochdir()
|
||||||
autocmd test_dirchanged DirChanged auto call add(s:li, "auto:")
|
autocmd test_dirchanged DirChanged auto call add(s:li, "auto:")
|
||||||
autocmd test_dirchanged DirChanged auto call add(s:li, expand("<afile>"))
|
autocmd test_dirchanged DirChanged auto call add(s:li, expand("<afile>"))
|
||||||
set acd
|
set acd
|
||||||
exe 'cd ..'
|
cd ..
|
||||||
call assert_equal([], s:li)
|
call assert_equal([], s:li)
|
||||||
exe 'edit ' . s:dir_foo . '/Xfile'
|
exe 'edit ' . s:dir_foo . '/Xfile'
|
||||||
call assert_equal(s:dir_foo, getcwd())
|
call assert_equal(s:dir_foo, getcwd())
|
||||||
|
@@ -12,7 +12,7 @@ func Test_cd_up_and_down()
|
|||||||
let path = getcwd()
|
let path = getcwd()
|
||||||
cd ..
|
cd ..
|
||||||
call assert_notequal(path, getcwd())
|
call assert_notequal(path, getcwd())
|
||||||
exe 'cd ' . path
|
exe 'cd ' .. fnameescape(path)
|
||||||
call assert_equal(path, getcwd())
|
call assert_equal(path, getcwd())
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ func Test_cd_no_arg()
|
|||||||
cd
|
cd
|
||||||
call assert_equal($HOME, getcwd())
|
call assert_equal($HOME, getcwd())
|
||||||
call assert_notequal(path, getcwd())
|
call assert_notequal(path, getcwd())
|
||||||
exe 'cd ' . path
|
exe 'cd ' .. fnameescape(path)
|
||||||
call assert_equal(path, getcwd())
|
call assert_equal(path, getcwd())
|
||||||
else
|
else
|
||||||
" Test that cd without argument echoes cwd on non-Unix systems.
|
" Test that cd without argument echoes cwd on non-Unix systems.
|
||||||
@@ -61,7 +61,7 @@ func Test_cd_with_cpo_chdir()
|
|||||||
|
|
||||||
" :cd should succeed when buffer has been written.
|
" :cd should succeed when buffer has been written.
|
||||||
w!
|
w!
|
||||||
exe 'cd ' . path
|
exe 'cd ' .. fnameescape(path)
|
||||||
call assert_equal(path, getcwd())
|
call assert_equal(path, getcwd())
|
||||||
|
|
||||||
call delete('Xfoo')
|
call delete('Xfoo')
|
||||||
@@ -106,7 +106,7 @@ func Test_chdir_func()
|
|||||||
call assert_equal("", d)
|
call assert_equal("", d)
|
||||||
|
|
||||||
only | tabonly
|
only | tabonly
|
||||||
exe 'cd ' . topdir
|
call chdir(topdir)
|
||||||
call delete('Xdir', 'rf')
|
call delete('Xdir', 'rf')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
@@ -36,7 +36,7 @@ func Test_find_complete()
|
|||||||
" We shouldn't find any file till this point
|
" We shouldn't find any file till this point
|
||||||
|
|
||||||
call mkdir('in/path', 'p')
|
call mkdir('in/path', 'p')
|
||||||
exe 'cd ' . cwd
|
call chdir(cwd)
|
||||||
call writefile(['Holy Grail'], 'Xfind/file.txt')
|
call writefile(['Holy Grail'], 'Xfind/file.txt')
|
||||||
call writefile(['Jimmy Hoffa'], 'Xfind/in/file.txt')
|
call writefile(['Jimmy Hoffa'], 'Xfind/in/file.txt')
|
||||||
call writefile(['Another Holy Grail'], 'Xfind/in/stuff.txt')
|
call writefile(['Another Holy Grail'], 'Xfind/in/stuff.txt')
|
||||||
@@ -133,12 +133,12 @@ func Test_find_complete()
|
|||||||
call assert_equal('Voyager 2', getline(1))
|
call assert_equal('Voyager 2', getline(1))
|
||||||
|
|
||||||
" Check for correct handling of shorten_fname()'s behavior on windows
|
" Check for correct handling of shorten_fname()'s behavior on windows
|
||||||
exec "cd " . cwd . "/Xfind/in"
|
call chdir(cwd .. "/Xfind/in")
|
||||||
call feedkeys(":find file\t\n", "xt")
|
call feedkeys(":find file\t\n", "xt")
|
||||||
call assert_equal('Jimmy Hoffa', getline(1))
|
call assert_equal('Jimmy Hoffa', getline(1))
|
||||||
|
|
||||||
" Test for relative to current buffer 'path' item
|
" Test for relative to current buffer 'path' item
|
||||||
exec "cd " . cwd . "/Xfind/"
|
call chdir(cwd . "/Xfind/")
|
||||||
set path=./path
|
set path=./path
|
||||||
" Open the file where Jimmy Hoffa is found
|
" Open the file where Jimmy Hoffa is found
|
||||||
e in/file.txt
|
e in/file.txt
|
||||||
@@ -157,7 +157,7 @@ func Test_find_complete()
|
|||||||
call assert_equal('Another Holy Grail', getline(1))
|
call assert_equal('Another Holy Grail', getline(1))
|
||||||
|
|
||||||
enew | only
|
enew | only
|
||||||
exe 'cd ' . cwd
|
call chdir(cwd)
|
||||||
call delete('Xfind', 'rf')
|
call delete('Xfind', 'rf')
|
||||||
set path&
|
set path&
|
||||||
endfunc
|
endfunc
|
||||||
|
@@ -113,7 +113,7 @@ func Test_findfile()
|
|||||||
call assert_match('.*/Xdir1/bar', findfile('bar', '**;', 2))
|
call assert_match('.*/Xdir1/bar', findfile('bar', '**;', 2))
|
||||||
|
|
||||||
bwipe!
|
bwipe!
|
||||||
exe 'cd ' . save_dir
|
call chdir(save_dir)
|
||||||
call CleanFiles()
|
call CleanFiles()
|
||||||
let &path = save_path
|
let &path = save_path
|
||||||
let &shellslash = save_shellslash
|
let &shellslash = save_shellslash
|
||||||
@@ -171,7 +171,7 @@ func Test_finddir()
|
|||||||
call assert_match('.*/Xdir1/Xdir2', finddir('Xdir2', '**;', 2))
|
call assert_match('.*/Xdir1/Xdir2', finddir('Xdir2', '**;', 2))
|
||||||
call assert_equal('Xdir3', finddir('Xdir3', '**;', 1))
|
call assert_equal('Xdir3', finddir('Xdir3', '**;', 1))
|
||||||
|
|
||||||
exe 'cd ' . save_dir
|
call chdir(save_dir)
|
||||||
call CleanFiles()
|
call CleanFiles()
|
||||||
let &path = save_path
|
let &path = save_path
|
||||||
let &shellslash = save_shellslash
|
let &shellslash = save_shellslash
|
||||||
|
@@ -46,7 +46,7 @@ endfunction
|
|||||||
let g:cwd=getcwd()
|
let g:cwd=getcwd()
|
||||||
function TearDown()
|
function TearDown()
|
||||||
q
|
q
|
||||||
exec "cd " . g:cwd
|
call chdir(g:cwd)
|
||||||
call delete("Xtopdir", "rf")
|
call delete("Xtopdir", "rf")
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user