fork for IVI
[profile/ivi/vim.git] / src / testdir / test78.in
1 Inserts 10000 lines with text to fill the swap file with two levels of pointer
2 blocks.  Then recovers from the swap file and checks all text is restored.
3
4 We need about 10000 lines of 100 characters to get two levels of pointer
5 blocks.
6
7 STARTTEST
8 :so small.vim
9 :set nocp fileformat=unix undolevels=-1 viminfo+=nviminfo
10 :e! Xtest
11 ggdG
12 :let text = "\tabcdefghijklmnoparstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnoparstuvwxyz0123456789"
13 :let i = 1
14 :let linecount = 10000
15 :while i <= linecount | call append(i - 1, i . text) | let i += 1 | endwhile
16 :preserve
17 :" get the name of the swap file
18 :redir => swapname
19 :swapname
20 :redir END
21 :let swapname = substitute(swapname, '[[:blank:][:cntrl:]]*\(.\{-}\)[[:blank:][:cntrl:]]*$', '\1', '')
22 :" make a copy of the swap file in Xswap
23 :set bin
24 :exe 'sp ' . swapname
25 :w! Xswap
26 :echo swapname
27 :set nobin
28 :new
29 :only!
30 :bwipe! Xtest
31 :call rename('Xswap', swapname)
32 :recover Xtest
33 :call delete(swapname)
34 :new
35 :call append(0, 'recovery start')
36 :wincmd w
37 :let linedollar = line('$')
38 :if linedollar < linecount | exe 'wincmd w' | call append(line('$'), "expected " . linecount . " lines but found only " . linedollar) | exe 'wincmd w' | let linecount = linedollar | endif
39 :let i = 1
40 :while i <= linecount | if getline(i) != i . text | exe 'wincmd w' | call append(line('$'), i . ' differs') | exe 'wincmd w' | endif | let i += 1 | endwhile
41 :q!
42 :call append(line('$'), 'recovery end')
43 :w! test.out
44 :qa!
45 ENDTEST
46