Mercurial > vim
annotate src/testdir/test78.in @ 8587:fb8d7086e99d v7.4.1583
commit https://github.com/vim/vim/commit/597385ab43093ba27adcb86cdc1b46aba86a0093
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Mar 16 23:24:43 2016 +0100
patch 7.4.1583
Problem: Warning for unitinialized variable.
Solution: Initialize it. (Dominique)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 16 Mar 2016 23:30:08 +0100 |
parents | 7fe2c092913e |
children | ae45d497868f |
rev | line source |
---|---|
2893
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
1 Inserts 10000 lines with text to fill the swap file with two levels of pointer |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
2 blocks. Then recovers from the swap file and checks all text is restored. |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
3 |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
4 We need about 10000 lines of 100 characters to get two levels of pointer |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
5 blocks. |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
6 |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
7 STARTTEST |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
8 :so small.vim |
2949 | 9 :set nocp fileformat=unix undolevels=-1 viminfo+=nviminfo |
2893
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
10 :e! Xtest |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
11 ggdG |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
12 :let text = "\tabcdefghijklmnoparstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnoparstuvwxyz0123456789" |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
13 :let i = 1 |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
14 :let linecount = 10000 |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
15 :while i <= linecount | call append(i - 1, i . text) | let i += 1 | endwhile |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
16 :preserve |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
17 :" get the name of the swap file |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
18 :redir => swapname |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
19 :swapname |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
20 :redir END |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
21 :let swapname = substitute(swapname, '[[:blank:][:cntrl:]]*\(.\{-}\)[[:blank:][:cntrl:]]*$', '\1', '') |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
22 :" make a copy of the swap file in Xswap |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
23 :set bin |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
24 :exe 'sp ' . swapname |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
25 :w! Xswap |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
26 :echo swapname |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
27 :set nobin |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
28 :new |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
29 :only! |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
30 :bwipe! Xtest |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
31 :call rename('Xswap', swapname) |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
32 :recover Xtest |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
33 :call delete(swapname) |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
34 :new |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
35 :call append(0, 'recovery start') |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
36 :wincmd w |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
37 :let linedollar = line('$') |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
38 :if linedollar < linecount | exe 'wincmd w' | call append(line('$'), "expected " . linecount . " lines but found only " . linedollar) | exe 'wincmd w' | let linecount = linedollar | endif |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
39 :let i = 1 |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
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 |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
41 :q! |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
42 :call append(line('$'), 'recovery end') |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
43 :w! test.out |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
44 :qa! |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
45 ENDTEST |
c6f8f1957c66
Add files added by recent patches.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
46 |