aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy/packadd_spec.lua
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2018-03-28 21:52:06 -0400
committerJames McCoy <jamessan@jamessan.com>2018-03-28 21:54:39 -0400
commit79f9c2d9c650ceab27cdc6707fd6d7fa1de29fc1 (patch)
tree4e0589d75801f3ff6a9678f84f5009102766661e /test/functional/legacy/packadd_spec.lua
parent4403864da3c48412595d439f36458d1e6ccfc49f (diff)
parent3f3de9b1a95d273463a87516365510dbffcaf3d2 (diff)
downloadrneovim-79f9c2d9c650ceab27cdc6707fd6d7fa1de29fc1.tar.gz
rneovim-79f9c2d9c650ceab27cdc6707fd6d7fa1de29fc1.tar.bz2
rneovim-79f9c2d9c650ceab27cdc6707fd6d7fa1de29fc1.zip
Merge branch 'master' into yagebu/option-fixes
Diffstat (limited to 'test/functional/legacy/packadd_spec.lua')
-rw-r--r--test/functional/legacy/packadd_spec.lua57
1 files changed, 48 insertions, 9 deletions
diff --git a/test/functional/legacy/packadd_spec.lua b/test/functional/legacy/packadd_spec.lua
index c280888dda..fb308475c0 100644
--- a/test/functional/legacy/packadd_spec.lua
+++ b/test/functional/legacy/packadd_spec.lua
@@ -9,17 +9,15 @@ local function expected_empty()
eq({}, nvim.get_vvar('errors'))
end
-if helpers.pending_win32(pending) then return end
-
describe('packadd', function()
before_each(function()
clear()
source([=[
func SetUp()
- let s:topdir = expand('%:p:h') . '/Xdir'
+ let s:topdir = expand(expand('%:p:h') . '/Xdir')
exe 'set packpath=' . s:topdir
- let s:plugdir = s:topdir . '/pack/mine/opt/mytest'
+ let s:plugdir = expand(s:topdir . '/pack/mine/opt/mytest')
endfunc
func TearDown()
@@ -52,8 +50,8 @@ describe('packadd', function()
call assert_equal(77, g:plugin_also_works)
call assert_true(17, g:ftdetect_works)
call assert_true(len(&rtp) > len(rtp))
- call assert_true(&rtp =~ (s:plugdir . '\($\|,\)'))
- call assert_true(&rtp =~ (s:plugdir . '/after$'))
+ call assert_true(&rtp =~ (escape(s:plugdir, '\') . '\($\|,\)'))
+ call assert_true(&rtp =~ escape(expand(s:plugdir . '/after$'), '\'))
" Check exception
call assert_fails("packadd directorynotfound", 'E919:')
@@ -74,7 +72,7 @@ describe('packadd', function()
packadd! mytest
call assert_true(len(&rtp) > len(rtp))
- call assert_true(&rtp =~ (s:plugdir . '\($\|,\)'))
+ call assert_true(&rtp =~ (escape(s:plugdir, '\') . '\($\|,\)'))
call assert_equal(0, g:plugin_works)
" check the path is not added twice
@@ -83,6 +81,42 @@ describe('packadd', function()
call assert_equal(new_rtp, &rtp)
endfunc
+ func Test_packadd_symlink_dir()
+ let top2_dir = expand(s:topdir . '/Xdir2')
+ let real_dir = expand(s:topdir . '/Xsym')
+ call mkdir(real_dir, 'p')
+ if has('win32')
+ exec "silent! !mklink /d" top2_dir "Xsym"
+ else
+ exec "silent! !ln -s Xsym" top2_dir
+ endif
+ let &rtp = top2_dir . ',' . expand(top2_dir . '/after')
+ let &packpath = &rtp
+
+ let s:plugdir = expand(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 = 44')
+ wq
+ let g:plugin_works = 0
+
+ packadd mytest
+
+ " Must have been inserted in the middle, not at the end
+ call assert_true(&rtp =~ escape(expand('/pack/mine/opt/mytest').',', '\'))
+ call assert_equal(44, 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 !" (has('win32') ? "rd /q/s" : "rm") top2_dir
+ endfunc
+
func Test_packloadall()
" plugin foo with an autoload directory
let fooplugindir = &packpath . '/pack/mine/start/foo/plugin'
@@ -137,9 +171,9 @@ describe('packadd', function()
helptags ALL
- let tags1 = readfile(docdir1 . '/tags')
+ let tags1 = readfile(docdir1 . '/tags')
call assert_true(tags1[0] =~ 'look-here')
- let tags2 = readfile(docdir2 . '/tags')
+ let tags2 = readfile(docdir2 . '/tags')
call assert_true(tags2[0] =~ 'look-away')
endfunc
@@ -227,6 +261,11 @@ describe('packadd', function()
expected_empty()
end)
+ it('works with symlinks', function()
+ call('Test_packadd_symlink_dir')
+ expected_empty()
+ end)
+
it('works with :packloadall', function()
call('Test_packloadall')
expected_empty()