summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-03-03 15:47:06 +0100
committerBram Moolenaar <Bram@vim.org>2016-03-03 15:47:06 +0100
commit863c1a9079fa340d663ccafb011729a29186d73e (patch)
tree892a28e0594ec0be6b9499b71e3f78ba227333f6
parent1bdd42627d619258d0e847f217cfc1c2795f1ac5 (diff)
patch 7.4.1479v7.4.1479
Problem: No testfor ":loadplugin". Solution: Add a test. Fix how option is being set.
-rw-r--r--src/ex_cmds2.c8
-rw-r--r--src/testdir/Make_all.mak1
-rw-r--r--src/testdir/test_loadplugin.vim25
-rw-r--r--src/version.c2
4 files changed, 32 insertions, 4 deletions
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 3768569397..52575bf0a5 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -3058,14 +3058,14 @@ do_in_runtimepath(
static void
may_do_filetypes(char_u *pat)
{
- char_u *cmd = vim_strsave((char_u *)"did_load_filetypes");
+ char_u *cmd = vim_strsave((char_u *)"g:did_load_filetypes");
/* If runtime/filetype.vim wasn't loaded yet, the scripts will be found
* when it loads. */
if (cmd != NULL && eval_to_number(cmd) > 0)
{
do_cmdline_cmd((char_u *)"augroup filetypedetect");
- source_runtime(pat, TRUE);
+ do_in_path(p_pp, pat, TRUE, source_callback, NULL);
do_cmdline_cmd((char_u *)"augroup END");
}
vim_free(cmd);
@@ -3125,8 +3125,8 @@ source_pack_plugin(char_u *fname, void *cookie UNUSED)
if (p_rtp[keep] != NUL)
mch_memmove(new_rtp + keep + 1 + addlen, p_rtp + keep,
oldlen - keep + 1);
- free_string_option(p_rtp);
- p_rtp = new_rtp;
+ set_option_value((char_u *)"rtp", 0L, new_rtp, 0);
+ vim_free(new_rtp);
}
*p2 = c;
diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak
index 8901b15896..4c3c616782 100644
--- a/src/testdir/Make_all.mak
+++ b/src/testdir/Make_all.mak
@@ -178,6 +178,7 @@ NEW_TESTS = test_arglist.res \
test_increment.res \
test_json.res \
test_langmap.res \
+ test_loadplugin.res \
test_perl.res \
test_quickfix.res \
test_syntax.res \
diff --git a/src/testdir/test_loadplugin.vim b/src/testdir/test_loadplugin.vim
new file mode 100644
index 0000000000..25c6715384
--- /dev/null
+++ b/src/testdir/test_loadplugin.vim
@@ -0,0 +1,25 @@
+" Tests for :loadplugin
+
+func Test_loadplugin()
+ let topdir = expand('%:h') . '/Xdir'
+ exe 'set packpath=' . topdir
+ let plugdir = topdir . '/pack/mine/opt/mytest'
+ call mkdir(plugdir . '/plugin', 'p')
+ call mkdir(plugdir . '/ftdetect', 'p')
+ 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
+endfunc
diff --git a/src/version.c b/src/version.c
index 0731d61bd5..d13f47afa4 100644
--- a/src/version.c
+++ b/src/version.c
@@ -744,6 +744,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1479,
+/**/
1478,
/**/
1477,