|
1 | | -" Check that loading startup.vim works. |
| 1 | +" Tests for startup. |
| 2 | + |
| 3 | +source shared.vim |
2 | 4 |
|
| 5 | +" Check that loading startup.vim works. |
3 | 6 | func Test_startup_script() |
4 | 7 | set compatible |
5 | 8 | source $VIMRUNTIME/defaults.vim |
6 | 9 |
|
7 | 10 | call assert_equal(0, &compatible) |
8 | 11 | endfunc |
| 12 | + |
| 13 | +" Verify the order in which plugins are loaded: |
| 14 | +" 1. plugins in non-after directories |
| 15 | +" 2. packages |
| 16 | +" 3. plugins in after directories |
| 17 | +func Test_after_comes_later() |
| 18 | + let before = [ |
| 19 | + \ 'let $HOME = "/does/not/exist"', |
| 20 | + \ 'set loadplugins', |
| 21 | + \ 'set rtp=Xhere,Xafter', |
| 22 | + \ 'set packpath=Xhere,Xafter', |
| 23 | + \ 'set nomore', |
| 24 | + \ ] |
| 25 | + let after = [ |
| 26 | + \ 'redir! > Xtestout', |
| 27 | + \ 'scriptnames', |
| 28 | + \ 'redir END', |
| 29 | + \ 'quit', |
| 30 | + \ ] |
| 31 | + call mkdir('Xhere/plugin', 'p') |
| 32 | + call writefile(['let done = 1'], 'Xhere/plugin/here.vim') |
| 33 | + call mkdir('Xhere/pack/foo/start/foobar/plugin', 'p') |
| 34 | + call writefile(['let done = 1'], 'Xhere/pack/foo/start/foobar/plugin/foo.vim') |
| 35 | + |
| 36 | + call mkdir('Xafter/plugin', 'p') |
| 37 | + call writefile(['let done = 1'], 'Xafter/plugin/later.vim') |
| 38 | + |
| 39 | + call RunVim(before, after) |
| 40 | + |
| 41 | + let lines = readfile('Xtestout') |
| 42 | + let expected = ['Xbefore.vim', 'here.vim', 'foo.vim', 'later.vim', 'Xafter.vim'] |
| 43 | + let found = [] |
| 44 | + for line in lines |
| 45 | + for one in expected |
| 46 | + if line =~ one |
| 47 | + call add(found, one) |
| 48 | + endif |
| 49 | + endfor |
| 50 | + endfor |
| 51 | + call assert_equal(expected, found) |
| 52 | + |
| 53 | + call delete('Xtestout') |
| 54 | + call delete('Xhere', 'rf') |
| 55 | + call delete('Xafter', 'rf') |
| 56 | +endfunc |
0 commit comments