aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_backup.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-11-06 22:13:36 +0800
committerGitHub <noreply@github.com>2022-11-06 22:13:36 +0800
commit728c69bc8d52a3f2281a76e4142b2d766dc45da0 (patch)
treec52e1a90dcaee1bb55e2326581987d68fc8fe07d /src/nvim/testdir/test_backup.vim
parentda0fb438496a7d721830bea51f0eb38d8c995883 (diff)
downloadrneovim-728c69bc8d52a3f2281a76e4142b2d766dc45da0.tar.gz
rneovim-728c69bc8d52a3f2281a76e4142b2d766dc45da0.tar.bz2
rneovim-728c69bc8d52a3f2281a76e4142b2d766dc45da0.zip
vim-patch:8.2.1340: some tests fail on Cirrus CI and/or with FreeBSD (#20967)
Problem: Some tests fail on Cirrus CI and/or with FreeBSD. Solution: Make 'backupskip' empty. Do not run tests as root. Check for directory when using viminfo. (Ozaki Kiichi, closes vim/vim#6596) https://github.com/vim/vim/commit/b86abadf87bd0f85f800077171ec4b98aefff776
Diffstat (limited to 'src/nvim/testdir/test_backup.vim')
-rw-r--r--src/nvim/testdir/test_backup.vim27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/nvim/testdir/test_backup.vim b/src/nvim/testdir/test_backup.vim
index 7eff818732..d304773da4 100644
--- a/src/nvim/testdir/test_backup.vim
+++ b/src/nvim/testdir/test_backup.vim
@@ -19,6 +19,22 @@ func Test_backup()
call delete('Xbackup.txt~')
endfunc
+func Test_backup_backupskip()
+ set backup backupdir=. backupskip=*.txt
+ new
+ call setline(1, ['line1', 'line2'])
+ :f Xbackup.txt
+ :w! Xbackup.txt
+ " backup file is only created after
+ " writing a second time (before overwriting)
+ :w! Xbackup.txt
+ call assert_false(filereadable('Xbackup.txt~'))
+ bw!
+ set backup&vim backupdir&vim backupskip&vim
+ call delete('Xbackup.txt')
+ call delete('Xbackup.txt~')
+endfunc
+
func Test_backup2()
set backup backupdir=.// backupskip=
new
@@ -30,7 +46,7 @@ func Test_backup2()
:w! Xbackup.txt
sp *Xbackup.txt~
call assert_equal(['line1', 'line2', 'line3'], getline(1,'$'))
- let f=expand('%')
+ let f = expand('%')
call assert_match('%testdir%Xbackup.txt\~', f)
bw!
bw!
@@ -50,7 +66,7 @@ func Test_backup2_backupcopy()
:w! Xbackup.txt
sp *Xbackup.txt~
call assert_equal(['line1', 'line2', 'line3'], getline(1,'$'))
- let f=expand('%')
+ let f = expand('%')
call assert_match('%testdir%Xbackup.txt\~', f)
bw!
bw!
@@ -62,14 +78,11 @@ endfunc
" Test for using a non-existing directory as a backup directory
func Test_non_existing_backupdir()
throw 'Skipped: Nvim auto-creates backup directory'
- CheckNotBSD
- let save_backup = &backupdir
- set backupdir=./non_existing_dir
+ set backupdir=./non_existing_dir backupskip=
call writefile(['line1'], 'Xfile')
new Xfile
- " TODO: write doesn't fail in Cirrus FreeBSD CI test
call assert_fails('write', 'E510:')
- let &backupdir = save_backup
+ set backupdir&vim backupskip&vim
call delete('Xfile')
endfunc