Skip to content

Commit 863c1a9

Browse files
committed
patch 7.4.1479
Problem: No testfor ":loadplugin". Solution: Add a test. Fix how option is being set.
1 parent 1bdd426 commit 863c1a9

4 files changed

Lines changed: 32 additions & 4 deletions

File tree

src/ex_cmds2.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3058,14 +3058,14 @@ do_in_runtimepath(
30583058
static void
30593059
may_do_filetypes(char_u *pat)
30603060
{
3061-
char_u *cmd = vim_strsave((char_u *)"did_load_filetypes");
3061+
char_u *cmd = vim_strsave((char_u *)"g:did_load_filetypes");
30623062

30633063
/* If runtime/filetype.vim wasn't loaded yet, the scripts will be found
30643064
* when it loads. */
30653065
if (cmd != NULL && eval_to_number(cmd) > 0)
30663066
{
30673067
do_cmdline_cmd((char_u *)"augroup filetypedetect");
3068-
source_runtime(pat, TRUE);
3068+
do_in_path(p_pp, pat, TRUE, source_callback, NULL);
30693069
do_cmdline_cmd((char_u *)"augroup END");
30703070
}
30713071
vim_free(cmd);
@@ -3125,8 +3125,8 @@ source_pack_plugin(char_u *fname, void *cookie UNUSED)
31253125
if (p_rtp[keep] != NUL)
31263126
mch_memmove(new_rtp + keep + 1 + addlen, p_rtp + keep,
31273127
oldlen - keep + 1);
3128-
free_string_option(p_rtp);
3129-
p_rtp = new_rtp;
3128+
set_option_value((char_u *)"rtp", 0L, new_rtp, 0);
3129+
vim_free(new_rtp);
31303130
}
31313131
*p2 = c;
31323132

src/testdir/Make_all.mak

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ NEW_TESTS = test_arglist.res \
178178
test_increment.res \
179179
test_json.res \
180180
test_langmap.res \
181+
test_loadplugin.res \
181182
test_perl.res \
182183
test_quickfix.res \
183184
test_syntax.res \

src/testdir/test_loadplugin.vim

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
" Tests for :loadplugin
2+
3+
func Test_loadplugin()
4+
let topdir = expand('%:h') . '/Xdir'
5+
exe 'set packpath=' . topdir
6+
let plugdir = topdir . '/pack/mine/opt/mytest'
7+
call mkdir(plugdir . '/plugin', 'p')
8+
call mkdir(plugdir . '/ftdetect', 'p')
9+
filetype on
10+
try
11+
exe 'split ' . plugdir . '/plugin/test.vim'
12+
call setline(1, 'let g:plugin_works = 42')
13+
wq
14+
15+
exe 'split ' . plugdir . '/ftdetect/test.vim'
16+
call setline(1, 'let g:ftdetect_works = 17')
17+
wq
18+
19+
loadplugin mytest
20+
call assert_true(42, g:plugin_works)
21+
call assert_true(17, g:ftdetect_works)
22+
finally
23+
call delete(topdir, 'rf')
24+
endtry
25+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,8 @@ static char *(features[]) =
743743

744744
static int included_patches[] =
745745
{ /* Add new patch number below this line */
746+
/**/
747+
1479,
746748
/**/
747749
1478,
748750
/**/

0 commit comments

Comments
 (0)