Mercurial > vim
annotate src/testdir/test_recover.vim @ 24828:e0c43439fea6 v8.2.2952
patch 8.2.2952: recover test fails on big endian systems
Commit: https://github.com/vim/vim/commit/99285550a9957e2c8669f183557944c6513c4875
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Sun Jun 6 17:12:46 2021 +0200
patch 8.2.2952: recover test fails on big endian systems
Problem: Recover test fails on big endian systems.
Solution: Disable the failing test on big endian systems. (Yegappan
Lakshmanan, closes #8335)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 06 Jun 2021 17:15:04 +0200 |
parents | 4c5eec1ef612 |
children | 250c6ab76d19 |
rev | line source |
---|---|
10896
d513b653f5d0
patch 8.0.0337: invalid memory access in :recover command
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Test :recover |
d513b653f5d0
patch 8.0.0337: invalid memory access in :recover command
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
24089
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
3 source check.vim |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
4 |
10896
d513b653f5d0
patch 8.0.0337: invalid memory access in :recover command
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 func Test_recover_root_dir() |
d513b653f5d0
patch 8.0.0337: invalid memory access in :recover command
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 " This used to access invalid memory. |
d513b653f5d0
patch 8.0.0337: invalid memory access in :recover command
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 split Xtest |
d513b653f5d0
patch 8.0.0337: invalid memory access in :recover command
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 set dir=/ |
d513b653f5d0
patch 8.0.0337: invalid memory access in :recover command
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 call assert_fails('recover', 'E305:') |
d513b653f5d0
patch 8.0.0337: invalid memory access in :recover command
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 close! |
d513b653f5d0
patch 8.0.0337: invalid memory access in :recover command
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 |
11432
0cafb01af1b6
patch 8.0.0600: test_recover fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10898
diff
changeset
|
12 if has('win32') || filewritable('/') == 2 |
10898
cc3f6ad092c2
patch 8.0.0338: :recover test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
10896
diff
changeset
|
13 " can write in / directory on MS-Windows |
cc3f6ad092c2
patch 8.0.0338: :recover test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
10896
diff
changeset
|
14 set dir=/notexist/ |
cc3f6ad092c2
patch 8.0.0338: :recover test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
10896
diff
changeset
|
15 endif |
10896
d513b653f5d0
patch 8.0.0337: invalid memory access in :recover command
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 call assert_fails('split Xtest', 'E303:') |
18372
11394af51615
patch 8.1.2180: Error E303 is not useful when 'directory' is empty
Bram Moolenaar <Bram@vim.org>
parents:
12644
diff
changeset
|
17 |
11394af51615
patch 8.1.2180: Error E303 is not useful when 'directory' is empty
Bram Moolenaar <Bram@vim.org>
parents:
12644
diff
changeset
|
18 " No error with empty 'directory' setting. |
11394af51615
patch 8.1.2180: Error E303 is not useful when 'directory' is empty
Bram Moolenaar <Bram@vim.org>
parents:
12644
diff
changeset
|
19 set directory= |
11394af51615
patch 8.1.2180: Error E303 is not useful when 'directory' is empty
Bram Moolenaar <Bram@vim.org>
parents:
12644
diff
changeset
|
20 split XtestOK |
11394af51615
patch 8.1.2180: Error E303 is not useful when 'directory' is empty
Bram Moolenaar <Bram@vim.org>
parents:
12644
diff
changeset
|
21 close! |
11394af51615
patch 8.1.2180: Error E303 is not useful when 'directory' is empty
Bram Moolenaar <Bram@vim.org>
parents:
12644
diff
changeset
|
22 |
10896
d513b653f5d0
patch 8.0.0337: invalid memory access in :recover command
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 set dir& |
d513b653f5d0
patch 8.0.0337: invalid memory access in :recover command
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 endfunc |
d513b653f5d0
patch 8.0.0337: invalid memory access in :recover command
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 |
24089
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
26 " Make a copy of the current swap file to "Xswap". |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
27 " Return the name of the swap file. |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
28 func CopySwapfile() |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
29 preserve |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
30 " get the name of the swap file |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
31 let swname = split(execute("swapname"))[0] |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
32 let swname = substitute(swname, '[[:blank:][:cntrl:]]*\(.\{-}\)[[:blank:][:cntrl:]]*$', '\1', '') |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
33 " make a copy of the swap file in Xswap |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
34 set binary |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
35 exe 'sp ' . swname |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
36 w! Xswap |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
37 set nobinary |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
38 return swname |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
39 endfunc |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
40 |
12616
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
41 " Inserts 10000 lines with text to fill the swap file with two levels of pointer |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
42 " blocks. Then recovers from the swap file and checks all text is restored. |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
43 " |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
44 " We need about 10000 lines of 100 characters to get two levels of pointer |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
45 " blocks. |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
46 func Test_swap_file() |
12644
1fad9675d8fd
patch 8.0.1200: tests switch the bell off twice
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
47 set fileformat=unix undolevels=-1 |
12616
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
48 edit! Xtest |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
49 let text = "\tabcdefghijklmnoparstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnoparstuvwxyz0123456789" |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
50 let i = 1 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
51 let linecount = 10000 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
52 while i <= linecount |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
53 call append(i - 1, i . text) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
54 let i += 1 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
55 endwhile |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
56 $delete |
24089
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
57 |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
58 let swname = CopySwapfile() |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
59 |
12616
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
60 new |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
61 only! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
62 bwipe! Xtest |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
63 call rename('Xswap', swname) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
64 recover Xtest |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
65 call delete(swname) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
66 let linedollar = line('$') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
67 call assert_equal(linecount, linedollar) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
68 if linedollar < linecount |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
69 let linecount = linedollar |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
70 endif |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
71 let i = 1 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
72 while i <= linecount |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
73 call assert_equal(i . text, getline(i)) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
74 let i += 1 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
75 endwhile |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
76 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
77 set undolevels& |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
78 enew! | only |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
11432
diff
changeset
|
79 endfunc |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
18372
diff
changeset
|
80 |
24089
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
81 func Test_nocatch_process_still_running() |
24091
12a773f4f62f
patch 8.2.2587: recover test fails on FreeBSD
Bram Moolenaar <Bram@vim.org>
parents:
24089
diff
changeset
|
82 " sysinfo.uptime probably only works on Linux |
24095
467c3022fba6
patch 8.2.2589: recover test hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
24091
diff
changeset
|
83 if !has('linux') |
467c3022fba6
patch 8.2.2589: recover test hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
24091
diff
changeset
|
84 let g:skipped_reason = 'only works on Linux' |
467c3022fba6
patch 8.2.2589: recover test hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
24091
diff
changeset
|
85 return |
467c3022fba6
patch 8.2.2589: recover test hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
24091
diff
changeset
|
86 endif |
24091
12a773f4f62f
patch 8.2.2587: recover test fails on FreeBSD
Bram Moolenaar <Bram@vim.org>
parents:
24089
diff
changeset
|
87 " the GUI dialog can't be handled |
24095
467c3022fba6
patch 8.2.2589: recover test hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
24091
diff
changeset
|
88 if has('gui_running') |
467c3022fba6
patch 8.2.2589: recover test hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
24091
diff
changeset
|
89 let g:skipped_reason = 'only works in the terminal' |
467c3022fba6
patch 8.2.2589: recover test hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
24091
diff
changeset
|
90 return |
467c3022fba6
patch 8.2.2589: recover test hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
24091
diff
changeset
|
91 endif |
24089
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
92 |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
93 " don't intercept existing swap file here |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
94 au! SwapExists |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
95 |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
96 " Edit a file and grab its swapfile. |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
97 edit Xswaptest |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
98 call setline(1, ['a', 'b', 'c']) |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
99 let swname = CopySwapfile() |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
100 |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
101 " Forget we edited this file |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
102 new |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
103 only! |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
104 bwipe! Xswaptest |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
105 |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
106 call rename('Xswap', swname) |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
107 call feedkeys('e', 'tL') |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
108 redir => editOutput |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
109 edit Xswaptest |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
110 redir END |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
111 call assert_match('E325: ATTENTION', editOutput) |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
112 call assert_match('file name: .*Xswaptest', editOutput) |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
113 call assert_match('process ID: \d* (STILL RUNNING)', editOutput) |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
114 |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
115 " Forget we edited this file |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
116 new |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
117 only! |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
118 bwipe! Xswaptest |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
119 |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
120 " pretend we rebooted |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
121 call test_override("uptime", 0) |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
122 sleep 1 |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
123 |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
124 call rename('Xswap', swname) |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
125 call feedkeys('e', 'tL') |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
126 redir => editOutput |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
127 edit Xswaptest |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
128 redir END |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
129 call assert_match('E325: ATTENTION', editOutput) |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
130 call assert_notmatch('(STILL RUNNING)', editOutput) |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
131 |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
132 call test_override("ALL", 0) |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
133 call delete(swname) |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
134 endfunc |
cdeec1389c8c
patch 8.2.2586: process id may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
135 |
24814
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
136 " Test for :recover with multiple swap files |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
137 func Test_recover_multiple_swap_files() |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
138 CheckUnix |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
139 new Xfile1 |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
140 call setline(1, ['a', 'b', 'c']) |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
141 preserve |
24828
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
142 let b = readblob(swapname('')) |
24814
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
143 call writefile(b, '.Xfile1.swm') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
144 call writefile(b, '.Xfile1.swn') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
145 call writefile(b, '.Xfile1.swo') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
146 %bw! |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
147 call feedkeys(":recover Xfile1\<CR>3\<CR>q", 'xt') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
148 call assert_equal(['a', 'b', 'c'], getline(1, '$')) |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
149 |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
150 call delete('.Xfile1.swm') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
151 call delete('.Xfile1.swn') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
152 call delete('.Xfile1.swo') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
153 endfunc |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
154 |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
155 " Test for :recover using an empty swap file |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
156 func Test_recover_empty_swap_file() |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
157 CheckUnix |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
158 call writefile([], '.Xfile1.swp') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
159 let msg = execute('recover Xfile1') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
160 call assert_match('Unable to read block 0 from .Xfile1.swp', msg) |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
161 call assert_equal('Xfile1', @%) |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
162 bw! |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
163 " :recover from an empty buffer |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
164 call assert_fails('recover', 'E305:') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
165 call delete('.Xfile1.swp') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
166 endfunc |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
167 |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
168 " Test for :recover using a corrupted swap file |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
169 func Test_recover_corrupted_swap_file() |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
170 CheckUnix |
24828
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
171 |
24814
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
172 " recover using a partial swap file |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
173 call writefile(0z1234, '.Xfile1.swp') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
174 call assert_fails('recover Xfile1', 'E295:') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
175 bw! |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
176 |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
177 " recover using invalid content in the swap file |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
178 call writefile([repeat('1', 2*1024)], '.Xfile1.swp') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
179 call assert_fails('recover Xfile1', 'E307:') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
180 call delete('.Xfile1.swp') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
181 |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
182 " :recover using a swap file with a corrupted header |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
183 edit Xfile1 |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
184 preserve |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
185 let sn = swapname('') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
186 let b = readblob(sn) |
24828
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
187 let save_b = copy(b) |
24814
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
188 bw! |
24828
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
189 " Run these tests only on little-endian systems. These tests fail on a |
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
190 " big-endian system (IBM S390x system). |
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
191 if b[1008:1011] == 0z33323130 |
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
192 \ && b[4096:4097] == 0z7470 |
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
193 \ && b[8192:8193] == 0z6164 |
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
194 |
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
195 " clear the B0_MAGIC_LONG field |
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
196 let b[1008:1011] = 0z00000000 |
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
197 call writefile(b, sn) |
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
198 let msg = execute('recover Xfile1') |
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
199 call assert_match('the file has been damaged', msg) |
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
200 bw! |
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
201 |
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
202 " clear the pointer ID |
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
203 let b = copy(save_b) |
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
204 let b[4096:4097] = 0z0000 |
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
205 call writefile(b, sn) |
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
206 call assert_fails('recover Xfile1', 'E310:') |
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
207 bw! |
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
208 |
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
209 " clear the data block ID |
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
210 let b = copy(save_b) |
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
211 let b[8192:8193] = 0z0000 |
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
212 call writefile(b, sn) |
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
213 call assert_fails('recover Xfile1', 'E312:') |
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
214 bw! |
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
215 |
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
216 " remove the data block |
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
217 let b = copy(save_b) |
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
218 call writefile(b[:8191], sn) |
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
219 call assert_fails('recover Xfile1', 'E312:') |
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
220 endif |
e0c43439fea6
patch 8.2.2952: recover test fails on big endian systems
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
221 |
24814
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
222 bw! |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
223 call delete(sn) |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
224 endfunc |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
225 |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
226 " Test for :recover using an encrypted swap file |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
227 func Test_recover_encrypted_swap_file() |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
228 CheckUnix |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
229 |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
230 " Recover an encrypted file from the swap file without the original file |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
231 new Xfile1 |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
232 call feedkeys(":X\<CR>vim\<CR>vim\<CR>", 'xt') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
233 call setline(1, ['aaa', 'bbb', 'ccc']) |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
234 preserve |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
235 let b = readblob('.Xfile1.swp') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
236 call writefile(b, '.Xfile1.swm') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
237 bw! |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
238 call feedkeys(":recover Xfile1\<CR>vim\<CR>\<CR>", 'xt') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
239 call assert_equal(['aaa', 'bbb', 'ccc'], getline(1, '$')) |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
240 bw! |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
241 call delete('.Xfile1.swm') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
242 |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
243 " Recover an encrypted file from the swap file with the original file |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
244 new Xfile1 |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
245 call feedkeys(":X\<CR>vim\<CR>vim\<CR>", 'xt') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
246 call setline(1, ['aaa', 'bbb', 'ccc']) |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
247 update |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
248 call setline(1, ['111', '222', '333']) |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
249 preserve |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
250 let b = readblob('.Xfile1.swp') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
251 call writefile(b, '.Xfile1.swm') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
252 bw! |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
253 call feedkeys(":recover Xfile1\<CR>vim\<CR>\<CR>", 'xt') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
254 call assert_equal(['111', '222', '333'], getline(1, '$')) |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
255 call assert_true(&modified) |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
256 bw! |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
257 call delete('.Xfile1.swm') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
258 call delete('Xfile1') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
259 endfunc |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
260 |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
261 " Test for :recover using a unreadable swap file |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
262 func Test_recover_unreadble_swap_file() |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
263 CheckUnix |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
264 CheckNotRoot |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
265 new Xfile1 |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
266 let b = readblob('.Xfile1.swp') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
267 call writefile(b, '.Xfile1.swm') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
268 bw! |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
269 call setfperm('.Xfile1.swm', '-w-------') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
270 call assert_fails('recover Xfile1', 'E306:') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
271 call delete('.Xfile1.swm') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
272 endfunc |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
273 |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
274 " Test for using :recover when the original file and the swap file have the |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
275 " same contents. |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
276 func Test_recover_unmodified_file() |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
277 CheckUnix |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
278 call writefile(['aaa', 'bbb', 'ccc'], 'Xfile1') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
279 edit Xfile1 |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
280 preserve |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
281 let b = readblob('.Xfile1.swp') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
282 %bw! |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
283 call writefile(b, '.Xfile1.swz') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
284 let msg = execute('recover Xfile1') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
285 call assert_equal(['aaa', 'bbb', 'ccc'], getline(1, '$')) |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
286 call assert_false(&modified) |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
287 call assert_match('Buffer contents equals file contents', msg) |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
288 bw! |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
289 call delete('Xfile1') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
290 call delete('.Xfile1.swz') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
291 endfunc |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24095
diff
changeset
|
292 |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
18372
diff
changeset
|
293 " vim: shiftwidth=2 sts=2 expandtab |