blob: f9a15746160fb9e7e006c266b1283fe4812d6e16 [file] [log] [blame]
Bram Moolenaar9d47f172006-03-15 23:03:01 +00001Tests for undo tree.
2Since this script is sourced we need to explicitly break changes up in
3undo-able pieces. Do that by setting 'undolevels'.
Bram Moolenaar730cde92010-06-27 05:18:54 +02004Also tests :earlier and :later.
Bram Moolenaar9d47f172006-03-15 23:03:01 +00005
6STARTTEST
7:" Delete three characters and undo
8Gx:set ul=100
9x:set ul=100
10x:.w! test.out
11g-:.w >>test.out
12g-:.w >>test.out
13g-:.w >>test.out
14g-:.w >>test.out
15:"
16:/^111/w >>test.out
17:" Delete three other characters and go back in time step by step
18$x:set ul=100
19x:set ul=100
20x:.w >>test.out
21:sleep 1
22g-:.w >>test.out
23g-:.w >>test.out
24g-:.w >>test.out
25g-:.w >>test.out
26g-:.w >>test.out
27g-:.w >>test.out
28g-:.w >>test.out
29g-:.w >>test.out
3010g+:.w >>test.out
31:"
32:/^222/w >>test.out
33:" Delay for three seconds and go some seconds forward and backward
Bram Moolenaarfa1d1402006-03-25 21:59:56 +000034:sleep 2
Bram Moolenaar9d47f172006-03-15 23:03:01 +000035Aa:set ul=100
36Ab:set ul=100
37Ac:set ul=100
38:.w >>test.out
39:ear 1s
40:.w >>test.out
41:ear 3s
42:.w >>test.out
43:later 1s
44:.w >>test.out
45:later 1h
46:.w >>test.out
Bram Moolenaareb3593b2006-04-22 22:33:57 +000047:"
48:" test undojoin
49Goaaaa:set ul=100
50obbbbu:.w >>test.out
51obbbb:set ul=100
52:undojoin
53occccu:.w >>test.out
Bram Moolenaar730cde92010-06-27 05:18:54 +020054:e! Xtest
55ione one one:set ul=100
56:w!
57otwo:set ul=100
58otwo:set ul=100
59:w
60othree:earlier 1f
61:" expect "one one one\ntwo\ntwo"
62:%yank a
63:earlier 1f
64:" expect "one one one"
65:%yank b
66:earlier 1f
67:" expect empty line
68:%yank c
69:later 1f
70:" expect "one one one"
71:%yank d
72:later 1f
73:" expect "one one one\ntwo\ntwo"
74:%yank e
75:later 1f
76:" expect "one one one\ntwo\ntwo\nthree"
77ggO---:0put e
78ggO---:0put d
79ggO---:0put c
80ggO---:0put b
81ggO---:0put a
82ggO---:w >>test.out
Bram Moolenaar9d47f172006-03-15 23:03:01 +000083:qa!
84ENDTEST
85
861111 -----
872222 -----
88
89123456789