Mercurial > vim
annotate src/testdir/test_backup.vim @ 14954:69d2749a6a2f v8.1.0488
patch 8.1.0488: using freed memory in quickfix code
commit https://github.com/vim/vim/commit/9f84ded38b62c82a4ee57b54f403b1b185ed8170
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Oct 20 20:54:02 2018 +0200
patch 8.1.0488: using freed memory in quickfix code
Problem: Using freed memory in quickfix code. (Dominique Pelle)
Solution: Add the quickfix_busy() flag to postpone deleting quickfix lists
until it is safe. (Yegappan Lakshmanan, closes #3538)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 20 Oct 2018 21:00:06 +0200 |
parents | 77968a364ec4 |
children | d8628d75c47a |
rev | line source |
---|---|
14475
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Tests for the backup function |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 func Test_backup() |
14501
77968a364ec4
patch 8.1.0264: backup tests fail when CWD is in /tmp
Christian Brabandt <cb@256bit.org>
parents:
14483
diff
changeset
|
4 set backup backupdir=. backupskip= |
14475
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 new |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 call setline(1, ['line1', 'line2']) |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 :f Xbackup.txt |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 :w! Xbackup.txt |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 " backup file is only created after |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 " writing a second time (before overwriting) |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 :w! Xbackup.txt |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 let l = readfile('Xbackup.txt~') |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 call assert_equal(['line1', 'line2'], l) |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 bw! |
14501
77968a364ec4
patch 8.1.0264: backup tests fail when CWD is in /tmp
Christian Brabandt <cb@256bit.org>
parents:
14483
diff
changeset
|
15 set backup&vim backupdir&vim backupskip&vim |
14475
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 call delete('Xbackup.txt') |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 call delete('Xbackup.txt~') |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 endfunc |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 func Test_backup2() |
14501
77968a364ec4
patch 8.1.0264: backup tests fail when CWD is in /tmp
Christian Brabandt <cb@256bit.org>
parents:
14483
diff
changeset
|
21 set backup backupdir=.// backupskip= |
14475
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 new |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 call setline(1, ['line1', 'line2', 'line3']) |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 :f Xbackup.txt |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 :w! Xbackup.txt |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 " backup file is only created after |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 " writing a second time (before overwriting) |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 :w! Xbackup.txt |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 sp *Xbackup.txt~ |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 call assert_equal(['line1', 'line2', 'line3'], getline(1,'$')) |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 let f=expand('%') |
14483
7fd8cb54da4a
patch 8.1.0255: backup test fails when using shadow directory
Christian Brabandt <cb@256bit.org>
parents:
14475
diff
changeset
|
32 call assert_match('%testdir%Xbackup.txt\~', f) |
14475
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 bw! |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 bw! |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 call delete('Xbackup.txt') |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 call delete(f) |
14501
77968a364ec4
patch 8.1.0264: backup tests fail when CWD is in /tmp
Christian Brabandt <cb@256bit.org>
parents:
14483
diff
changeset
|
37 set backup&vim backupdir&vim backupskip&vim |
14475
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 endfunc |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 func Test_backup2_backupcopy() |
14501
77968a364ec4
patch 8.1.0264: backup tests fail when CWD is in /tmp
Christian Brabandt <cb@256bit.org>
parents:
14483
diff
changeset
|
41 set backup backupdir=.// backupcopy=yes backupskip= |
14475
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 new |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 call setline(1, ['line1', 'line2', 'line3']) |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 :f Xbackup.txt |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 :w! Xbackup.txt |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 " backup file is only created after |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 " writing a second time (before overwriting) |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 :w! Xbackup.txt |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 sp *Xbackup.txt~ |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 call assert_equal(['line1', 'line2', 'line3'], getline(1,'$')) |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 let f=expand('%') |
14483
7fd8cb54da4a
patch 8.1.0255: backup test fails when using shadow directory
Christian Brabandt <cb@256bit.org>
parents:
14475
diff
changeset
|
52 call assert_match('%testdir%Xbackup.txt\~', f) |
14475
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 bw! |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 bw! |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 call delete('Xbackup.txt') |
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 call delete(f) |
14501
77968a364ec4
patch 8.1.0264: backup tests fail when CWD is in /tmp
Christian Brabandt <cb@256bit.org>
parents:
14483
diff
changeset
|
57 set backup&vim backupdir&vim backupcopy&vim backupskip&vim |
14475
dddba3937532
patch 8.1.0251: using full path is not supported for 'backupdir'
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 endfunc |