aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2018-12-29 11:12:18 -0500
committerJames McCoy <jamessan@jamessan.com>2018-12-29 16:52:25 -0500
commitce4199e8b043d32b03f1ac276defb429502a6bdf (patch)
treeaccfebc69dc4cb8950d6e5016bff3f0280089a30 /test
parent91f40ff2841c4f3af524010145ee54d6d048ce07 (diff)
downloadrneovim-ce4199e8b043d32b03f1ac276defb429502a6bdf.tar.gz
rneovim-ce4199e8b043d32b03f1ac276defb429502a6bdf.tar.bz2
rneovim-ce4199e8b043d32b03f1ac276defb429502a6bdf.zip
vim-patch:8.1.0353: an "after" directory of a package is appended to 'rtp'
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 vim/vim#3409) https://github.com/vim/vim/commit/99396d4cbf78d313a454c7448acc07412d2e45b7
Diffstat (limited to 'test')
-rw-r--r--test/functional/legacy/packadd_spec.lua20
1 files changed, 19 insertions, 1 deletions
diff --git a/test/functional/legacy/packadd_spec.lua b/test/functional/legacy/packadd_spec.lua
index ca3757ad3c..ca6e1a7b4c 100644
--- a/test/functional/legacy/packadd_spec.lua
+++ b/test/functional/legacy/packadd_spec.lua
@@ -29,6 +29,11 @@ describe('packadd', function()
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')
@@ -36,6 +41,14 @@ describe('packadd', function()
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
@@ -55,7 +68,12 @@ describe('packadd', function()
call assert_true(17, g:ftdetect_works)
call assert_true(len(&rtp) > len(rtp))
call assert_match(Escape(s:plugdir) . '\($\|,\)', &rtp)
- call assert_match(Escape(expand(s:plugdir . '/after$')), &rtp)
+
+ let new_after = match(&rtp, Escape(expand(s:plugdir . '/after') . ','))
+ let old_after = match(&rtp, ',' . Escape(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')