summaryrefslogtreecommitdiff
path: root/src/testdir/test_startup.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-08-06 19:01:55 +0200
committerBram Moolenaar <Bram@vim.org>2016-08-06 19:01:55 +0200
commit66459b7c98c67f8a9d39de8f08e8e8f1fca0e359 (patch)
tree5e61d00ee66ba009f17ad1d490ce810ae89e6c2b /src/testdir/test_startup.vim
parentd76a0c15f8bdbc901015879177fd5076d34c7a06 (diff)
downloadvim-git-66459b7c98c67f8a9d39de8f08e8e8f1fca0e359.tar.gz
patch 7.4.2164v7.4.2164
Problem: It is not possible to use plugins in an "after" directory to tune the behavior of a package. Solution: First load plugins from non-after directories, then packages and finally plugins in after directories. Reset 'loadplugins' before executing --cmd arguments.
Diffstat (limited to 'src/testdir/test_startup.vim')
-rw-r--r--src/testdir/test_startup.vim50
1 files changed, 49 insertions, 1 deletions
diff --git a/src/testdir/test_startup.vim b/src/testdir/test_startup.vim
index 0630b2a84..26e7b9f8e 100644
--- a/src/testdir/test_startup.vim
+++ b/src/testdir/test_startup.vim
@@ -1,8 +1,56 @@
-" Check that loading startup.vim works.
+" Tests for startup.
+
+source shared.vim
+" Check that loading startup.vim works.
func Test_startup_script()
set compatible
source $VIMRUNTIME/defaults.vim
call assert_equal(0, &compatible)
endfunc
+
+" Verify the order in which plugins are loaded:
+" 1. plugins in non-after directories
+" 2. packages
+" 3. plugins in after directories
+func Test_after_comes_later()
+ let before = [
+ \ 'let $HOME = "/does/not/exist"',
+ \ 'set loadplugins',
+ \ 'set rtp=Xhere,Xafter',
+ \ 'set packpath=Xhere,Xafter',
+ \ 'set nomore',
+ \ ]
+ let after = [
+ \ 'redir! > Xtestout',
+ \ 'scriptnames',
+ \ 'redir END',
+ \ 'quit',
+ \ ]
+ call mkdir('Xhere/plugin', 'p')
+ call writefile(['let done = 1'], 'Xhere/plugin/here.vim')
+ call mkdir('Xhere/pack/foo/start/foobar/plugin', 'p')
+ call writefile(['let done = 1'], 'Xhere/pack/foo/start/foobar/plugin/foo.vim')
+
+ call mkdir('Xafter/plugin', 'p')
+ call writefile(['let done = 1'], 'Xafter/plugin/later.vim')
+
+ call RunVim(before, after)
+
+ let lines = readfile('Xtestout')
+ let expected = ['Xbefore.vim', 'here.vim', 'foo.vim', 'later.vim', 'Xafter.vim']
+ let found = []
+ for line in lines
+ for one in expected
+ if line =~ one
+ call add(found, one)
+ endif
+ endfor
+ endfor
+ call assert_equal(expected, found)
+
+ call delete('Xtestout')
+ call delete('Xhere', 'rf')
+ call delete('Xafter', 'rf')
+endfunc