Mercurial > vim
diff 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 |
line wrap: on
line diff
--- a/src/testdir/test_packadd.vim +++ b/src/testdir/test_packadd.vim @@ -37,8 +37,8 @@ func Test_packadd() call assert_equal(77, g:plugin_also_works) call assert_equal(17, g:ftdetect_works) call assert_true(len(&rtp) > len(rtp)) - call assert_true(&rtp =~ '/testdir/Xdir/pack/mine/opt/mytest\($\|,\)') - call assert_true(&rtp =~ '/testdir/Xdir/pack/mine/opt/mytest/after$') + call assert_match('/testdir/Xdir/pack/mine/opt/mytest\($\|,\)', &rtp) + call assert_match('/testdir/Xdir/pack/mine/opt/mytest/after$', &rtp) " Check exception call assert_fails("packadd directorynotfound", 'E919:') @@ -60,7 +60,7 @@ func Test_packadd_start() call assert_equal(24, g:plugin_works) call assert_true(len(&rtp) > len(rtp)) - call assert_true(&rtp =~ '/testdir/Xdir/pack/mine/start/other\($\|,\)') + call assert_match('/testdir/Xdir/pack/mine/start/other\($\|,\)', &rtp) endfunc func Test_packadd_noload() @@ -77,7 +77,7 @@ func Test_packadd_noload() packadd! mytest call assert_true(len(&rtp) > len(rtp)) - call assert_true(&rtp =~ 'testdir/Xdir/pack/mine/opt/mytest\($\|,\)') + call assert_match('testdir/Xdir/pack/mine/opt/mytest\($\|,\)', &rtp) call assert_equal(0, g:plugin_works) " check the path is not added twice @@ -108,7 +108,7 @@ func Test_packadd_symlink_dir() packadd mytest " Must have been inserted in the middle, not at the end - call assert_true(&rtp =~ '/pack/mine/opt/mytest,') + call assert_match('/pack/mine/opt/mytest,', &rtp) call assert_equal(44, g:plugin_works) " No change when doing it again. @@ -121,6 +121,43 @@ func Test_packadd_symlink_dir() exec "silent !rm" top2_dir endfunc +func Test_packadd_symlink_dir2() + if !has('unix') + return + endif + let top2_dir = s:topdir . '/Xdir2' + let real_dir = s:topdir . '/Xsym/pack' + call mkdir(top2_dir, 'p') + call mkdir(real_dir, 'p') + let &rtp = top2_dir . ',' . top2_dir . '/after' + let &packpath = &rtp + + exec "silent !ln -s ../Xsym/pack" top2_dir . '/pack' + let s:plugdir = top2_dir . '/pack/mine/opt/mytest' + call mkdir(s:plugdir . '/plugin', 'p') + + exe 'split ' . s:plugdir . '/plugin/test.vim' + call setline(1, 'let g:plugin_works = 48') + wq + let g:plugin_works = 0 + + packadd mytest + + " Must have been inserted in the middle, not at the end + call assert_match('/Xdir2/pack/mine/opt/mytest,', &rtp) + call assert_equal(48, g:plugin_works) + + " No change when doing it again. + let rtp_before = &rtp + packadd mytest + call assert_equal(rtp_before, &rtp) + + set rtp& + let rtp = &rtp + exec "silent !rm" top2_dir . '/pack' + exec "silent !rmdir" top2_dir +endfunc + " Check command-line completion for 'packadd' func Test_packadd_completion() let optdir1 = &packpath . '/pack/mine/opt' @@ -196,9 +233,9 @@ func Test_helptags() helptags ALL let tags1 = readfile(docdir1 . '/tags') - call assert_true(tags1[0] =~ 'look-here') + call assert_match('look-here', tags1[0]) let tags2 = readfile(docdir2 . '/tags') - call assert_true(tags2[0] =~ 'look-away') + call assert_match('look-away', tags2[0]) endfunc func Test_colorscheme()