Bram Moolenaar | 9d47f17 | 2006-03-15 23:03:01 +0000 | [diff] [blame] | 1 | Tests for undo tree. |
| 2 | Since this script is sourced we need to explicitly break changes up in |
| 3 | undo-able pieces. Do that by setting 'undolevels'. |
Bram Moolenaar | 730cde9 | 2010-06-27 05:18:54 +0200 | [diff] [blame] | 4 | Also tests :earlier and :later. |
Bram Moolenaar | 9d47f17 | 2006-03-15 23:03:01 +0000 | [diff] [blame] | 5 | |
| 6 | STARTTEST |
Bram Moolenaar | 217d285 | 2010-09-14 12:47:37 +0200 | [diff] [blame] | 7 | :echo undotree().entries |
| 8 | ENDTEST |
| 9 | |
| 10 | STARTTEST |
Bram Moolenaar | 9d47f17 | 2006-03-15 23:03:01 +0000 | [diff] [blame] | 11 | :" Delete three characters and undo |
| 12 | Gx:set ul=100 |
| 13 | x:set ul=100 |
| 14 | x:.w! test.out |
| 15 | g-:.w >>test.out |
| 16 | g-:.w >>test.out |
| 17 | g-:.w >>test.out |
| 18 | g-:.w >>test.out |
| 19 | :" |
| 20 | :/^111/w >>test.out |
| 21 | :" Delete three other characters and go back in time step by step |
| 22 | $x:set ul=100 |
| 23 | x:set ul=100 |
| 24 | x:.w >>test.out |
| 25 | :sleep 1 |
| 26 | g-:.w >>test.out |
| 27 | g-:.w >>test.out |
| 28 | g-:.w >>test.out |
| 29 | g-:.w >>test.out |
| 30 | g-:.w >>test.out |
| 31 | g-:.w >>test.out |
| 32 | g-:.w >>test.out |
| 33 | g-:.w >>test.out |
| 34 | 10g+:.w >>test.out |
| 35 | :" |
| 36 | :/^222/w >>test.out |
| 37 | :" Delay for three seconds and go some seconds forward and backward |
Bram Moolenaar | fa1d140 | 2006-03-25 21:59:56 +0000 | [diff] [blame] | 38 | :sleep 2 |
Bram Moolenaar | 9d47f17 | 2006-03-15 23:03:01 +0000 | [diff] [blame] | 39 | Aa:set ul=100 |
| 40 | Ab:set ul=100 |
| 41 | Ac:set ul=100 |
| 42 | :.w >>test.out |
| 43 | :ear 1s |
| 44 | :.w >>test.out |
| 45 | :ear 3s |
| 46 | :.w >>test.out |
| 47 | :later 1s |
| 48 | :.w >>test.out |
| 49 | :later 1h |
| 50 | :.w >>test.out |
Bram Moolenaar | eb3593b | 2006-04-22 22:33:57 +0000 | [diff] [blame] | 51 | :" |
| 52 | :" test undojoin |
| 53 | Goaaaa:set ul=100 |
| 54 | obbbbu:.w >>test.out |
| 55 | obbbb:set ul=100 |
| 56 | :undojoin |
| 57 | occccu:.w >>test.out |
Bram Moolenaar | 730cde9 | 2010-06-27 05:18:54 +0200 | [diff] [blame] | 58 | :e! Xtest |
| 59 | ione one one:set ul=100 |
| 60 | :w! |
| 61 | otwo:set ul=100 |
| 62 | otwo:set ul=100 |
| 63 | :w |
| 64 | othree:earlier 1f |
| 65 | :" expect "one one one\ntwo\ntwo" |
| 66 | :%yank a |
| 67 | :earlier 1f |
| 68 | :" expect "one one one" |
| 69 | :%yank b |
| 70 | :earlier 1f |
| 71 | :" expect empty line |
| 72 | :%yank c |
| 73 | :later 1f |
| 74 | :" expect "one one one" |
| 75 | :%yank d |
| 76 | :later 1f |
| 77 | :" expect "one one one\ntwo\ntwo" |
| 78 | :%yank e |
| 79 | :later 1f |
| 80 | :" expect "one one one\ntwo\ntwo\nthree" |
| 81 | ggO---:0put e |
| 82 | ggO---:0put d |
| 83 | ggO---:0put c |
| 84 | ggO---:0put b |
| 85 | ggO---:0put a |
| 86 | ggO---:w >>test.out |
Bram Moolenaar | df9259a | 2013-06-15 17:54:43 +0200 | [diff] [blame] | 87 | :so small.vim |
Bram Moolenaar | 9b846cb | 2013-06-26 21:56:36 +0200 | [diff] [blame] | 88 | :set nocp viminfo+=nviminfo |
Bram Moolenaar | df9259a | 2013-06-15 17:54:43 +0200 | [diff] [blame] | 89 | :enew! |
| 90 | oa |
| 91 | :set ul=100 |
| 92 | ob |
| 93 | :set ul=100 |
| 94 | o1a2=setline('.','1234') |
| 95 | |
| 96 | uu:%w >>test.out |
Bram Moolenaar | 9d47f17 | 2006-03-15 23:03:01 +0000 | [diff] [blame] | 97 | :qa! |
| 98 | ENDTEST |
| 99 | |
| 100 | 1111 ----- |
| 101 | 2222 ----- |
| 102 | |
| 103 | 123456789 |