Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | Tests for autocommands on :close command |
| 2 | |
| 3 | Write three files and open them, each in a window. |
| 4 | Then go to next window, with autocommand that deletes the previous one. |
| 5 | Do this twice, writing the file. |
| 6 | |
| 7 | Also test deleting the buffer on a Unload event. If this goes wrong there |
| 8 | will be the ATTENTION prompt. |
| 9 | |
| 10 | Also test changing buffers in a BufDel autocommand. If this goes wrong there |
| 11 | are ml_line errors and/or a Crash. |
| 12 | |
| 13 | STARTTEST |
| 14 | :so small.vim |
| 15 | :/^start of testfile/,/^end of testfile/w! Xtestje1 |
| 16 | :/^start of testfile/,/^end of testfile/w! Xtestje2 |
| 17 | :/^start of testfile/,/^end of testfile/w! Xtestje3 |
| 18 | :e Xtestje1 |
| 19 | otestje1 |
| 20 | :w |
| 21 | :sp Xtestje2 |
| 22 | otestje2 |
| 23 | :w |
| 24 | :sp Xtestje3 |
| 25 | otestje3 |
| 26 | :w |
| 27 | |
| 28 | :au WinLeave Xtestje2 bwipe |
| 29 | |
| 30 | :w! test.out |
| 31 | :au WinLeave Xtestje1 bwipe Xtestje3 |
| 32 | :close |
| 33 | :w >>test.out |
| 34 | :e Xtestje1 |
| 35 | :bwipe Xtestje2 Xtestje3 test.out |
| 36 | :au! |
| 37 | :au! BufUnload Xtestje1 bwipe |
| 38 | :e Xtestje3 |
| 39 | :w >>test.out |
| 40 | :e Xtestje2 |
| 41 | :sp Xtestje1 |
| 42 | :e |
| 43 | :w >>test.out |
| 44 | :au! |
| 45 | :only |
| 46 | :e Xtestje1 |
| 47 | :bwipe Xtestje2 Xtestje3 test.out test13.in |
| 48 | :au BufWipeout Xtestje1 buf Xtestje1 |
| 49 | :bwipe |
| 50 | :w >>test.out |
Bram Moolenaar | c7a0d32 | 2015-06-19 12:43:07 +0200 | [diff] [blame] | 51 | :only |
| 52 | :help |
| 53 | :wincmd w |
| 54 | :1quit |
| 55 | :$put ='Final line' |
| 56 | :$w >>test.out |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 57 | :qa! |
| 58 | ENDTEST |
| 59 | |
| 60 | start of testfile |
| 61 | contents |
| 62 | contents |
| 63 | contents |
| 64 | end of testfile |