mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 22:48:34 +00:00
vim-patch:7.4.1479
Problem: No testfor ":loadplugin".
Solution: Add a test. Fix how option is being set.
863c1a9079
This commit is contained in:
@@ -2378,13 +2378,13 @@ int do_in_runtimepath(char_u *name, bool all, DoInRuntimepathCB callback,
|
|||||||
// Source filetype detection scripts, if filetype.vim was already done.
|
// Source filetype detection scripts, if filetype.vim was already done.
|
||||||
static void may_do_filetypes(char_u *pat)
|
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
|
// If runtime/filetype.vim wasn't loaded yet, the scripts will be found
|
||||||
// when it loads.
|
// when it loads.
|
||||||
if (cmd != NULL && eval_to_number(cmd) > 0) {
|
if (cmd != NULL && eval_to_number(cmd) > 0) {
|
||||||
do_cmdline_cmd("augroup filetypedetect");
|
do_cmdline_cmd("augroup filetypedetect");
|
||||||
source_runtime(pat, TRUE);
|
do_in_path(p_pp, pat, true, source_callback, NULL);
|
||||||
do_cmdline_cmd("augroup END");
|
do_cmdline_cmd("augroup END");
|
||||||
}
|
}
|
||||||
xfree(cmd);
|
xfree(cmd);
|
||||||
@@ -2438,8 +2438,8 @@ static void source_pack_plugin(char_u *fname, void *cookie)
|
|||||||
memmove(new_rtp + keep + 1 + addlen, p_rtp + keep,
|
memmove(new_rtp + keep + 1 + addlen, p_rtp + keep,
|
||||||
oldlen - keep + 1);
|
oldlen - keep + 1);
|
||||||
}
|
}
|
||||||
free_string_option(p_rtp);
|
set_option_value((char_u *)"rtp", 0L, new_rtp, 0);
|
||||||
p_rtp = new_rtp;
|
xfree(new_rtp);
|
||||||
}
|
}
|
||||||
*p2 = c;
|
*p2 = c;
|
||||||
|
|
||||||
|
@@ -216,7 +216,7 @@ static int included_patches[] = {
|
|||||||
// 1482 NA
|
// 1482 NA
|
||||||
// 1481 NA
|
// 1481 NA
|
||||||
// 1480,
|
// 1480,
|
||||||
// 1479,
|
1479,
|
||||||
1478,
|
1478,
|
||||||
// 1477,
|
// 1477,
|
||||||
// 1476 NA
|
// 1476 NA
|
||||||
|
46
test/functional/legacy/loadplugin_spec.lua
Normal file
46
test/functional/legacy/loadplugin_spec.lua
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
-- Tests for :loadplugin
|
||||||
|
|
||||||
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
|
local clear, source = helpers.clear, helpers.source
|
||||||
|
local call, eq, nvim = helpers.call, helpers.eq, helpers.meths
|
||||||
|
|
||||||
|
local function expected_empty()
|
||||||
|
eq({}, nvim.get_vvar('errors'))
|
||||||
|
end
|
||||||
|
|
||||||
|
describe('loadplugin', function()
|
||||||
|
setup(function()
|
||||||
|
clear()
|
||||||
|
|
||||||
|
source([=[
|
||||||
|
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')
|
||||||
|
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
|
||||||
|
]=])
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('is working', function()
|
||||||
|
call('Test_loadplugin')
|
||||||
|
expected_empty()
|
||||||
|
end)
|
||||||
|
end)
|
Reference in New Issue
Block a user