blob: 3b3a6a43294185b605930206fcae9443bf0c6a14 [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
7:"
8:" Test 'undofile': first a simple one-line change.
Bram Moolenaardd10ce92010-08-07 13:27:48 +02009:set nocompatible viminfo+=nviminfo visualbell
Bram Moolenaar00ec6852010-08-01 15:47:03 +020010:set ul=100 undofile nomore
Bram Moolenaar644fdff2010-05-30 13:26:21 +020011: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
Bram Moolenaarf4274fe2010-08-01 17:37:17 +020028:" TODO: this beeps
Bram Moolenaar644fdff2010-05-30 13:26:21 +020029u:.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 Moolenaar0e1673a2010-07-30 21:49:07 +020084:set undofile cm=blowfish
Bram Moolenaarf4274fe2010-08-01 17:37:17 +020085ggdGijan
Bram Moolenaara3ff49f2010-05-30 22:48:02 +020086feb
87mar
88apr
89jun:set ul=100
90kk0ifoo :set ul=100
91dd:set ul=100
92ibar :set ul=100
93:X
94foobar
95foobar
96:w!
97:bwipe!
98:e Xtestfile
99foobar
100:set key=
101/bar
102:.w >>test.out
103u:.w >>test.out
104u:.w >>test.out
105u:.w >>test.out
106:"
Bram Moolenaar644fdff2010-05-30 13:26:21 +0200107:" Rename the undo file so that it gets cleaned up.
Bram Moolenaar206f0112014-03-12 16:51:55 +0100108:if has("vms")
109: call rename("_un_Xtestfile", "Xtestundo")
110:else
111: call rename(".Xtestfile.un~", "Xtestundo")
112:endif
Bram Moolenaar644fdff2010-05-30 13:26:21 +0200113:qa!
114ENDTEST
115
1161111 -----
1172222 -----
118
119123456789