let rc = s:get_rcs()
let before =<< trim CODE
call writefile([expand('$MYVIMRC')], "XMY_VIMRC")
- call writefile([expand('$MYVIMRCDIR')], "XMY_VIMDIR")
+ call writefile([expand('$MYVIMDIR')], "XMY_VIMDIR")
quit!
CODE
call RunVim(before, [], "")
" g:rc_one|two|three|four is to verify, that the other
" init files are not sourced
" g:rc is to verify which rc file has been loaded.
+ " g:rc_vimdir is to verify $MYVIMDIR is set and valid
let file1 =<< trim CODE
let g:rc_one = 'one'
let g:rc = '.vimrc'
+ let g:rc_vimdir = expand('~/.vim/')
+ call assert_equal(g:rc_vimdir, $MYVIMDIR)
CODE
let file2 =<< trim CODE
let g:rc_two = 'two'
let g:rc = '.vim/vimrc'
+ let g:rc_vimdir = expand('~/.vim/')
+ call assert_equal(g:rc_vimdir, $MYVIMDIR)
CODE
let file3 =<< trim CODE
let g:rc_three = 'three'
let g:rc = '.config/vim/vimrc'
+ let g:rc_vimdir = expand('~/.config/vim/')
+ call assert_equal(g:rc_vimdir, $MYVIMDIR)
CODE
let file4 =<< trim CODE
let g:rc_four = 'four'
let g:rc = 'xdg/vim/vimrc'
+ let g:rc_vimdir = expand('~/xdg/vim/')
+ call assert_equal(g:rc_vimdir, $MYVIMDIR)
CODE
call writefile(file1, rc1)
call writefile(file2, rc2)
call assert_match('XfakeHOME/\.vimrc', $MYVIMRC)
call assert_match('XfakeHOME/.vim/', $MYVIMDIR)
call filter(g:, {idx, _ -> idx =~ '^rc'})
- call assert_equal(#{rc_one: 'one', rc: '.vimrc'}, g:)
+ call assert_equal(#{rc_one: 'one', rc: '.vimrc', rc_vimdir: $MYVIMDIR}, g:)
call assert_match('XfakeHOME/\.vim/view', &viewdir)
call writefile(v:errors, 'Xresult')
quit
call assert_match('XfakeHOME/\.vim/vimrc', $MYVIMRC)
call assert_match('XfakeHOME/\.vim/', $MYVIMDIR)
call filter(g:, {idx, _ -> idx =~ '^rc'})
- call assert_equal(#{rc_two: 'two', rc: '.vim/vimrc'}, g:)
+ call assert_equal(#{rc_two: 'two', rc: '.vim/vimrc', rc_vimdir: $MYVIMDIR}, g:)
call assert_match('XfakeHOME/\.vim/view', &viewdir)
call writefile(v:errors, 'Xresult')
quit
call assert_match('XfakeHOME/\.config/vim/vimrc', $MYVIMRC, msg)
call assert_match('XfakeHOME/\.config/vim/', $MYVIMDIR, msg)
call filter(g:, {idx, _ -> idx =~ '^rc'})
- call assert_equal(#{rc_three: 'three', rc: '.config/vim/vimrc'}, g:)
+ call assert_equal(#{rc_three: 'three', rc: '.config/vim/vimrc', rc_vimdir: $MYVIMDIR}, g:)
call assert_match('XfakeHOME/\.config/vim/view', &viewdir)
call writefile(v:errors, 'Xresult')
quit
call assert_match('XfakeHOME/xdg/vim/vimrc', $MYVIMRC, msg)
call assert_match('XfakeHOME/xdg/vim/', $MYVIMDIR, msg)
call filter(g:, {idx, _ -> idx =~ '^rc'})
- call assert_equal(#{rc_four: 'four', rc: 'xdg/vim/vimrc'}, g:)
+ call assert_equal(#{rc_four: 'four', rc: 'xdg/vim/vimrc', rc_vimdir: $MYVIMDIR}, g:)
call assert_match('XfakeHOME/xdg/vim/view, &viewdir)
call writefile(v:errors, 'Xresult')
quit