summaryrefslogtreecommitdiff
path: root/src/testdir
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-09-08 18:21:16 +0200
committerBram Moolenaar <Bram@vim.org>2018-09-08 18:21:16 +0200
commit99396d4cbf78d313a454c7448acc07412d2e45b7 (patch)
treed5a1008daa002b6851cd3a04346a9a9464a9076a /src/testdir
parentd4a1aabe372ccb95aec968f4d54503231b1f956c (diff)
downloadvim-git-99396d4cbf78d313a454c7448acc07412d2e45b7.tar.gz
patch 8.1.0353: an "after" directory of a package is appended to 'rtp'v8.1.0353
Problem: An "after" directory of a package is appended to 'rtp', which will be after the user's "after" directory. () Solution: Insert the package "after" directory before any other "after" directory in 'rtp'. (closes #3409)
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/test_packadd.vim20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/testdir/test_packadd.vim b/src/testdir/test_packadd.vim
index 64bd8d2b2..f511a4d58 100644
--- a/src/testdir/test_packadd.vim
+++ b/src/testdir/test_packadd.vim
@@ -12,6 +12,11 @@ func TearDown()
endfunc
func Test_packadd()
+ if !exists('s:plugdir')
+ echomsg 'when running this test manually, call SetUp() first'
+ return
+ endif
+
call mkdir(s:plugdir . '/plugin/also', 'p')
call mkdir(s:plugdir . '/ftdetect', 'p')
call mkdir(s:plugdir . '/after', 'p')
@@ -19,6 +24,14 @@ func Test_packadd()
let rtp = &rtp
filetype on
+ let rtp_entries = split(rtp, ',')
+ for entry in rtp_entries
+ if entry =~? '\<after\>'
+ let first_after_entry = entry
+ break
+ endif
+ endfor
+
exe 'split ' . s:plugdir . '/plugin/test.vim'
call setline(1, 'let g:plugin_works = 42')
wq
@@ -38,7 +51,12 @@ func Test_packadd()
call assert_equal(17, g:ftdetect_works)
call assert_true(len(&rtp) > len(rtp))
call assert_match('/testdir/Xdir/pack/mine/opt/mytest\($\|,\)', &rtp)
- call assert_match('/testdir/Xdir/pack/mine/opt/mytest/after$', &rtp)
+
+ let new_after = match(&rtp, '/testdir/Xdir/pack/mine/opt/mytest/after,')
+ let old_after = match(&rtp, ',' . first_after_entry . '\>')
+ call assert_true(new_after > 0, 'rtp is ' . &rtp)
+ call assert_true(old_after > 0, 'rtp is ' . &rtp)
+ call assert_true(new_after < old_after, 'rtp is ' . &rtp)
" NOTE: '/.../opt/myte' forwardly matches with '/.../opt/mytest'
call mkdir(fnamemodify(s:plugdir, ':h') . '/myte', 'p')