comparison src/testdir/test_backup.vim @ 14475:dddba3937532 v8.1.0251

patch 8.1.0251: using full path is not supported for 'backupdir' commit https://github.com/vim/vim/commit/b782ba475a3f8f2b0be99dda164ba4545347f60f Author: Bram Moolenaar <Bram@vim.org> Date: Tue Aug 7 21:39:28 2018 +0200 patch 8.1.0251: using full path is not supported for 'backupdir' Problem: Using a full path is supported for 'directory' but not for 'backupdir'. (Mikolaj Machowski) Solution: Support 'backupdir' as well. (Christian Brabandt, closes #179)
author Christian Brabandt <cb@256bit.org>
date Tue, 07 Aug 2018 21:45:05 +0200
parents
children 7fd8cb54da4a
comparison
equal deleted inserted replaced
14474:6325f850efcf 14475:dddba3937532
1 " Tests for the backup function
2
3 func Test_backup()
4 set backup backupdir=.
5 new
6 call setline(1, ['line1', 'line2'])
7 :f Xbackup.txt
8 :w! Xbackup.txt
9 " backup file is only created after
10 " writing a second time (before overwriting)
11 :w! Xbackup.txt
12 let l = readfile('Xbackup.txt~')
13 call assert_equal(['line1', 'line2'], l)
14 bw!
15 set backup&vim backupdir&vim
16 call delete('Xbackup.txt')
17 call delete('Xbackup.txt~')
18 endfunc
19
20 func Test_backup2()
21 set backup backupdir=.//
22 new
23 call setline(1, ['line1', 'line2', 'line3'])
24 :f Xbackup.txt
25 :w! Xbackup.txt
26 " backup file is only created after
27 " writing a second time (before overwriting)
28 :w! Xbackup.txt
29 sp *Xbackup.txt~
30 call assert_equal(['line1', 'line2', 'line3'], getline(1,'$'))
31 let f=expand('%')
32 call assert_match('src%testdir%Xbackup.txt\~', f)
33 bw!
34 bw!
35 call delete('Xbackup.txt')
36 call delete(f)
37 set backup&vim backupdir&vim
38 endfunc
39
40 func Test_backup2_backupcopy()
41 set backup backupdir=.// backupcopy=yes
42 new
43 call setline(1, ['line1', 'line2', 'line3'])
44 :f Xbackup.txt
45 :w! Xbackup.txt
46 " backup file is only created after
47 " writing a second time (before overwriting)
48 :w! Xbackup.txt
49 sp *Xbackup.txt~
50 call assert_equal(['line1', 'line2', 'line3'], getline(1,'$'))
51 let f=expand('%')
52 call assert_match('src%testdir%Xbackup.txt\~', f)
53 bw!
54 bw!
55 call delete('Xbackup.txt')
56 call delete(f)
57 set backup&vim backupdir&vim backupcopy&vim
58 endfunc