@@ -150,6 +150,19 @@ func Test_xdg_runtime_files()
150150 call system ($ ' {vimcmd} -S Xscript' )
151151 call assert_equal ([], readfile (' Xresult' ))
152152
153+ " Test for $MYVIMDIR changes when updating runtimepath
154+ let lines = << trim END
155+ let msg = $ ' HOME="{$HOME}", XDG_CONFIG_HOME="{$XDG_CONFIG_HOME}" rtp-prepend'
156+ set rtp ^= /non- existing
157+ call assert_match (' XfakeHOME/xdg/vim/vimrc' , $MYVIMRC , msg)
158+ call assert_match (' /non-existing' , $MYVIMDIR , msg)
159+ call writefile (v: errors , ' Xresult' )
160+ quit
161+ END
162+ call writefile (lines , ' Xscript' , ' D' )
163+ call system ($ ' {vimcmd} -S Xscript' )
164+ call assert_equal ([], readfile (' Xresult' ))
165+
153166 call delete (rc4)
154167 unlet $XDG_CONFIG_HOME
155168endfunc
@@ -267,13 +280,14 @@ func Test_zzz_xdg_runtime_files()
267280 call delete (rc2)
268281
269282 " Test for ~/.config/vim/gvimrc
283+ " MYVIMDIR is only set to ~/config/.vim if ~/.config/vim/vimrc exists!
270284 let lines = << trim END
271285 " Ignore the "failed to create input context" error.
272286 call test_ignore_error (' E285' )
273287 gui - f
274288 let msg = $ ' HOME="{$HOME}", ~="{expand("~")}"'
275289 call assert_match (' Xhome/\.config/vim/gvimrc' , $MYGVIMRC , msg)
276- call assert_match (' Xhome/\.config/ vim/' , $MYVIMDIR , msg)
290+ call assert_match (' Xhome/\.vim/' , $MYVIMDIR , msg)
277291 call filter (g: , {idx, _ - > idx = ~ ' ^rc' })
278292 call assert_equal (#{rc_three: ' three' , rc: ' .config/vim/gvimrc' }, g: )
279293 call writefile (v: errors , ' Xresult' )
@@ -286,14 +300,15 @@ func Test_zzz_xdg_runtime_files()
286300 call delete (rc3)
287301
288302 " Test for ~/xdg/vim/gvimrc
303+ " MYVIMDIR is only set to ~/xdg/vim if ~/xdg/vim/vimrc exists!
289304 let $XDG_CONFIG_HOME = expand (' ~/xdg/' )
290305 let lines = << trim END
291306 " Ignore the "failed to create input context" error.
292307 call test_ignore_error (' E285' )
293308 gui - f
294309 let msg = $ ' HOME="{$HOME}", XDG_CONFIG_HOME="{$XDG_CONFIG_HOME}"'
295310 call assert_match (' Xhome/xdg/vim/gvimrc' , $MYGVIMRC , msg)
296- call assert_match (' Xhome/xdg/ vim/' , $MYVIMDIR , msg)
311+ call assert_match (' Xhome/\. vim/' , $MYVIMDIR , msg)
297312 call filter (g: , {idx, _ - > idx = ~ ' ^rc' })
298313 call assert_equal (#{rc_four: ' four' , rc: ' xdg/vim/gvimrc' }, g: )
299314 call writefile (v: errors , ' Xresult' )
0 commit comments