diff options
author | James McCoy <jamessan@jamessan.com> | 2016-04-28 20:47:27 -0400 |
---|---|---|
committer | James McCoy <jamessan@jamessan.com> | 2016-07-08 01:43:30 -0400 |
commit | 67d8e586318a3f2f13df22f9a3b25c6d8a109e6c (patch) | |
tree | 4eef691cf90cee6144e0cec7b8f56f33629cb8bc /test/functional/legacy/loadplugin_spec.lua | |
parent | d43ac790f2454e2173eb645bdcd97c7a7c7e4846 (diff) | |
download | rneovim-67d8e586318a3f2f13df22f9a3b25c6d8a109e6c.tar.gz rneovim-67d8e586318a3f2f13df22f9a3b25c6d8a109e6c.tar.bz2 rneovim-67d8e586318a3f2f13df22f9a3b25c6d8a109e6c.zip |
vim-patch:7.4.1480
Problem: Cannot add a pack direcory without loading a plugin.
Solution: Add the :packadd command.
https://github.com/vim/vim/commit/91715873d19a1859c08eeded7848113596e2f2bd
Diffstat (limited to 'test/functional/legacy/loadplugin_spec.lua')
-rw-r--r-- | test/functional/legacy/loadplugin_spec.lua | 73 |
1 files changed, 53 insertions, 20 deletions
diff --git a/test/functional/legacy/loadplugin_spec.lua b/test/functional/legacy/loadplugin_spec.lua index 267520ac5c..af97db3ae5 100644 --- a/test/functional/legacy/loadplugin_spec.lua +++ b/test/functional/legacy/loadplugin_spec.lua @@ -13,34 +13,67 @@ describe('loadplugin', function() clear() source([=[ + func SetUp() + let s:topdir = expand('%:p:h') . '/Xdir' + exe 'set packpath=' . s:topdir + let s:plugdir = s:topdir . '/pack/mine/opt/mytest' + endfunc + + func TearDown() + call delete(s:topdir, 'rf') + endfunc + func Test_loadplugin() - let topdir = expand('%:p:h') . '/Xdir' - exe 'set packpath=' . topdir - let plugdir = topdir . '/pack/mine/opt/mytest' - call mkdir(plugdir . '/plugin', 'p') - call mkdir(plugdir . '/ftdetect', 'p') + call mkdir(s:plugdir . '/plugin', 'p') + call mkdir(s:plugdir . '/ftdetect', 'p') + set rtp& + let rtp = &rtp filetype on - try - exe 'split ' . plugdir . '/plugin/test.vim' - call setline(1, 'let g:plugin_works = 42') - wq - - exe 'split ' . plugdir . '/ftdetect/test.vim' - call setline(1, 'let g:ftdetect_works = 17') - wq - - loadplugin mytest - call assert_true(42, g:plugin_works) - call assert_true(17, g:ftdetect_works) - finally - call delete(topdir, 'rf') - endtry + + exe 'split ' . s:plugdir . '/plugin/test.vim' + call setline(1, 'let g:plugin_works = 42') + wq + + exe 'split ' . s:plugdir . '/ftdetect/test.vim' + call setline(1, 'let g:ftdetect_works = 17') + wq + + loadplugin mytest + + call assert_true(42, g:plugin_works) + call assert_true(17, g:ftdetect_works) + call assert_true(len(&rtp) > len(rtp)) + call assert_true(&rtp =~ (s:plugdir . '\($\|,\)')) + endfunc + + func Test_packadd() + call mkdir(s:plugdir . '/syntax', 'p') + set rtp& + let rtp = &rtp + packadd mytest + call assert_true(len(&rtp) > len(rtp)) + call assert_true(&rtp =~ (s:plugdir . '\($\|,\)')) + + " check the path is not added twice + let new_rtp = &rtp + packadd mytest + call assert_equal(new_rtp, &rtp) endfunc ]=]) + call('SetUp') + end) + + teardown(function() + call('TearDown') end) it('is working', function() call('Test_loadplugin') expected_empty() end) + + it('works with packadd', function() + call('Test_packadd') + expected_empty() + end) end) |