mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
win: enable legacy/packadd_spec.lua
This commit is contained in:
parent
f4d82c1438
commit
e55de56a99
@ -9,17 +9,15 @@ local function expected_empty()
|
|||||||
eq({}, nvim.get_vvar('errors'))
|
eq({}, nvim.get_vvar('errors'))
|
||||||
end
|
end
|
||||||
|
|
||||||
if helpers.pending_win32(pending) then return end
|
|
||||||
|
|
||||||
describe('packadd', function()
|
describe('packadd', function()
|
||||||
before_each(function()
|
before_each(function()
|
||||||
clear()
|
clear()
|
||||||
|
|
||||||
source([=[
|
source([=[
|
||||||
func SetUp()
|
func SetUp()
|
||||||
let s:topdir = expand('%:p:h') . '/Xdir'
|
let s:topdir = expand(expand('%:p:h') . '/Xdir')
|
||||||
exe 'set packpath=' . s:topdir
|
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
|
endfunc
|
||||||
|
|
||||||
func TearDown()
|
func TearDown()
|
||||||
@ -52,8 +50,8 @@ describe('packadd', function()
|
|||||||
call assert_equal(77, g:plugin_also_works)
|
call assert_equal(77, g:plugin_also_works)
|
||||||
call assert_true(17, g:ftdetect_works)
|
call assert_true(17, g:ftdetect_works)
|
||||||
call assert_true(len(&rtp) > len(rtp))
|
call assert_true(len(&rtp) > len(rtp))
|
||||||
call assert_true(&rtp =~ (s:plugdir . '\($\|,\)'))
|
call assert_true(&rtp =~ (escape(s:plugdir, '\') . '\($\|,\)'))
|
||||||
call assert_true(&rtp =~ (s:plugdir . '/after$'))
|
call assert_true(&rtp =~ escape(expand(s:plugdir . '/after$'), '\'))
|
||||||
|
|
||||||
" Check exception
|
" Check exception
|
||||||
call assert_fails("packadd directorynotfound", 'E919:')
|
call assert_fails("packadd directorynotfound", 'E919:')
|
||||||
@ -74,7 +72,7 @@ describe('packadd', function()
|
|||||||
packadd! mytest
|
packadd! mytest
|
||||||
|
|
||||||
call assert_true(len(&rtp) > len(rtp))
|
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)
|
call assert_equal(0, g:plugin_works)
|
||||||
|
|
||||||
" check the path is not added twice
|
" check the path is not added twice
|
||||||
@ -84,17 +82,18 @@ describe('packadd', function()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_packadd_symlink_dir()
|
func Test_packadd_symlink_dir()
|
||||||
if !has('unix')
|
let top2_dir = expand(s:topdir . '/Xdir2')
|
||||||
return
|
let real_dir = expand(s:topdir . '/Xsym')
|
||||||
endif
|
|
||||||
let top2_dir = s:topdir . '/Xdir2'
|
|
||||||
let real_dir = s:topdir . '/Xsym'
|
|
||||||
call mkdir(real_dir, 'p')
|
call mkdir(real_dir, 'p')
|
||||||
|
if has('win32')
|
||||||
|
exec "silent! !mklink /d" top2_dir "Xsym"
|
||||||
|
else
|
||||||
exec "silent! !ln -s Xsym" top2_dir
|
exec "silent! !ln -s Xsym" top2_dir
|
||||||
let &rtp = top2_dir . ',' . top2_dir . '/after'
|
endif
|
||||||
|
let &rtp = top2_dir . ',' . expand(top2_dir . '/after')
|
||||||
let &packpath = &rtp
|
let &packpath = &rtp
|
||||||
|
|
||||||
let s:plugdir = top2_dir . '/pack/mine/opt/mytest'
|
let s:plugdir = expand(top2_dir . '/pack/mine/opt/mytest')
|
||||||
call mkdir(s:plugdir . '/plugin', 'p')
|
call mkdir(s:plugdir . '/plugin', 'p')
|
||||||
|
|
||||||
exe 'split ' . s:plugdir . '/plugin/test.vim'
|
exe 'split ' . s:plugdir . '/plugin/test.vim'
|
||||||
@ -105,7 +104,7 @@ describe('packadd', function()
|
|||||||
packadd mytest
|
packadd mytest
|
||||||
|
|
||||||
" Must have been inserted in the middle, not at the end
|
" Must have been inserted in the middle, not at the end
|
||||||
call assert_true(&rtp =~ '/pack/mine/opt/mytest,')
|
call assert_true(&rtp =~ escape(expand('/pack/mine/opt/mytest').',', '\'))
|
||||||
call assert_equal(44, g:plugin_works)
|
call assert_equal(44, g:plugin_works)
|
||||||
|
|
||||||
" No change when doing it again.
|
" No change when doing it again.
|
||||||
@ -115,7 +114,7 @@ describe('packadd', function()
|
|||||||
|
|
||||||
set rtp&
|
set rtp&
|
||||||
let rtp = &rtp
|
let rtp = &rtp
|
||||||
exec "silent !rm" top2_dir
|
exec "silent !" (has('win32') ? "rd /q/s" : "rm") top2_dir
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_packloadall()
|
func Test_packloadall()
|
||||||
|
Loading…
Reference in New Issue
Block a user