1Tests for undo file.
2Since this script is sourced we need to explicitly break changes up in
3undo-able pieces.  Do that by setting 'undolevels'.
4
5STARTTEST
6:so small.vim
7:"
8:" Test 'undofile': first a simple one-line change.
9:set nocompatible viminfo+=nviminfo visualbell
10:set ul=100 undofile nomore
11:e! Xtestfile
12ggdGithis is one line:set ul=100
13:s/one/ONE/
14:set ul=100
15:w
16:bwipe!
17:e Xtestfile
18u:.w! test.out
19:"
20:" Test 'undofile', change in original file fails check
21:set noundofile
22:e! Xtestfile
23:s/line/Line/
24:w
25:set undofile
26:bwipe!
27:e Xtestfile
28:" TODO: this beeps
29u:.w >>test.out
30:"
31:" Test 'undofile', add 10 lines, delete 6 lines, undo 3
32:set undofile
33ggdGione
34two
35three
36four
37five
38six
39seven
40eight
41nine
42ten:set ul=100
433Gdd:set ul=100
44dd:set ul=100
45dd:set ul=100
46dd:set ul=100
47dd:set ul=100
48dd:set ul=100
49:w
50:bwipe!
51:e Xtestfile
52uuu:w >>test.out
53:"
54:" And now with encryption, cryptmethod=zip
55:e! Xtestfile
56:set undofile cm=zip
57ggdGimonday
58tuesday
59wednesday
60thursday
61friday:set ul=100
62kkkdd:set ul=100
63dd:set ul=100
64dd:set ul=100
65:X
66foobar
67foobar
68:w!
69:bwipe!
70:e Xtestfile
71foobar
72:set key=
73uu:w >>test.out
74:"
75:"
76:" With encryption, cryptmethod=blowfish
77:e! Xtestfile
78:set undofile cm=blowfish
79ggdGijan
80feb
81mar
82apr
83jun:set ul=100
84kk0ifoo :set ul=100
85dd:set ul=100
86ibar :set ul=100
87:X
88foobar
89foobar
90:w!
91:bwipe!
92:e Xtestfile
93foobar
94:set key=
95/bar
96:.w >>test.out
97u:.w >>test.out
98u:.w >>test.out
99u:.w >>test.out
100:"
101:" Rename the undo file so that it gets cleaned up.
102:call rename(".Xtestfile.un~", "Xtestundo")
103:qa!
104ENDTEST
105
1061111 -----
1072222 -----
108
109123456789
110