1Tests for undo tree.
2Since this script is sourced we need to explicitly break changes up in
3undo-able pieces.  Do that by setting 'undolevels'.
4Also tests :earlier and :later.
5
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
34:sleep 2
35Aa: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
47:"
48:" test undojoin
49Goaaaa:set ul=100
50obbbbu:.w >>test.out
51obbbb:set ul=100
52:undojoin
53occccu:.w >>test.out
54: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
83:qa!
84ENDTEST
85
861111 -----
872222 -----
88
89123456789
90