Mercurial > vim
view src/testdir/test_loadplugin.vim @ 8376:e448f2a5d45b v7.4.1480
commit https://github.com/vim/vim/commit/91715873d19a1859c08eeded7848113596e2f2bd
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Mar 3 17:13:03 2016 +0100
patch 7.4.1480
Problem: Cannot add a pack direcory without loading a plugin.
Solution: Add the :packadd command.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 03 Mar 2016 17:15:05 +0100 |
parents | 5d834058bf44 |
children |
line wrap: on
line source
" Tests for :loadplugin func SetUp() let s:topdir = expand('%: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() call mkdir(s:plugdir . '/plugin', 'p') call mkdir(s:plugdir . '/ftdetect', 'p') set rtp& let rtp = &rtp filetype on 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_equal(42, g:plugin_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\($\|,\)') 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 =~ 'testdir/Xdir/pack/mine/opt/mytest\($\|,\)') " check the path is not added twice let new_rtp = &rtp packadd mytest call assert_equal(new_rtp, &rtp) endfunc