To: vim_dev@googlegroups.com Subject: Patch 7.4.1479 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1479 Problem: No test for ":loadplugin". Solution: Add a test. Fix how option is being set. Files: src/ex_cmds2.c, src/testdir/test_loadplugin.vim, src/testdir/Make_all.mak *** ../vim-7.4.1478/src/ex_cmds2.c 2016-03-03 14:23:06.478991745 +0100 --- src/ex_cmds2.c 2016-03-03 15:41:17.470423310 +0100 *************** *** 3058,3071 **** static void may_do_filetypes(char_u *pat) { ! char_u *cmd = vim_strsave((char_u *)"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_cmdline_cmd((char_u *)"augroup END"); } vim_free(cmd); --- 3058,3071 ---- static void may_do_filetypes(char_u *pat) { ! 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"); ! do_in_path(p_pp, pat, TRUE, source_callback, NULL); do_cmdline_cmd((char_u *)"augroup END"); } vim_free(cmd); *************** *** 3125,3132 **** 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; } *p2 = c; --- 3125,3132 ---- if (p_rtp[keep] != NUL) mch_memmove(new_rtp + keep + 1 + addlen, p_rtp + keep, oldlen - keep + 1); ! set_option_value((char_u *)"rtp", 0L, new_rtp, 0); ! vim_free(new_rtp); } *p2 = c; *** ../vim-7.4.1478/src/testdir/test_loadplugin.vim 2016-03-03 15:46:20.839288174 +0100 --- src/testdir/test_loadplugin.vim 2016-03-03 14:53:27.960067070 +0100 *************** *** 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 *** ../vim-7.4.1478/src/testdir/Make_all.mak 2016-02-28 18:03:55.690659915 +0100 --- src/testdir/Make_all.mak 2016-03-03 14:31:37.933682949 +0100 *************** *** 178,183 **** --- 178,184 ---- test_increment.res \ test_json.res \ test_langmap.res \ + test_loadplugin.res \ test_perl.res \ test_quickfix.res \ test_syntax.res \ *** ../vim-7.4.1478/src/version.c 2016-03-03 14:23:06.482991702 +0100 --- src/version.c 2016-03-03 15:45:41.623693536 +0100 *************** *** 745,746 **** --- 745,748 ---- { /* Add new patch number below this line */ + /**/ + 1479, /**/ -- Mrs Abbott: I'm a paediatrician. Basil: Feet? Mrs Abbott: Children. Sybil: Oh, Basil! Basil: Well, children have feet, don't they? That's how they move around, my dear. You must take a look next time, it's most interesting. (Fawlty Towers) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///