Bram Moolenaar | 644fdff | 2010-05-30 13:26:21 +0200 | [diff] [blame] | 1 | Tests for undo file. |
| 2 | Since this script is sourced we need to explicitly break changes up in |
| 3 | undo-able pieces. Do that by setting 'undolevels'. |
| 4 | |
| 5 | STARTTEST |
| 6 | :so small.vim |
| 7 | :" |
| 8 | :" Test 'undofile': first a simple one-line change. |
Bram Moolenaar | a8ffcbb | 2010-06-21 06:15:46 +0200 | [diff] [blame] | 9 | :set nocp ul=100 undofile nomore |
Bram Moolenaar | 644fdff | 2010-05-30 13:26:21 +0200 | [diff] [blame] | 10 | :e! Xtestfile |
| 11 | ggdGithis is one line:set ul=100 |
| 12 | :s/one/ONE/ |
| 13 | :set ul=100 |
| 14 | :w |
| 15 | :bwipe! |
| 16 | :e Xtestfile |
| 17 | u:.w! test.out |
| 18 | :" |
| 19 | :" Test 'undofile', change in original file fails check |
| 20 | :set noundofile |
| 21 | :e! Xtestfile |
| 22 | :s/line/Line/ |
| 23 | :w |
| 24 | :set undofile |
| 25 | :bwipe! |
| 26 | :e Xtestfile |
| 27 | u:.w >>test.out |
| 28 | :" |
| 29 | :" Test 'undofile', add 10 lines, delete 6 lines, undo 3 |
| 30 | :set undofile |
| 31 | ggdGione |
| 32 | two |
| 33 | three |
| 34 | four |
| 35 | five |
| 36 | six |
| 37 | seven |
| 38 | eight |
| 39 | nine |
| 40 | ten:set ul=100 |
| 41 | 3Gdd:set ul=100 |
| 42 | dd:set ul=100 |
| 43 | dd:set ul=100 |
| 44 | dd:set ul=100 |
| 45 | dd:set ul=100 |
| 46 | dd:set ul=100 |
| 47 | :w |
| 48 | :bwipe! |
| 49 | :e Xtestfile |
| 50 | uuu:w >>test.out |
| 51 | :" |
Bram Moolenaar | a3ff49f | 2010-05-30 22:48:02 +0200 | [diff] [blame] | 52 | :" And now with encryption, cryptmethod=0 |
| 53 | :e! Xtestfile |
| 54 | :set undofile cm=0 |
| 55 | ggdG |
| 56 | imonday |
| 57 | tuesday |
| 58 | wednesday |
| 59 | thursday |
| 60 | friday:set ul=100 |
| 61 | kkkdd:set ul=100 |
| 62 | dd:set ul=100 |
| 63 | dd:set ul=100 |
| 64 | :X |
| 65 | foobar |
| 66 | foobar |
| 67 | :w! |
| 68 | :bwipe! |
| 69 | :e Xtestfile |
| 70 | foobar |
| 71 | :set key= |
| 72 | uu:w >>test.out |
| 73 | :" |
| 74 | :" |
| 75 | :" With encryption, cryptmethod=1 |
| 76 | :e! Xtestfile |
| 77 | :set undofile cm=1 |
| 78 | ggdG |
| 79 | ijan |
| 80 | feb |
| 81 | mar |
| 82 | apr |
| 83 | jun:set ul=100 |
| 84 | kk0ifoo :set ul=100 |
| 85 | dd:set ul=100 |
| 86 | ibar :set ul=100 |
| 87 | :X |
| 88 | foobar |
| 89 | foobar |
| 90 | :w! |
| 91 | :bwipe! |
| 92 | :e Xtestfile |
| 93 | foobar |
| 94 | :set key= |
| 95 | /bar |
| 96 | :.w >>test.out |
| 97 | u:.w >>test.out |
| 98 | u:.w >>test.out |
| 99 | u:.w >>test.out |
| 100 | :" |
Bram Moolenaar | 644fdff | 2010-05-30 13:26:21 +0200 | [diff] [blame] | 101 | :" Rename the undo file so that it gets cleaned up. |
| 102 | :call rename(".Xtestfile.un~", "Xtestundo") |
| 103 | :qa! |
| 104 | ENDTEST |
| 105 | |
| 106 | 1111 ----- |
| 107 | 2222 ----- |
| 108 | |
| 109 | 123456789 |