mirror of
https://github.com/vim/vim.git
synced 2025-07-25 10:54:51 -04:00
patch 8.1.0025: no test for the undofile() function
Problem: No test for the undofile() function. Solution: Add test. (Dominique Pelle, closes #2958)
This commit is contained in:
parent
6b69e5c646
commit
e5fa11186f
@ -410,3 +410,35 @@ func Test_redo_empty_line()
|
||||
exe "norm."
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
funct Test_undofile()
|
||||
" Test undofile() without setting 'undodir'.
|
||||
if has('persistent_undo')
|
||||
call assert_equal(fnamemodify('.Xundofoo.un~', ':p'), undofile('Xundofoo'))
|
||||
else
|
||||
call assert_equal('', undofile('Xundofoo'))
|
||||
endif
|
||||
call assert_equal('', undofile(''))
|
||||
|
||||
" Test undofile() with 'undodir' set to to an existing directory.
|
||||
call mkdir('Xundodir')
|
||||
set undodir=Xundodir
|
||||
let cwd = getcwd()
|
||||
if has('win32')
|
||||
" Replace windows drive such as C:... into C%...
|
||||
let cwd = substitute(cwd, '^\([A-Z]\):', '\1%', 'g')
|
||||
endif
|
||||
let cwd = substitute(cwd . '/Xundofoo', '/', '%', 'g')
|
||||
if has('persistent_undo')
|
||||
call assert_equal('Xundodir/' . cwd, undofile('Xundofoo'))
|
||||
else
|
||||
call assert_equal('', undofile('Xundofoo'))
|
||||
endif
|
||||
call assert_equal('', undofile(''))
|
||||
call delete('Xundodir', 'd')
|
||||
|
||||
" Test undofile() with 'undodir' set to a non-existing directory.
|
||||
call assert_equal('', undofile('Xundofoo'))
|
||||
|
||||
set undodir&
|
||||
endfunc
|
||||
|
@ -761,6 +761,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
25,
|
||||
/**/
|
||||
24,
|
||||
/**/
|
||||
|
Loading…
x
Reference in New Issue
Block a user