blob: 961df4c5df83e37a0c193dadb33997afb4f014ee [file] [log] [blame]
Bram Moolenaar644fdff2010-05-30 13:26:21 +02001Tests 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
Bram Moolenaarc3c766e2017-03-08 22:55:19 +01007:set belloff=all
Bram Moolenaar644fdff2010-05-30 13:26:21 +02008:"
9:" Test 'undofile': first a simple one-line change.
Bram Moolenaardd10ce92010-08-07 13:27:48 +020010:set nocompatible viminfo+=nviminfo visualbell
Bram Moolenaar00ec6852010-08-01 15:47:03 +020011:set ul=100 undofile nomore
Bram Moolenaar644fdff2010-05-30 13:26:21 +020012:e! Xtestfile
13ggdGithis is one line:set ul=100
14:s/one/ONE/
15:set ul=100
16:w
17:bwipe!
18:e Xtestfile
19u:.w! test.out
20:"
21:" Test 'undofile', change in original file fails check
22:set noundofile
23:e! Xtestfile
24:s/line/Line/
25:w
26:set undofile
27:bwipe!
28:e Xtestfile
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:"
Bram Moolenaar374d32d2012-01-04 19:34:37 +010054:" Test that reading the undofiles when setting undofile works
55:set noundofile ul=0
56i
57u:e! Xtestfile
58:set undofile ul=100
59uuuuuu:w >>test.out
Bram Moolenaar0e1673a2010-07-30 21:49:07 +020060:" And now with encryption, cryptmethod=zip
Bram Moolenaara3ff49f2010-05-30 22:48:02 +020061:e! Xtestfile
Bram Moolenaar0e1673a2010-07-30 21:49:07 +020062:set undofile cm=zip
Bram Moolenaarf4274fe2010-08-01 17:37:17 +020063ggdGimonday
Bram Moolenaara3ff49f2010-05-30 22:48:02 +020064tuesday
65wednesday
66thursday
67friday:set ul=100
68kkkdd:set ul=100
69dd:set ul=100
70dd:set ul=100
71:X
72foobar
73foobar
74:w!
75:bwipe!
76:e Xtestfile
77foobar
78:set key=
79uu:w >>test.out
80:"
81:"
Bram Moolenaar0e1673a2010-07-30 21:49:07 +020082:" With encryption, cryptmethod=blowfish
Bram Moolenaara3ff49f2010-05-30 22:48:02 +020083:e! Xtestfile
Bram Moolenaar8f4ac012014-08-10 13:38:34 +020084rubbish
Bram Moolenaar72971a22014-11-05 16:39:28 +010085:set undofile cm=blowfish ff&
Bram Moolenaarf4274fe2010-08-01 17:37:17 +020086ggdGijan
Bram Moolenaara3ff49f2010-05-30 22:48:02 +020087feb
88mar
89apr
90jun:set ul=100
91kk0ifoo :set ul=100
92dd:set ul=100
93ibar :set ul=100
94:X
95foobar
96foobar
97:w!
98:bwipe!
99:e Xtestfile
100foobar
101:set key=
102/bar
103:.w >>test.out
104u:.w >>test.out
105u:.w >>test.out
106u:.w >>test.out
107:"
Bram Moolenaar8f4ac012014-08-10 13:38:34 +0200108:" With encryption, cryptmethod=blowfish2
109:e! Xtestfile
110rubbish
Bram Moolenaar72971a22014-11-05 16:39:28 +0100111:set undofile cm=blowfish2 ff&
Bram Moolenaar8f4ac012014-08-10 13:38:34 +0200112ggdGijan
113feb
114mar
115apr
116jun:set ul=100
117kk0ifoo :set ul=100
118dd:set ul=100
119ibar :set ul=100
120:X
121foo2bar
122foo2bar
123:w!
124:bwipe!
125:e Xtestfile
126foo2bar
127:set key=
128/bar
129:.w >>test.out
130u:.w >>test.out
131u:.w >>test.out
132u:.w >>test.out
133:"
Bram Moolenaar644fdff2010-05-30 13:26:21 +0200134:" Rename the undo file so that it gets cleaned up.
Bram Moolenaar206f0112014-03-12 16:51:55 +0100135:if has("vms")
136: call rename("_un_Xtestfile", "Xtestundo")
137:else
138: call rename(".Xtestfile.un~", "Xtestundo")
139:endif
Bram Moolenaar644fdff2010-05-30 13:26:21 +0200140:qa!
141ENDTEST
142
1431111 -----
1442222 -----
145
146123456789