comparison src/testdir/test_packadd.vim @ 14681:285b051979a6 v8.1.0353

patch 8.1.0353: an "after" directory of a package is appended to 'rtp' commit https://github.com/vim/vim/commit/99396d4cbf78d313a454c7448acc07412d2e45b7 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Sep 8 18:21:16 2018 +0200 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 #3409)
author Christian Brabandt <cb@256bit.org>
date Sat, 08 Sep 2018 18:30:06 +0200
parents 5ef1e6170589
children c833cf17a4b1
comparison
equal deleted inserted replaced
14680:ac64c88a6033 14681:285b051979a6
10 func TearDown() 10 func TearDown()
11 call delete(s:topdir, 'rf') 11 call delete(s:topdir, 'rf')
12 endfunc 12 endfunc
13 13
14 func Test_packadd() 14 func Test_packadd()
15 if !exists('s:plugdir')
16 echomsg 'when running this test manually, call SetUp() first'
17 return
18 endif
19
15 call mkdir(s:plugdir . '/plugin/also', 'p') 20 call mkdir(s:plugdir . '/plugin/also', 'p')
16 call mkdir(s:plugdir . '/ftdetect', 'p') 21 call mkdir(s:plugdir . '/ftdetect', 'p')
17 call mkdir(s:plugdir . '/after', 'p') 22 call mkdir(s:plugdir . '/after', 'p')
18 set rtp& 23 set rtp&
19 let rtp = &rtp 24 let rtp = &rtp
20 filetype on 25 filetype on
26
27 let rtp_entries = split(rtp, ',')
28 for entry in rtp_entries
29 if entry =~? '\<after\>'
30 let first_after_entry = entry
31 break
32 endif
33 endfor
21 34
22 exe 'split ' . s:plugdir . '/plugin/test.vim' 35 exe 'split ' . s:plugdir . '/plugin/test.vim'
23 call setline(1, 'let g:plugin_works = 42') 36 call setline(1, 'let g:plugin_works = 42')
24 wq 37 wq
25 38
36 call assert_equal(42, g:plugin_works) 49 call assert_equal(42, g:plugin_works)
37 call assert_equal(77, g:plugin_also_works) 50 call assert_equal(77, g:plugin_also_works)
38 call assert_equal(17, g:ftdetect_works) 51 call assert_equal(17, g:ftdetect_works)
39 call assert_true(len(&rtp) > len(rtp)) 52 call assert_true(len(&rtp) > len(rtp))
40 call assert_match('/testdir/Xdir/pack/mine/opt/mytest\($\|,\)', &rtp) 53 call assert_match('/testdir/Xdir/pack/mine/opt/mytest\($\|,\)', &rtp)
41 call assert_match('/testdir/Xdir/pack/mine/opt/mytest/after$', &rtp) 54
55 let new_after = match(&rtp, '/testdir/Xdir/pack/mine/opt/mytest/after,')
56 let old_after = match(&rtp, ',' . first_after_entry . '\>')
57 call assert_true(new_after > 0, 'rtp is ' . &rtp)
58 call assert_true(old_after > 0, 'rtp is ' . &rtp)
59 call assert_true(new_after < old_after, 'rtp is ' . &rtp)
42 60
43 " NOTE: '/.../opt/myte' forwardly matches with '/.../opt/mytest' 61 " NOTE: '/.../opt/myte' forwardly matches with '/.../opt/mytest'
44 call mkdir(fnamemodify(s:plugdir, ':h') . '/myte', 'p') 62 call mkdir(fnamemodify(s:plugdir, ':h') . '/myte', 'p')
45 let rtp = &rtp 63 let rtp = &rtp
46 packadd myte 64 packadd myte