comparison src/testdir/test_packadd.vim @ 13190:9fccd578ce1f v8.0.1469

patch 8.0.1469: when package path is a symlink 'runtimepath' is wrong commit https://github.com/vim/vim/commit/2374faae111057ee28e8d487f9a52a95855e2206 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Feb 4 17:47:42 2018 +0100 patch 8.0.1469: when package path is a symlink 'runtimepath' is wrong Problem: When package path is a symlink adding it to 'runtimepath' happens at the end. Solution: Do not resolve symlinks before locating the position in 'runtimepath'. (Ozaki Kiichi, closes #2604)
author Christian Brabandt <cb@256bit.org>
date Sun, 04 Feb 2018 18:00:06 +0100
parents afd60028f7b7
children 5ef1e6170589
comparison
equal deleted inserted replaced
13189:893d4211408d 13190:9fccd578ce1f
35 35
36 call assert_equal(42, g:plugin_works) 36 call assert_equal(42, g:plugin_works)
37 call assert_equal(77, g:plugin_also_works) 37 call assert_equal(77, g:plugin_also_works)
38 call assert_equal(17, g:ftdetect_works) 38 call assert_equal(17, g:ftdetect_works)
39 call assert_true(len(&rtp) > len(rtp)) 39 call assert_true(len(&rtp) > len(rtp))
40 call assert_true(&rtp =~ '/testdir/Xdir/pack/mine/opt/mytest\($\|,\)') 40 call assert_match('/testdir/Xdir/pack/mine/opt/mytest\($\|,\)', &rtp)
41 call assert_true(&rtp =~ '/testdir/Xdir/pack/mine/opt/mytest/after$') 41 call assert_match('/testdir/Xdir/pack/mine/opt/mytest/after$', &rtp)
42 42
43 " Check exception 43 " Check exception
44 call assert_fails("packadd directorynotfound", 'E919:') 44 call assert_fails("packadd directorynotfound", 'E919:')
45 call assert_fails("packadd", 'E471:') 45 call assert_fails("packadd", 'E471:')
46 endfunc 46 endfunc
58 58
59 packadd other 59 packadd other
60 60
61 call assert_equal(24, g:plugin_works) 61 call assert_equal(24, g:plugin_works)
62 call assert_true(len(&rtp) > len(rtp)) 62 call assert_true(len(&rtp) > len(rtp))
63 call assert_true(&rtp =~ '/testdir/Xdir/pack/mine/start/other\($\|,\)') 63 call assert_match('/testdir/Xdir/pack/mine/start/other\($\|,\)', &rtp)
64 endfunc 64 endfunc
65 65
66 func Test_packadd_noload() 66 func Test_packadd_noload()
67 call mkdir(s:plugdir . '/plugin', 'p') 67 call mkdir(s:plugdir . '/plugin', 'p')
68 call mkdir(s:plugdir . '/syntax', 'p') 68 call mkdir(s:plugdir . '/syntax', 'p')
75 let g:plugin_works = 0 75 let g:plugin_works = 0
76 76
77 packadd! mytest 77 packadd! mytest
78 78
79 call assert_true(len(&rtp) > len(rtp)) 79 call assert_true(len(&rtp) > len(rtp))
80 call assert_true(&rtp =~ 'testdir/Xdir/pack/mine/opt/mytest\($\|,\)') 80 call assert_match('testdir/Xdir/pack/mine/opt/mytest\($\|,\)', &rtp)
81 call assert_equal(0, g:plugin_works) 81 call assert_equal(0, g:plugin_works)
82 82
83 " check the path is not added twice 83 " check the path is not added twice
84 let new_rtp = &rtp 84 let new_rtp = &rtp
85 packadd! mytest 85 packadd! mytest
106 let g:plugin_works = 0 106 let g:plugin_works = 0
107 107
108 packadd mytest 108 packadd mytest
109 109
110 " Must have been inserted in the middle, not at the end 110 " Must have been inserted in the middle, not at the end
111 call assert_true(&rtp =~ '/pack/mine/opt/mytest,') 111 call assert_match('/pack/mine/opt/mytest,', &rtp)
112 call assert_equal(44, g:plugin_works) 112 call assert_equal(44, g:plugin_works)
113 113
114 " No change when doing it again. 114 " No change when doing it again.
115 let rtp_before = &rtp 115 let rtp_before = &rtp
116 packadd mytest 116 packadd mytest
117 call assert_equal(rtp_before, &rtp) 117 call assert_equal(rtp_before, &rtp)
118 118
119 set rtp& 119 set rtp&
120 let rtp = &rtp 120 let rtp = &rtp
121 exec "silent !rm" top2_dir 121 exec "silent !rm" top2_dir
122 endfunc
123
124 func Test_packadd_symlink_dir2()
125 if !has('unix')
126 return
127 endif
128 let top2_dir = s:topdir . '/Xdir2'
129 let real_dir = s:topdir . '/Xsym/pack'
130 call mkdir(top2_dir, 'p')
131 call mkdir(real_dir, 'p')
132 let &rtp = top2_dir . ',' . top2_dir . '/after'
133 let &packpath = &rtp
134
135 exec "silent !ln -s ../Xsym/pack" top2_dir . '/pack'
136 let s:plugdir = top2_dir . '/pack/mine/opt/mytest'
137 call mkdir(s:plugdir . '/plugin', 'p')
138
139 exe 'split ' . s:plugdir . '/plugin/test.vim'
140 call setline(1, 'let g:plugin_works = 48')
141 wq
142 let g:plugin_works = 0
143
144 packadd mytest
145
146 " Must have been inserted in the middle, not at the end
147 call assert_match('/Xdir2/pack/mine/opt/mytest,', &rtp)
148 call assert_equal(48, g:plugin_works)
149
150 " No change when doing it again.
151 let rtp_before = &rtp
152 packadd mytest
153 call assert_equal(rtp_before, &rtp)
154
155 set rtp&
156 let rtp = &rtp
157 exec "silent !rm" top2_dir . '/pack'
158 exec "silent !rmdir" top2_dir
122 endfunc 159 endfunc
123 160
124 " Check command-line completion for 'packadd' 161 " Check command-line completion for 'packadd'
125 func Test_packadd_completion() 162 func Test_packadd_completion()
126 let optdir1 = &packpath . '/pack/mine/opt' 163 let optdir1 = &packpath . '/pack/mine/opt'
194 exe 'set rtp=' . &packpath . '/pack/mine/start/foo,' . &packpath . '/pack/mine/start/bar' 231 exe 'set rtp=' . &packpath . '/pack/mine/start/foo,' . &packpath . '/pack/mine/start/bar'
195 232
196 helptags ALL 233 helptags ALL
197 234
198 let tags1 = readfile(docdir1 . '/tags') 235 let tags1 = readfile(docdir1 . '/tags')
199 call assert_true(tags1[0] =~ 'look-here') 236 call assert_match('look-here', tags1[0])
200 let tags2 = readfile(docdir2 . '/tags') 237 let tags2 = readfile(docdir2 . '/tags')
201 call assert_true(tags2[0] =~ 'look-away') 238 call assert_match('look-away', tags2[0])
202 endfunc 239 endfunc
203 240
204 func Test_colorscheme() 241 func Test_colorscheme()
205 let colordirrun = &packpath . '/runtime/colors' 242 let colordirrun = &packpath . '/runtime/colors'
206 let colordirstart = &packpath . '/pack/mine/start/foo/colors' 243 let colordirstart = &packpath . '/pack/mine/start/foo/colors'